summaryrefslogtreecommitdiff
path: root/src/actions.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-04-01 01:17:53 +0000
committersabetts <sabetts>2001-04-01 01:17:53 +0000
commit299d16aa6ae37bd73ae92ee8a5d1c6715682ee35 (patch)
tree2361849e3956311464ab696132f35ed931946fd1 /src/actions.c
parentf04f2c8483f144d20caa9ee7103a0eca8493545f (diff)
downloadratpoison-299d16aa6ae37bd73ae92ee8a5d1c6715682ee35.zip
* src/split.h (find_window_for_frame): new function prototype
(find_window_for_frame): likewise (find_window_for_frame): likewise (find_window_for_frame): likewise (find_window_for_frame): likewise * src/split.c (window_fits_in_frame): new function (find_window_for_frame): likewise (split_window): likewise (v_split_window): likewise (h_split_window): likewise (remove_all_frames): likewise (frame_is_below): likewise (frame_is_above): likewise (frame_is_left): likewise (frame_is_right): likewise (total_frame_area): likewise (num_frames): likewise (frames_overlap): likewise (frame_overlaps): likewise (remove_frame): likewise * src/ratpoison.h: includes "split.h" * src/manage.c (unmanage): calls free_window (maximize_transient): takes the window's frame into account (maximize_normal): likewise * src/list.h (find_window_prev_with_frame): new function prototype (find_window_next_with_frame): likewise (free_window): likewise * src/list.c (free_window): new function (add_to_window_list): initialize new window's frame to NULL. (find_window_prev): skips windows with frames (find_window_next): likewise (find_window_other): likewise (find_window_prev_with_frame): new function (find_window_next_with_frame): new function (set_active_window): returns if the specified window is already the current window. (set_active_window): If the new window has no frame it inherits the current window's frame. (set_active_window): maximize and raise the newly active window. * src/events.c (unmap_notify): handles window frames. (destroy_window): simplified * src/data.h (struct rp_window_frame): new struct (struct rp_window): add frame variable * src/conf.h (WINDOW_BORDER_WIDTH): set to 1 * src/actions.h (cmd_next_frame): new function prototype (cmd_prev_frame): likewise (cmd_h_split): likewise (cmd_v_split): likewise (cmd_only): likewise (cmd_remove): likewise * src/actions.c (initialize_default_keybindings): new default bindings for "split", "vsplit", "focus", "only", "remove" (user_commands): new user commands "split", "vsplit", "focus", "only", "remove" (cmd_prev_frame): new function (cmd_next_frame): likewise (cmd_h_split): likewise (cmd_v_split): likewise (cmd_only): likewise (cmd_remove): likewise * src/Makefile.am (ratpoison_SOURCES): new files split.c split.h
Diffstat (limited to 'src/actions.c')
-rw-r--r--src/actions.c130
1 files changed, 108 insertions, 22 deletions
diff --git a/src/actions.c b/src/actions.c
index 44017fd..f7f3163 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -125,29 +125,40 @@ initialize_default_keybindings (void)
add_keybinding (XK_v, ControlMask, "version");
add_keybinding (XK_w, 0, "windows");
add_keybinding (XK_w, ControlMask, "windows");
+ add_keybinding (XK_S, 0, "split");
+ add_keybinding (XK_S, ControlMask, "vsplit");
+ add_keybinding (XK_Tab, 0, "focus");
+ add_keybinding (XK_Q, 0, "only");
+ add_keybinding (XK_R, 0, "remove");
}
user_command user_commands[] =
- { {"abort", cmd_abort, arg_VOID},
- {"next", cmd_next, arg_VOID},
- {"prev", cmd_prev, arg_VOID},
- {"exec", cmd_exec, arg_STRING},
- {"select", cmd_select, arg_STRING},
- {"colon", cmd_colon, arg_STRING},
- {"kill", cmd_kill, arg_VOID},
- {"delete", cmd_delete, arg_VOID},
- {"other", cmd_other, arg_VOID},
- {"windows", cmd_windows, arg_VOID},
- {"title", cmd_rename, arg_STRING},
- {"clock", cmd_clock, arg_VOID},
- {"maximize", cmd_maximize, arg_VOID},
- {"newwm", cmd_newwm, arg_STRING},
- {"generate", cmd_generate, arg_STRING}, /* rename to stuff */
- {"version", cmd_version, arg_VOID},
- {"bind", cmd_bind, arg_VOID},
- {"source", cmd_source, arg_STRING},
- {"escape", cmd_escape, arg_STRING},
- {"echo", cmd_echo, arg_STRING},
+ { {"abort", cmd_abort, arg_VOID},
+ {"next", cmd_next, arg_VOID},
+ {"prev", cmd_prev, arg_VOID},
+ {"exec", cmd_exec, arg_STRING},
+ {"select", cmd_select, arg_STRING},
+ {"colon", cmd_colon, arg_STRING},
+ {"kill", cmd_kill, arg_VOID},
+ {"delete", cmd_delete, arg_VOID},
+ {"other", cmd_other, arg_VOID},
+ {"windows", cmd_windows, arg_VOID},
+ {"title", cmd_rename, arg_STRING},
+ {"clock", cmd_clock, arg_VOID},
+ {"maximize", cmd_maximize, arg_VOID},
+ {"newwm", cmd_newwm, arg_STRING},
+ {"generate", cmd_generate, arg_STRING}, /* rename to stuff */
+ {"version", cmd_version, arg_VOID},
+ {"bind", cmd_bind, arg_VOID},
+ {"source", cmd_source, arg_STRING},
+ {"escape", cmd_escape, arg_STRING},
+ {"echo", cmd_echo, arg_STRING},
+ {"split", cmd_h_split, arg_VOID},
+ {"hsplit", cmd_h_split, arg_VOID},
+ {"vsplit", cmd_v_split, arg_VOID},
+ {"focus", cmd_next_frame, arg_VOID},
+ {"only", cmd_only, arg_VOID},
+ {"remove", cmd_remove, arg_VOID},
/* the following screen commands may or may not be able to be
implemented. See the screen documentation for what should be
@@ -172,8 +183,6 @@ user_command user_commands[] =
{"shelltitle", cmd_unimplemented, arg_VOID},
{"sleep", cmd_unimplemented, arg_VOID},
{"sorendition", cmd_unimplemented, arg_VOID},
- {"split", cmd_unimplemented, arg_VOID},
- {"focus", cmd_unimplemented, arg_VOID},
{"startup_message", cmd_unimplemented, arg_VOID},
{0, 0, 0} };
@@ -351,6 +360,24 @@ cmd_prev (void *data)
}
void
+cmd_prev_frame (void *data)
+{
+ rp_window *w;
+
+ if (!rp_current_window)
+ message (MESSAGE_NO_MANAGED_WINDOWS);
+ else
+ {
+ w = find_window_prev_with_frame (rp_current_window);
+
+ if (!w)
+ message (MESSAGE_NO_OTHER_WINDOW);
+ else
+ set_active_window (w);
+ }
+}
+
+void
cmd_next (void *data)
{
rp_window *w;
@@ -368,6 +395,24 @@ cmd_next (void *data)
}
}
+void
+cmd_next_frame (void *data)
+{
+ rp_window *w;
+
+ if (!rp_current_window)
+ message (MESSAGE_NO_MANAGED_WINDOWS);
+ else
+ {
+ w = find_window_next_with_frame (rp_current_window);
+
+ if (!w)
+ message (MESSAGE_NO_OTHER_WINDOW);
+ else
+ set_active_window (w);
+ }
+}
+
void
cmd_other (void *data)
{
@@ -761,3 +806,44 @@ cmd_echo (void *data)
{
if (data) message ((char *)data);
}
+
+void
+cmd_h_split (void *data)
+{
+ h_split_window (rp_current_window);
+}
+
+void
+cmd_v_split (void *data)
+{
+ v_split_window (rp_current_window);
+}
+
+void
+cmd_only (void *data)
+{
+ if (!rp_current_window) return;
+
+ remove_all_frames();
+ maximize (rp_current_window);
+}
+
+void
+cmd_remove (void *data)
+{
+ rp_window *win;
+
+ if (!rp_current_window) return;
+
+ remove_frame (rp_current_window);
+
+ win = find_window_next_with_frame (rp_current_window);
+ if (win)
+ {
+ set_active_window (win);
+ }
+ else
+ {
+ set_active_window (find_window_other());
+ }
+}