From cdb7cc536917ee9d34d4d9f5ed05a3b751044027 Mon Sep 17 00:00:00 2001 From: sabetts Date: Wed, 13 Mar 2002 08:23:30 +0000 Subject: * 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 --- ChangeLog | 15 +++++++++++++++ NEWS | 3 +++ doc/ratpoison.texi | 35 +++++++++++++++++++++++++++++++++-- src/actions.c | 36 ++++++++++++++++++++++++++++++++++++ src/actions.h | 2 ++ src/data.h | 1 + src/split.c | 15 ++++++++++++--- 7 files changed, 102 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 076d713..270de17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2002-03-13 Shawn Betts + + * 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 + 2002-02-19 Shawn Betts * src/split.c: include string.h diff --git a/NEWS b/NEWS index 0ae37ab..84fc2d2 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ ratpoison NEWS --- history of user-visible changes. -*- outline -*- +* Changes since 1.1.0 +** new commands "nextscreen" and "prevscreen" + * Changes since 1.0.0 ** defbarloc changed to defbargravity diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi index 1914d97..982f924 100644 --- a/doc/ratpoison.texi +++ b/doc/ratpoison.texi @@ -84,6 +84,7 @@ This document explains how to use ratpoison. * Concepts:: Window manipulation concepts * General Use:: How does this thing work?? * Splitting Frames:: When you want to see more than one window +* Multiple Monitors:: What to do with all your computer junk * Keystrokes:: Key commands and functionality * Commands:: ratpoison commands * Input:: Typing text into ratpoison @@ -91,6 +92,7 @@ This document explains how to use ratpoison. * Startup file:: They threatened me...with violence! + @end menu @node About, Contacting, Top, Top @@ -178,7 +180,7 @@ how we didn't have to drag a single window, or click a single maximize button? Beautiful wasn't it? Felt fast? Cool? Its modern computing at its best boys and girls. -@node Splitting Frames, Keystrokes, General Use, Top +@node Splitting Frames, Multiple Monitors, General Use, Top @chapter Splitting Frames Sometimes you may want to see two or more windows at the same time. ratpoison allows you to split the display into frames (see @@ -200,7 +202,28 @@ Finally, when you've had enough of the splitting and you just want good ol' full screen ratpoison press @kbd{C-t Q} to remove all splits and leave you with the current window full screen. -@node Keystrokes, Commands, Splitting Frames, Top +@node Multiple Monitors, Keystrokes, Splitting Frames, Top +@chapter Multiple Monitors +When you've finally accumulated enough computer junk, you'll find +youself attaching a second monitor to your computer. ratpoison has +functionality to help you get around your new and improved desktop +space. + +The X Windowing System assigns each monitor a screen number. To switch +to another screen use the commands @command{nextscreen} and +@command{prevscreen}. ratpoison will tell you which frame has focus by +drawing the current frame indicator in it. + +Many commands operate only on the current screen. This becomes +apparent when you have 2 screens each with 1 frame. In each frame you +have an xterm. If you try to switch to the other xterm with the +command @command{other}, for instance, you'll get a message ``No other +window.'' ratpoison means there's no other window to switch to in the +current screen. If you want to switch to the other xterm you can +switch to it by name (use @command{select} or @kbd{C-t '}), by number, +or you can use @command{nextscreen} and @command{prevscreen}. + +@node Keystrokes, Commands, Multiple Monitors, Top @chapter Keystrokes ratpoison is a very simple window manager. Each window is maximized and @@ -566,6 +589,10 @@ This jumps you to the next window in the window list. This one is bound to three keystrokes, namely @kbd{C-t n}, @kbd{C-t space}, and @kbd{C-t enter}. +@item nextscreen +This jumps you to the next X11 screen. @command{nextscreen} is +used for dual-head displays and multiple monitor setups. + @item newwm @var{window-manager} This is a bad-bad command. It kills ratpoison and revives that ugly rodent! Yuck! Avoid! @@ -589,6 +616,10 @@ default, this is bound to @kbd{C-t C-t}. This jumps you to the previous window in the window list. By default, this is bound to @kbd{C-t p}. +@item prevscreen +This jumps you to the previous X11 screen. @command{prevscreen} is +used for dual-head displays and multiple monitor setups. + @item quit Quit ratpoison. 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; +} diff --git a/src/actions.h b/src/actions.h index a727254..cbedd60 100644 --- a/src/actions.h +++ b/src/actions.h @@ -108,6 +108,8 @@ char * cmd_defbarpadding (int interactive, void *data); char * cmd_license (int interactive, void *data); char * cmd_alias (int interactive, void *data); char *cmd_defbarborder (int interactive, void *data); +char *cmd_prevscreen (int interactive, void *data); +char *cmd_nextscreen (int interactive, void *data); void initialize_default_keybindings (void); rp_action* find_keybinding (KeySym keysym, int state); diff --git a/src/data.h b/src/data.h index c3dc796..bba9f29 100644 --- a/src/data.h +++ b/src/data.h @@ -37,6 +37,7 @@ typedef struct rp_window_frame rp_window_frame; struct rp_window_frame { + int number; int x, y, width, height; rp_window *win; diff --git a/src/split.c b/src/split.c index 47efed3..f9805ce 100644 --- a/src/split.c +++ b/src/split.c @@ -611,17 +611,26 @@ remove_frame (rp_window_frame *frame) free (frame); } +/* Switch the input focus to another frame, and therefore a different + window. */ void set_active_frame (rp_window_frame *frame) { + screen_info *old_s = current_screen(); screen_info *s = frames_screen (frame); - rp_window_frame *old = s->rp_current_frame; + rp_window_frame *old = current_screen()->rp_current_frame; - give_window_focus (frame->win, s->rp_current_frame->win); + /* Make the switch */ + give_window_focus (frame->win, old->win); update_last_access (frame); s->rp_current_frame = frame; - if (old != s->rp_current_frame && num_frames(s) > 1) + /* If frame->win == NULL, then rp_current_screen is not updated. */ + rp_current_screen = s->screen_num; + + /* Possibly show the frame indicator. */ + if ((old != s->rp_current_frame && num_frames(s) > 1) + || s != old_s) { show_frame_indicator(); } -- cgit v1.2.3