client: Handle maximize differently at startup
This way max_h+max_h wont happen by accident. This isn't pretty but it will get the job done. Fix #1599 #1559 Close #1715 #1712
This commit is contained in:
parent
be29ee6768
commit
951386ec5c
29
ewmh.c
29
ewmh.c
|
@ -554,6 +554,8 @@ ewmh_client_check_hints(client_t *c)
|
|||
void *data = NULL;
|
||||
xcb_get_property_cookie_t c0, c1, c2;
|
||||
xcb_get_property_reply_t *reply;
|
||||
bool is_h_max = false;
|
||||
bool is_v_max = false;
|
||||
|
||||
/* Send the GetProperty requests which will be processed later */
|
||||
c0 = xcb_get_property_unchecked(globalconf.connection, false, c->window,
|
||||
|
@ -578,9 +580,36 @@ ewmh_client_check_hints(client_t *c)
|
|||
{
|
||||
state = (xcb_atom_t *) data;
|
||||
for(int i = 0; i < xcb_get_property_value_length(reply) / ssizeof(xcb_atom_t); i++)
|
||||
if (state[i] == _NET_WM_STATE_MAXIMIZED_HORZ)
|
||||
is_h_max = true;
|
||||
else if (state[i] == _NET_WM_STATE_MAXIMIZED_VERT)
|
||||
is_v_max = true;
|
||||
else
|
||||
ewmh_process_state_atom(c, state[i], _NET_WM_STATE_ADD);
|
||||
}
|
||||
|
||||
/* Check maximization manually */
|
||||
if (is_h_max && is_v_max) {
|
||||
lua_State *L = globalconf_get_lua_State();
|
||||
luaA_object_push(L, c);
|
||||
client_set_maximized(L, -1, true);
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
else if(is_h_max)
|
||||
{
|
||||
lua_State *L = globalconf_get_lua_State();
|
||||
luaA_object_push(L, c);
|
||||
client_set_maximized_horizontal(L, -1, true);
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
else if(is_v_max)
|
||||
{
|
||||
lua_State *L = globalconf_get_lua_State();
|
||||
luaA_object_push(L, c);
|
||||
client_set_maximized_vertical(L, -1, true);
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
p_delete(&reply);
|
||||
|
||||
reply = xcb_get_property_reply(globalconf.connection, c2, NULL);
|
||||
|
|
Loading…
Reference in New Issue