Sanitize screen changes - take 2

I was looking back at this issue and realized that it is possible for
one of the x,y coordinates to be negative and yet a screen change must
be performed. This may happen when a window is moving with its
upper-left corner outside the upper part of the screen, and it crosses
the x-axis boundary between two consecutive screens.
This commit is contained in:
Nikos Ntarmos 2007-11-10 17:59:33 +01:00 committed by Julien Danjou
parent 1004cefa2f
commit 0f840d2eec
2 changed files with 4 additions and 4 deletions

View File

@ -442,10 +442,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(c->x >=0 && c->y >= 0 && 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(new_screen >= 0 && c->screen != new_screen)
if(c->screen != new_screen)
move_client_to_screen(c, &awesomeconf[new_screen - awesomeconf->screen], False);
}
}

View File

@ -104,8 +104,8 @@ get_screen_bycoord(Display *disp, int x, int y)
si = get_screen_info(disp, 0, NULL);
for(i = 0; i < get_screen_count(disp); i++)
if(x >= si[i].x_org && x < si[i].x_org + si[i].width
&& y >= si[i].y_org && y < si[i].y_org + si[i].height)
if((x < 0 || (x >= si[i].x_org && x < si[i].x_org + si[i].width))
&& (y< 0 || (y >= si[i].y_org && y < si[i].y_org + si[i].height)))
{
p_delete(&si);
return i;