improve spot detection when toggling max/mav/maxh off
This commit is contained in:
30
client.c
30
client.c
@@ -86,9 +86,18 @@ client* window_build_client(Window win)
|
|||||||
if (INTERSECT(m->x, m->y, m->w, m->h, c->attr.x + c->attr.width/2, c->attr.y+c->attr.height/2, 1, 1))
|
if (INTERSECT(m->x, m->y, m->w, m->h, c->attr.x + c->attr.width/2, c->attr.y+c->attr.height/2, 1, 1))
|
||||||
{ c->monitor = i; break; }
|
{ c->monitor = i; break; }
|
||||||
|
|
||||||
for_spots_rev(i)
|
int intersect_1 = INTERSECT(c->attr.x, c->attr.y, c->attr.width, c->attr.height,
|
||||||
if (INTERSECT(m->spots[i].x, m->spots[i].y, m->spots[i].w, m->spots[i].h, c->attr.x + c->attr.width/2, c->attr.y+c->attr.height/2, 1, 1))
|
m->spots[SPOT1].x + m->spots[SPOT1].w/2, m->spots[SPOT1].y + m->spots[SPOT1].h/2, 1, 1);
|
||||||
{ c->spot = i; break; }
|
|
||||||
|
int intersect_2 = INTERSECT(c->attr.x, c->attr.y, c->attr.width, c->attr.height,
|
||||||
|
m->spots[SPOT2].x + m->spots[SPOT2].w/2, m->spots[SPOT2].y + m->spots[SPOT2].h/2, 1, 1);
|
||||||
|
|
||||||
|
int intersect_3 = INTERSECT(c->attr.x, c->attr.y, c->attr.width, c->attr.height,
|
||||||
|
m->spots[SPOT3].x + m->spots[SPOT3].w/2, m->spots[SPOT3].y + m->spots[SPOT3].h/2, 1, 1);
|
||||||
|
|
||||||
|
if (intersect_3) c->spot = SPOT3;
|
||||||
|
else if (intersect_2) c->spot = SPOT2;
|
||||||
|
else if (intersect_1) c->spot = SPOT1;
|
||||||
|
|
||||||
if (c->visible)
|
if (c->visible)
|
||||||
{
|
{
|
||||||
@@ -102,20 +111,23 @@ client* window_build_client(Window win)
|
|||||||
|
|
||||||
GETPROP_LONG(win, atoms[XOAT_MAXIMIZE], &c->max, 1);
|
GETPROP_LONG(win, atoms[XOAT_MAXIMIZE], &c->max, 1);
|
||||||
|
|
||||||
|
// proper spot detection based on toggled atoms.
|
||||||
|
// XOAT_MAXIMIZE may apply to spot1 windows. Detect...
|
||||||
|
if (c->max && intersect_1)
|
||||||
|
{
|
||||||
|
c->spot = SPOT1;
|
||||||
|
}
|
||||||
|
else
|
||||||
// _NET_WM_STATE_MAXIMIZE_VERT may apply to spot2 windows. Detect...
|
// _NET_WM_STATE_MAXIMIZE_VERT may apply to spot2 windows. Detect...
|
||||||
if (c->maxv && c->type != atoms[_NET_WM_WINDOW_TYPE_DIALOG]
|
if (c->maxv && c->type != atoms[_NET_WM_WINDOW_TYPE_DIALOG]
|
||||||
&& INTERSECT(c->attr.x, c->attr.y, c->attr.width, c->attr.height,
|
&& !intersect_1 && intersect_2)
|
||||||
m->spots[SPOT2].x + m->spots[SPOT2].w/2, m->spots[SPOT2].y + m->spots[SPOT2].h/2, 1, 1))
|
|
||||||
{
|
{
|
||||||
c->spot = SPOT2;
|
c->spot = SPOT2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// _NET_WM_STATE_MAXIMIZE_HORZ may apply to spot3 windows with c->max. Detect...
|
// _NET_WM_STATE_MAXIMIZE_HORZ may apply to spot3 windows with c->max. Detect...
|
||||||
if (c->maxh && c->type != atoms[_NET_WM_WINDOW_TYPE_DIALOG]
|
if (c->maxh && c->type != atoms[_NET_WM_WINDOW_TYPE_DIALOG]
|
||||||
&& INTERSECT(c->attr.x, c->attr.y, c->attr.width, c->attr.height,
|
&& !intersect_1 && !intersect_2 && intersect_3)
|
||||||
m->spots[SPOT3].x + m->spots[SPOT3].w/2, m->spots[SPOT3].y + m->spots[SPOT3].h/2, 1, 1)
|
|
||||||
&& !INTERSECT(c->attr.x, c->attr.y, c->attr.width, c->attr.height,
|
|
||||||
m->spots[SPOT2].x + m->spots[SPOT2].w/2, m->spots[SPOT2].y + m->spots[SPOT2].h/2, 1, 1))
|
|
||||||
{
|
{
|
||||||
c->spot = SPOT3;
|
c->spot = SPOT3;
|
||||||
}
|
}
|
||||||
|
|||||||
5
event.c
5
event.c
@@ -113,7 +113,10 @@ void unmap_notify(XEvent *e)
|
|||||||
{
|
{
|
||||||
// if this window was focused, find something else
|
// if this window was focused, find something else
|
||||||
if (e->xunmap.window == current && !spot_focus_top_window(current_spot, current_mon, current))
|
if (e->xunmap.window == current && !spot_focus_top_window(current_spot, current_mon, current))
|
||||||
{ int i; for_spots(i) if (spot_focus_top_window(i, current_mon, current)) break; }
|
{
|
||||||
|
int i; for_spots(i)
|
||||||
|
if (spot_focus_top_window(i, current_mon, current)) break;
|
||||||
|
}
|
||||||
ewmh_client_list();
|
ewmh_client_list();
|
||||||
update_bars();
|
update_bars();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user