summaryrefslogtreecommitdiff
path: root/src/actions.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2002-03-13 08:23:30 +0000
committersabetts <sabetts>2002-03-13 08:23:30 +0000
commitcdb7cc536917ee9d34d4d9f5ed05a3b751044027 (patch)
tree32813e57d6bebea81d6bbb4054e5b90792faf7e6 /src/actions.c
parentb324f95535f20617b29f9d6202cd868383dfc0ce (diff)
downloadratpoison-cdb7cc536917ee9d34d4d9f5ed05a3b751044027.zip
* src/split.c (set_active_frame): fix to operate properly with
multiple screens. * src/data.h (struct rp_window_frame): new data member 'number'. * src/actions.h (cmd_prevscreen): new prototype (cmd_nextscreen): likewise * src/actions.c (user_commands): new commands "nextscreen" and "prevscreen" (cmd_nextscreen): new function (cmd_prevscreen): likewise
Diffstat (limited to 'src/actions.c')
-rw-r--r--src/actions.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/actions.c b/src/actions.c
index 511bfef..a5b2f65 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -82,6 +82,8 @@ static user_command user_commands[] =
{"startup_message", cmd_startup_message, arg_STRING},
{"link", cmd_link, arg_STRING},
{"alias", cmd_alias, arg_STRING},
+ {"prevscreen", cmd_prevscreen, arg_VOID},
+ {"nextscreen", cmd_nextscreen, arg_VOID},
/*@end (tag required for genrpbindings) */
/* Commands to set default behavior. */
@@ -2430,3 +2432,37 @@ cmd_alias (int interactive, void *data)
return NULL;
}
+
+char *
+cmd_nextscreen (int interactive, void *data)
+{
+ int new_screen;
+
+ /* No need to go through the motions when we don't have to. */
+ if (num_screens <= 1) return NULL;
+
+ new_screen = rp_current_screen + 1;
+ if (new_screen >= num_screens)
+ new_screen = 0;
+
+ set_active_frame (screens[new_screen].rp_current_frame);
+
+ return NULL;
+}
+
+char *
+cmd_prevscreen (int interactive, void *data)
+{
+ int new_screen;
+
+ /* No need to go through the motions when we don't have to. */
+ if (num_screens <= 1) return NULL;
+
+ new_screen = rp_current_screen - 1;
+ if (new_screen < 0)
+ new_screen = num_screens - 1;
+
+ set_active_frame (screens[new_screen].rp_current_frame);
+
+ return NULL;
+}