mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
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
6 changed files with 8 additions and 209 deletions
195
client.c
195
client.c
|
@ -754,201 +754,6 @@ client_resize(client_t *c, area_t geometry, bool hints)
|
|||
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.
|
||||
* \param c The client.
|
||||
* \param s Set or not the client minimized.
|
||||
|
|
3
client.h
3
client.h
|
@ -90,8 +90,6 @@ struct client_t
|
|||
} geometries;
|
||||
/** Strut */
|
||||
strut_t strut;
|
||||
/** Ignore strut temporarily. */
|
||||
bool ignore_strut;
|
||||
/** Border width and pre-fullscreen border width */
|
||||
int border, border_fs;
|
||||
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);
|
||||
area_t client_geometry_hints(client_t *, area_t);
|
||||
bool client_resize(client_t *, area_t, bool);
|
||||
void client_update_strut_positions(screen_t *);
|
||||
void client_unmanage(client_t *);
|
||||
void client_kill(client_t *);
|
||||
void client_setsticky(client_t *, bool);
|
||||
|
|
2
layout.c
2
layout.c
|
@ -66,8 +66,6 @@ arrange(screen_t *screen)
|
|||
client_ban(c);
|
||||
}
|
||||
|
||||
client_update_strut_positions(screen);
|
||||
|
||||
/* Reset status before calling arrange hook.
|
||||
* This is needed if you call a function that relies
|
||||
* 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, 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.
|
||||
-- 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['top'] = 0
|
||||
struts['bottom'] = 0
|
||||
if edge2 ~= "none" and aclient.floating.get(c) then
|
||||
if edge2 == "left" or edge2 == "right" then
|
||||
struts[edge2] = cur_geom.width
|
||||
elseif edge2 == "top" or edge2 == "bottom" then
|
||||
struts[edge2] = cur_geom.height
|
||||
if edge ~= "none" and aclient.floating.get(c) then
|
||||
if edge == "left" or edge == "right" then
|
||||
struts[edge] = cur_geom.width
|
||||
elseif edge == "top" or edge == "bottom" then
|
||||
struts[edge] = cur_geom.height
|
||||
end
|
||||
end
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
|
3
wibox.c
3
wibox.c
|
@ -352,9 +352,8 @@ wibox_position_update_non_floating(wibox_t *wibox)
|
|||
*/
|
||||
wibox->screen->need_arrange = true;
|
||||
|
||||
/* Place wibox'es at the edge of the screen, struts come later. */
|
||||
area = screen_area_get(wibox->screen, NULL,
|
||||
&wibox->screen->padding, false);
|
||||
&wibox->screen->padding, true);
|
||||
|
||||
/* Top and Bottom wibox_t have prio */
|
||||
foreach(_w, wibox->screen->wiboxes)
|
||||
|
|
Loading…
Reference in a new issue