Revert "client: handle struts (a lot) better"
This reverts commit 264a81f3fb
.
Conflicts:
client.c
client.h
lib/awful/mouse.lua.in
screen.c
structs.h
wibox.c
This commit is contained in:
parent
df0df1bc37
commit
fba4accc14
195
client.c
195
client.c
|
@ -754,201 +754,6 @@ client_resize(client_t *c, area_t geometry, bool hints)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Update the position of all window with struts on a specific screen.
|
|
||||||
* \param screen The screen that should be processed.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
client_update_strut_positions(screen_t *screen)
|
|
||||||
{
|
|
||||||
area_t allowed_area, geom;
|
|
||||||
|
|
||||||
/* Ignore all struts for starters. */
|
|
||||||
foreach(_c, globalconf.clients)
|
|
||||||
{
|
|
||||||
client_t *c = *_c;
|
|
||||||
if(c->screen == screen && client_hasstrut(c))
|
|
||||||
c->ignore_strut = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Rationale:
|
|
||||||
* Top and bottom panels are common, so they take precendence.
|
|
||||||
* WINDOW_TYPE_DOCK really wants to be at the side, so choose them first.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* WINDOW_TYPE_DOCK: top + bottom. */
|
|
||||||
foreach(_c, globalconf.clients)
|
|
||||||
{
|
|
||||||
client_t *c = *_c;
|
|
||||||
if(c->screen != screen || !client_hasstrut(c) || c->type != WINDOW_TYPE_DOCK)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Screen area, minus padding, wibox'es and already processed struts. */
|
|
||||||
allowed_area = screen_area_get(c->screen,
|
|
||||||
&c->screen->wiboxes,
|
|
||||||
&c->screen->padding,
|
|
||||||
true);
|
|
||||||
|
|
||||||
geom = c->geometry;
|
|
||||||
|
|
||||||
if(c->strut.top || c->strut.top_start_x || c->strut.top_end_x)
|
|
||||||
{
|
|
||||||
geom.y = allowed_area.y;
|
|
||||||
if(geom.x < allowed_area.x
|
|
||||||
|| geom.x + geom.width > allowed_area.x + allowed_area.width)
|
|
||||||
{
|
|
||||||
geom.x = allowed_area.x;
|
|
||||||
if(geom.width > allowed_area.width)
|
|
||||||
geom.width = allowed_area.width;
|
|
||||||
}
|
|
||||||
c->ignore_strut = false;
|
|
||||||
client_resize(c, geom, false);
|
|
||||||
}
|
|
||||||
else if(c->strut.bottom || c->strut.bottom_start_x || c->strut.bottom_end_x)
|
|
||||||
{
|
|
||||||
geom.y = allowed_area.y + allowed_area.height - geom.height;
|
|
||||||
if(geom.x < allowed_area.x
|
|
||||||
|| geom.x + geom.width > allowed_area.x + allowed_area.width)
|
|
||||||
{
|
|
||||||
geom.x = allowed_area.x;
|
|
||||||
if(geom.width > allowed_area.width)
|
|
||||||
geom.width = allowed_area.width;
|
|
||||||
}
|
|
||||||
c->ignore_strut = false;
|
|
||||||
client_resize(c, geom, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* WINDOW_TYPE_DOCK: left + right. */
|
|
||||||
foreach(_c, globalconf.clients)
|
|
||||||
{
|
|
||||||
client_t *c = *_c;
|
|
||||||
if(c->screen != screen || !client_hasstrut(c) || c->type != WINDOW_TYPE_DOCK)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Screen area, minus padding, wibox'es and already processed struts. */
|
|
||||||
allowed_area = screen_area_get(c->screen,
|
|
||||||
&c->screen->wiboxes,
|
|
||||||
&c->screen->padding,
|
|
||||||
true);
|
|
||||||
|
|
||||||
geom = c->geometry;
|
|
||||||
|
|
||||||
if(c->strut.left || c->strut.left_start_y || c->strut.left_end_y)
|
|
||||||
{
|
|
||||||
geom.x = allowed_area.x;
|
|
||||||
if(geom.y < allowed_area.y
|
|
||||||
|| geom.y + geom.height > allowed_area.y + allowed_area.height)
|
|
||||||
{
|
|
||||||
geom.y = allowed_area.y;
|
|
||||||
if (geom.height > allowed_area.height)
|
|
||||||
geom.height = allowed_area.height;
|
|
||||||
}
|
|
||||||
c->ignore_strut = false;
|
|
||||||
client_resize(c, geom, false);
|
|
||||||
}
|
|
||||||
else if(c->strut.right || c->strut.right_start_y || c->strut.right_end_y)
|
|
||||||
{
|
|
||||||
geom.x = allowed_area.x + allowed_area.width - geom.width;
|
|
||||||
if(geom.y < allowed_area.y
|
|
||||||
|| geom.y + geom.height > allowed_area.y + allowed_area.height)
|
|
||||||
{
|
|
||||||
geom.y = allowed_area.y;
|
|
||||||
if (geom.height > allowed_area.height)
|
|
||||||
geom.height = allowed_area.height;
|
|
||||||
}
|
|
||||||
c->ignore_strut = false;
|
|
||||||
client_resize(c, geom, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* not WINDOW_TYPE_DOCK: top + bottom. */
|
|
||||||
foreach(_c, globalconf.clients)
|
|
||||||
{
|
|
||||||
client_t *c = *_c;
|
|
||||||
if(c->screen != screen || !client_hasstrut(c) || c->type == WINDOW_TYPE_DOCK)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Screen area, minus padding, wibox'es and already processed struts. */
|
|
||||||
allowed_area = screen_area_get(c->screen,
|
|
||||||
&c->screen->wiboxes,
|
|
||||||
&c->screen->padding,
|
|
||||||
true);
|
|
||||||
|
|
||||||
geom = c->geometry;
|
|
||||||
|
|
||||||
if(c->strut.top || c->strut.top_start_x || c->strut.top_end_x)
|
|
||||||
{
|
|
||||||
geom.y = allowed_area.y;
|
|
||||||
if(geom.x < allowed_area.x
|
|
||||||
|| geom.x + geom.width > allowed_area.x + allowed_area.width)
|
|
||||||
{
|
|
||||||
geom.x = allowed_area.x;
|
|
||||||
if(geom.width > allowed_area.width)
|
|
||||||
geom.width = allowed_area.width;
|
|
||||||
}
|
|
||||||
c->ignore_strut = false;
|
|
||||||
client_resize(c, geom, false);
|
|
||||||
}
|
|
||||||
else if(c->strut.bottom || c->strut.bottom_start_x || c->strut.bottom_end_x)
|
|
||||||
{
|
|
||||||
geom.y = allowed_area.y + allowed_area.height - geom.height;
|
|
||||||
if(geom.x < allowed_area.x
|
|
||||||
|| geom.x + geom.width > allowed_area.x + allowed_area.width)
|
|
||||||
{
|
|
||||||
geom.x = allowed_area.x;
|
|
||||||
if(geom.width > allowed_area.width)
|
|
||||||
geom.width = allowed_area.width;
|
|
||||||
}
|
|
||||||
c->ignore_strut = false;
|
|
||||||
client_resize(c, geom, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* not WINDOW_TYPE_DOCK: left + right. */
|
|
||||||
foreach(_c, globalconf.clients)
|
|
||||||
{
|
|
||||||
client_t *c = *_c;
|
|
||||||
if(c->screen != screen || !client_hasstrut(c) || c->type == WINDOW_TYPE_DOCK)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Screen area, minus padding, wibox'es and already processed struts. */
|
|
||||||
allowed_area = screen_area_get(c->screen,
|
|
||||||
&c->screen->wiboxes,
|
|
||||||
&c->screen->padding,
|
|
||||||
true);
|
|
||||||
|
|
||||||
geom = c->geometry;
|
|
||||||
|
|
||||||
if(c->strut.left || c->strut.left_start_y || c->strut.left_end_y)
|
|
||||||
{
|
|
||||||
geom.x = allowed_area.x;
|
|
||||||
if(geom.y < allowed_area.y
|
|
||||||
|| geom.y + geom.height > allowed_area.y + allowed_area.height)
|
|
||||||
{
|
|
||||||
geom.y = allowed_area.y;
|
|
||||||
if (geom.height > allowed_area.height)
|
|
||||||
geom.height = allowed_area.height;
|
|
||||||
}
|
|
||||||
c->ignore_strut = false;
|
|
||||||
client_resize(c, geom, false);
|
|
||||||
}
|
|
||||||
else if(c->strut.right || c->strut.right_start_y || c->strut.right_end_y)
|
|
||||||
{
|
|
||||||
geom.x = allowed_area.x + allowed_area.width - geom.width;
|
|
||||||
if(geom.y < allowed_area.y
|
|
||||||
|| geom.y + geom.height > allowed_area.y + allowed_area.height)
|
|
||||||
{
|
|
||||||
geom.y = allowed_area.y;
|
|
||||||
if (geom.height > allowed_area.height)
|
|
||||||
geom.height = allowed_area.height;
|
|
||||||
}
|
|
||||||
c->ignore_strut = false;
|
|
||||||
client_resize(c, geom, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Set a client minimized, or not.
|
/** Set a client minimized, or not.
|
||||||
* \param c The client.
|
* \param c The client.
|
||||||
* \param s Set or not the client minimized.
|
* \param s Set or not the client minimized.
|
||||||
|
|
3
client.h
3
client.h
|
@ -90,8 +90,6 @@ struct client_t
|
||||||
} geometries;
|
} geometries;
|
||||||
/** Strut */
|
/** Strut */
|
||||||
strut_t strut;
|
strut_t strut;
|
||||||
/** Ignore strut temporarily. */
|
|
||||||
bool ignore_strut;
|
|
||||||
/** Border width and pre-fullscreen border width */
|
/** Border width and pre-fullscreen border width */
|
||||||
int border, border_fs;
|
int border, border_fs;
|
||||||
xcolor_t border_color;
|
xcolor_t border_color;
|
||||||
|
@ -171,7 +169,6 @@ void client_unban(client_t *);
|
||||||
void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, int, bool);
|
void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, int, bool);
|
||||||
area_t client_geometry_hints(client_t *, area_t);
|
area_t client_geometry_hints(client_t *, area_t);
|
||||||
bool client_resize(client_t *, area_t, bool);
|
bool client_resize(client_t *, area_t, bool);
|
||||||
void client_update_strut_positions(screen_t *);
|
|
||||||
void client_unmanage(client_t *);
|
void client_unmanage(client_t *);
|
||||||
void client_kill(client_t *);
|
void client_kill(client_t *);
|
||||||
void client_setsticky(client_t *, bool);
|
void client_setsticky(client_t *, bool);
|
||||||
|
|
2
layout.c
2
layout.c
|
@ -66,8 +66,6 @@ arrange(screen_t *screen)
|
||||||
client_ban(c);
|
client_ban(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
client_update_strut_positions(screen);
|
|
||||||
|
|
||||||
/* Reset status before calling arrange hook.
|
/* Reset status before calling arrange hook.
|
||||||
* This is needed if you call a function that relies
|
* This is needed if you call a function that relies
|
||||||
* on need_arrange while arrange is in progress.
|
* on need_arrange while arrange is in progress.
|
||||||
|
|
|
@ -114,7 +114,7 @@ function client.snap(c, snap, x, y, fixed_x, fixed_y)
|
||||||
geom.y = y or geom.y
|
geom.y = y or geom.y
|
||||||
|
|
||||||
geom, edge = snap_inside(geom, capi.screen[c.screen].geometry, snap)
|
geom, edge = snap_inside(geom, capi.screen[c.screen].geometry, snap)
|
||||||
geom, edge2 = snap_inside(geom, capi.screen[c.screen].workarea, snap)
|
geom = snap_inside(geom, capi.screen[c.screen].workarea, snap)
|
||||||
|
|
||||||
-- Allow certain windows to snap to the edge of the workarea.
|
-- Allow certain windows to snap to the edge of the workarea.
|
||||||
-- Only allow docking to workarea for consistency/to avoid problems.
|
-- Only allow docking to workarea for consistency/to avoid problems.
|
||||||
|
@ -124,11 +124,11 @@ function client.snap(c, snap, x, y, fixed_x, fixed_y)
|
||||||
struts['right'] = 0
|
struts['right'] = 0
|
||||||
struts['top'] = 0
|
struts['top'] = 0
|
||||||
struts['bottom'] = 0
|
struts['bottom'] = 0
|
||||||
if edge2 ~= "none" and aclient.floating.get(c) then
|
if edge ~= "none" and aclient.floating.get(c) then
|
||||||
if edge2 == "left" or edge2 == "right" then
|
if edge == "left" or edge == "right" then
|
||||||
struts[edge2] = cur_geom.width
|
struts[edge] = cur_geom.width
|
||||||
elseif edge2 == "top" or edge2 == "bottom" then
|
elseif edge == "top" or edge == "bottom" then
|
||||||
struts[edge2] = cur_geom.height
|
struts[edge] = cur_geom.height
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
c:struts(struts)
|
c:struts(struts)
|
||||||
|
|
2
screen.c
2
screen.c
|
@ -170,7 +170,7 @@ screen_area_get(screen_t *screen, wibox_array_t *wiboxes,
|
||||||
foreach(_c, globalconf.clients)
|
foreach(_c, globalconf.clients)
|
||||||
{
|
{
|
||||||
client_t *c = *_c;
|
client_t *c = *_c;
|
||||||
if(client_isvisible(c, screen) && !c->ignore_strut)
|
if(client_isvisible(c, screen))
|
||||||
{
|
{
|
||||||
if(c->strut.top_start_x || c->strut.top_end_x)
|
if(c->strut.top_start_x || c->strut.top_end_x)
|
||||||
{
|
{
|
||||||
|
|
3
wibox.c
3
wibox.c
|
@ -352,9 +352,8 @@ wibox_position_update_non_floating(wibox_t *wibox)
|
||||||
*/
|
*/
|
||||||
wibox->screen->need_arrange = true;
|
wibox->screen->need_arrange = true;
|
||||||
|
|
||||||
/* Place wibox'es at the edge of the screen, struts come later. */
|
|
||||||
area = screen_area_get(wibox->screen, NULL,
|
area = screen_area_get(wibox->screen, NULL,
|
||||||
&wibox->screen->padding, false);
|
&wibox->screen->padding, true);
|
||||||
|
|
||||||
/* Top and Bottom wibox_t have prio */
|
/* Top and Bottom wibox_t have prio */
|
||||||
foreach(_w, wibox->screen->wiboxes)
|
foreach(_w, wibox->screen->wiboxes)
|
||||||
|
|
Loading…
Reference in New Issue