From e2452fa62a3ad8934146d5a6d8f20544113ae034 Mon Sep 17 00:00:00 2001 From: Nikos Ntarmos Date: Fri, 9 Nov 2007 19:25:31 +0100 Subject: [PATCH] Sanitize screen changes Whith Xinerama active a client that moves outside the upper-left screen boundary is erroneously changing screens. The attached patch changes this behavior so that a client may change screen only when its new coordinates are positive. The assumption is that the client can't fall off the lower-right boundary since the mouse pointer can't go there when moving. However, the upper-left corner of a window (which is the point we use to compute the client's scren) can move more to the left or up than the upper-left corner of the screen (coords 0,0) thus becoming negative. --- client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client.c b/client.c index 9b1a3aa0b..c99e7a2a7 100644 --- a/client.c +++ b/client.c @@ -452,10 +452,10 @@ client_resize(Client *c, int x, int y, int w, int h, awesome_config *awesomeconf XConfigureWindow(c->display, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc); window_configure(c->display, c->win, c->x, c->y, c->w, c->h, c->border); XSync(c->display, False); - if(XineramaIsActive(c->display)) + if(c->x >=0 && c->y >= 0 && XineramaIsActive(c->display)) { int new_screen = get_screen_bycoord(c->display, c->x, c->y); - if(c->screen != new_screen) + if(new_screen >= 0 && c->screen != new_screen) move_client_to_screen(c, &awesomeconf[new_screen - awesomeconf->screen], False); } }