summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2004-02-27 08:28:16 +0000
committersabetts <sabetts>2004-02-27 08:28:16 +0000
commitfab11adc940f3258dc53c823903f242d9c65da91 (patch)
treeb1057b031c67173189c0c60dbf93fe2b2f8c1210 /src/window.c
parenta5c30aed8f3d73ac39e997a11068d12b82eab42e (diff)
downloadratpoison-fab11adc940f3258dc53c823903f242d9c65da91.zip
* src/window.c (give_window_focus): save the mouse position before
checking if win is NULL. (give_window_focus): set rp_current_screen to xine_screen_num of the window's screen. (set_active_window): when using xinerama get the frame from the current screen. * src/split.c (set_frames_window): update the window's scr attribute to point to the frame's screen. (find_window_for_frame): when xinerama is being used search all windows. (set_active_frame): update rp_current_screen to point to the frame's screen. * src/screen.h (init_screens): new prototype (is_rp_window_for_screen): likewise * src/screen.c: include string.h and X11/cursorfont.h (init_screens): new function (is_rp_window_for_screen): new function. (init_screen): fill in xine_screen_num when using xinerama. * src/ratpoison.h: include xinerama.h * src/manage.c (current_screen): use xine_screen_num to find the current screen. (scanwins): use is_rp_window_for_screen to skip over ratpoison windows. (scanwins): when using xinerama only manage windows inside the viewable area. * src/main.c (main): call init_xinerama and init_screens. Move screen initing code to these functions. (init_rat_cursor): move to screen.c (init_screen): likewise (find_screen): likewise (clean_up): call free_xinerama * src/group.c (group_last_window): only check windows in the current screen, unless xinerama is being used in which case all windows are accessible. (group_next_window): likewise (group_prev_window): likewise * src/globals.h: new globals rp_have_xinerama, xine_screen_num. * src/events.c (new_window): when using xinerama, the new window's screen is the current screen. (key_press): when using xinerama, use the current screen. * src/data.h (struct rp_screen): remove root_attr and add left, top, width, height. All dependant code updated. Add xine_screen_num. * src/actions.c (cmd_remove): show the frame indicator in the new current frame after removing the frame. * src/Makefile.am (ratpoison_SOURCES): add xinerama.c and xinerama.h
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/window.c b/src/window.c
index 1ac063c..c39142a 100644
--- a/src/window.c
+++ b/src/window.c
@@ -320,6 +320,11 @@ give_window_focus (rp_window *win, rp_window *last_win)
we can track which window was last accessed. */
static int counter = 1;
+ /* Warp the cursor to the window's saved position if last_win and
+ win are different windows. */
+ if (last_win != NULL && win != last_win)
+ save_mouse_position (last_win);
+
if (win == NULL) return;
counter++;
@@ -327,11 +332,6 @@ give_window_focus (rp_window *win, rp_window *last_win)
unhide_window (win);
- /* Warp the cursor to the window's saved position if last_win and
- win are different windows. */
- if (last_win != NULL && win != last_win)
- save_mouse_position (last_win);
-
if (defaults.warp)
{
PRINT_DEBUG (("Warp pointer\n"));
@@ -344,7 +344,7 @@ give_window_focus (rp_window *win, rp_window *last_win)
XInstallColormap (dpy, win->colormap);
/* Finally, give the window focus */
- rp_current_screen = win->scr->screen_num;
+ rp_current_screen = win->scr->xine_screen_num;
set_rp_window_focus (win);
XSync (dpy, False);
@@ -464,7 +464,17 @@ set_active_window (rp_window *win)
if (win == NULL) return;
- frame = screen_get_frame (win->scr, win->scr->current_frame);
+ /* With Xinerama, we can move a window over to the current screen; otherwise
+ * we have to switch to the screen that the window belongs to.
+ */
+ if (rp_have_xinerama)
+ {
+ frame = screen_get_frame (current_screen(), current_screen()->current_frame);
+ }
+ else
+ {
+ frame = screen_get_frame (win->scr, win->scr->current_frame);
+ }
last_win = set_frames_window (frame, win);
if (last_win) PRINT_DEBUG (("last window: %s\n", window_name (last_win)));
@@ -481,8 +491,8 @@ set_active_window (rp_window *win)
#ifdef MAXSIZE_WINDOWS_ARE_TRANSIENTS
if (!win->transient
&& !(win->hints->flags & PMaxSize
- && (win->hints->max_width < win->scr->root_attr.width
- || win->hints->max_height < win->scr->root_attr.height)))
+ && (win->hints->max_width < win->scr->width
+ || win->hints->max_height < win->scr->height)))
#else
if (!win->transient)
#endif