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:
parent
1004cefa2f
commit
0f840d2eec
4
client.c
4
client.c
|
@ -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);
|
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(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);
|
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);
|
move_client_to_screen(c, &awesomeconf[new_screen - awesomeconf->screen], False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
screen.c
4
screen.c
|
@ -104,8 +104,8 @@ get_screen_bycoord(Display *disp, int x, int y)
|
||||||
si = get_screen_info(disp, 0, NULL);
|
si = get_screen_info(disp, 0, NULL);
|
||||||
|
|
||||||
for(i = 0; i < get_screen_count(disp); i++)
|
for(i = 0; i < get_screen_count(disp); i++)
|
||||||
if(x >= si[i].x_org && x < si[i].x_org + si[i].width
|
if((x < 0 || (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)
|
&& (y< 0 || (y >= si[i].y_org && y < si[i].y_org + si[i].height)))
|
||||||
{
|
{
|
||||||
p_delete(&si);
|
p_delete(&si);
|
||||||
return i;
|
return i;
|
||||||
|
|
Loading…
Reference in New Issue