client: Add request::geometry for client maximization
This way the correct logic can be implented in Lua
This commit is contained in:
parent
951386ec5c
commit
b570e6d347
34
ewmh.c
34
ewmh.c
|
@ -207,6 +207,28 @@ ewmh_init(void)
|
|||
father, _NET_WM_PID, XCB_ATOM_CARDINAL, 32, 1, &i);
|
||||
}
|
||||
|
||||
static void
|
||||
ewmh_update_maximize(bool h, bool status, bool toggle)
|
||||
{
|
||||
lua_State *L = globalconf_get_lua_State();
|
||||
|
||||
if (h)
|
||||
lua_pushstring(L, "client_maximize_horizontal");
|
||||
else
|
||||
lua_pushstring(L, "client_maximize_vertical");
|
||||
|
||||
/* Create table argument with raise=true. */
|
||||
lua_newtable(L);
|
||||
lua_pushstring(L, "toggle");
|
||||
lua_pushboolean(L, toggle);
|
||||
lua_settable(L, -3);
|
||||
lua_pushstring(L, "status");
|
||||
lua_pushboolean(L, status);
|
||||
lua_settable(L, -3);
|
||||
|
||||
luaA_object_emit_signal(L, -3, "request::geometry", 2);
|
||||
}
|
||||
|
||||
void
|
||||
ewmh_init_lua(void)
|
||||
{
|
||||
|
@ -333,20 +355,20 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set)
|
|||
else if(state == _NET_WM_STATE_MAXIMIZED_HORZ)
|
||||
{
|
||||
if(set == _NET_WM_STATE_REMOVE)
|
||||
client_set_maximized_horizontal(L, -1, false);
|
||||
ewmh_update_maximize(true, false, false);
|
||||
else if(set == _NET_WM_STATE_ADD)
|
||||
client_set_maximized_horizontal(L, -1, true);
|
||||
ewmh_update_maximize(true, true, false);
|
||||
else if(set == _NET_WM_STATE_TOGGLE)
|
||||
client_set_maximized_horizontal(L, -1, !c->maximized_horizontal);
|
||||
ewmh_update_maximize(true, false, true);
|
||||
}
|
||||
else if(state == _NET_WM_STATE_MAXIMIZED_VERT)
|
||||
{
|
||||
if(set == _NET_WM_STATE_REMOVE)
|
||||
client_set_maximized_vertical(L, -1, false);
|
||||
ewmh_update_maximize(false, false, false);
|
||||
else if(set == _NET_WM_STATE_ADD)
|
||||
client_set_maximized_vertical(L, -1, true);
|
||||
ewmh_update_maximize(false, true, false);
|
||||
else if(set == _NET_WM_STATE_TOGGLE)
|
||||
client_set_maximized_vertical(L, -1, !c->maximized_vertical);
|
||||
ewmh_update_maximize(false, false, true);
|
||||
}
|
||||
else if(state == _NET_WM_STATE_ABOVE)
|
||||
{
|
||||
|
|
|
@ -247,6 +247,10 @@ local context_mapper = {
|
|||
function ewmh.geometry(c, context, hints)
|
||||
local layout = c.screen.selected_tag and c.screen.selected_tag.layout or nil
|
||||
|
||||
--TODO handle `client_maximize_horizontal` and `client_maximize_vertical`
|
||||
-- so the clients can request being maximized. Currently they can set the
|
||||
-- atom, but it is ignored.
|
||||
|
||||
-- Setting the geometry will not work unless the client is floating.
|
||||
if (not c.floating) and (not layout == asuit.floating) then
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue