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.
This commit is contained in:
Nikos Ntarmos 2007-11-09 19:25:31 +01:00 committed by Julien Danjou
parent 360f96b5fd
commit e2452fa62a
1 changed files with 2 additions and 2 deletions

View File

@ -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); 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); window_configure(c->display, c->win, c->x, c->y, c->w, c->h, c->border);
XSync(c->display, False); 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); 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); move_client_to_screen(c, &awesomeconf[new_screen - awesomeconf->screen], False);
} }
} }