maximize: Stop mixing horizontal, vertical and both.
Before this commit, do this: c.maximize_hoizontal = true c.maximize = true c.maximize = false assert(c.maximize_hoizontal) Would not work because the states were not preserved individually. This commit fixes that. Awesome wont be confused about it's own state anymore. This may seem pointless, but when it come to undoing these maximizations, it was ambiguous.
This commit is contained in:
parent
3ca363115d
commit
d5b681502a
5
ewmh.c
5
ewmh.c
|
@ -49,9 +49,9 @@ ewmh_client_update_hints(lua_State *L)
|
||||||
state[i++] = _NET_WM_STATE_MODAL;
|
state[i++] = _NET_WM_STATE_MODAL;
|
||||||
if(c->fullscreen)
|
if(c->fullscreen)
|
||||||
state[i++] = _NET_WM_STATE_FULLSCREEN;
|
state[i++] = _NET_WM_STATE_FULLSCREEN;
|
||||||
if(c->maximized_vertical)
|
if(c->maximized_vertical || c->maximized)
|
||||||
state[i++] = _NET_WM_STATE_MAXIMIZED_VERT;
|
state[i++] = _NET_WM_STATE_MAXIMIZED_VERT;
|
||||||
if(c->maximized_horizontal)
|
if(c->maximized_horizontal || c->maximized)
|
||||||
state[i++] = _NET_WM_STATE_MAXIMIZED_HORZ;
|
state[i++] = _NET_WM_STATE_MAXIMIZED_HORZ;
|
||||||
if(c->sticky)
|
if(c->sticky)
|
||||||
state[i++] = _NET_WM_STATE_STICKY;
|
state[i++] = _NET_WM_STATE_STICKY;
|
||||||
|
@ -220,6 +220,7 @@ ewmh_init_lua(void)
|
||||||
luaA_class_connect_signal(L, &client_class, "property::fullscreen" , ewmh_client_update_hints);
|
luaA_class_connect_signal(L, &client_class, "property::fullscreen" , ewmh_client_update_hints);
|
||||||
luaA_class_connect_signal(L, &client_class, "property::maximized_horizontal" , ewmh_client_update_hints);
|
luaA_class_connect_signal(L, &client_class, "property::maximized_horizontal" , ewmh_client_update_hints);
|
||||||
luaA_class_connect_signal(L, &client_class, "property::maximized_vertical" , ewmh_client_update_hints);
|
luaA_class_connect_signal(L, &client_class, "property::maximized_vertical" , ewmh_client_update_hints);
|
||||||
|
luaA_class_connect_signal(L, &client_class, "property::maximized" , ewmh_client_update_hints);
|
||||||
luaA_class_connect_signal(L, &client_class, "property::sticky" , ewmh_client_update_hints);
|
luaA_class_connect_signal(L, &client_class, "property::sticky" , ewmh_client_update_hints);
|
||||||
luaA_class_connect_signal(L, &client_class, "property::skip_taskbar" , ewmh_client_update_hints);
|
luaA_class_connect_signal(L, &client_class, "property::skip_taskbar" , ewmh_client_update_hints);
|
||||||
luaA_class_connect_signal(L, &client_class, "property::above" , ewmh_client_update_hints);
|
luaA_class_connect_signal(L, &client_class, "property::above" , ewmh_client_update_hints);
|
||||||
|
|
|
@ -138,6 +138,7 @@ function client.tiled(s, stacked)
|
||||||
for _, c in pairs(clients) do
|
for _, c in pairs(clients) do
|
||||||
if not client.object.get_floating(c)
|
if not client.object.get_floating(c)
|
||||||
and not c.fullscreen
|
and not c.fullscreen
|
||||||
|
and not c.maximized
|
||||||
and not c.maximized_vertical
|
and not c.maximized_vertical
|
||||||
and not c.maximized_horizontal then
|
and not c.maximized_horizontal then
|
||||||
table.insert(tclients, c)
|
table.insert(tclients, c)
|
||||||
|
@ -668,6 +669,7 @@ function client.object.get_floating(c)
|
||||||
or c.fullscreen
|
or c.fullscreen
|
||||||
or c.maximized_vertical
|
or c.maximized_vertical
|
||||||
or c.maximized_horizontal
|
or c.maximized_horizontal
|
||||||
|
or c.maximized
|
||||||
or client.object.is_fixed(c) then
|
or client.object.is_fixed(c) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,10 +45,10 @@ local function geometry_change(window)
|
||||||
-- Fix up the geometry in case this window needs to cover the whole screen.
|
-- Fix up the geometry in case this window needs to cover the whole screen.
|
||||||
local bw = window.border_width or 0
|
local bw = window.border_width or 0
|
||||||
local g = window.screen.workarea
|
local g = window.screen.workarea
|
||||||
if window.maximized_vertical then
|
if window.maximized_vertical or window.maximized then
|
||||||
window:geometry { height = g.height - 2*bw, y = g.y }
|
window:geometry { height = g.height - 2*bw, y = g.y }
|
||||||
end
|
end
|
||||||
if window.maximized_horizontal then
|
if window.maximized_horizontal or window.maximized then
|
||||||
window:geometry { width = g.width - 2*bw, x = g.x }
|
window:geometry { width = g.width - 2*bw, x = g.x }
|
||||||
end
|
end
|
||||||
if window.fullscreen then
|
if window.fullscreen then
|
||||||
|
|
|
@ -809,6 +809,7 @@ typedef enum {
|
||||||
CLIENT_MAXIMIZED_NONE = 0 << 0,
|
CLIENT_MAXIMIZED_NONE = 0 << 0,
|
||||||
CLIENT_MAXIMIZED_V = 1 << 0,
|
CLIENT_MAXIMIZED_V = 1 << 0,
|
||||||
CLIENT_MAXIMIZED_H = 1 << 1,
|
CLIENT_MAXIMIZED_H = 1 << 1,
|
||||||
|
CLIENT_MAXIMIZED_BOTH = 1 << 2, /* V|H == BOTH, but ~(V|H) != ~(BOTH)... */
|
||||||
} client_maximized_t;
|
} client_maximized_t;
|
||||||
|
|
||||||
static area_t titlebar_get_area(client_t *c, client_titlebar_t bar);
|
static area_t titlebar_get_area(client_t *c, client_titlebar_t bar);
|
||||||
|
@ -1940,16 +1941,6 @@ client_set_fullscreen(lua_State *L, int cidx, bool s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get a clients maximized state (horizontally and vertically).
|
|
||||||
* \param c The client.
|
|
||||||
* \return The maximized state.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
client_get_maximized(client_t *c)
|
|
||||||
{
|
|
||||||
return c->maximized_horizontal && c->maximized_vertical;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set a client horizontally|vertically maximized.
|
/** Set a client horizontally|vertically maximized.
|
||||||
* \param L The Lua VM state.
|
* \param L The Lua VM state.
|
||||||
* \param cidx The client index.
|
* \param cidx The client index.
|
||||||
|
@ -1962,21 +1953,28 @@ client_set_maximized_common(lua_State *L, int cidx, bool s, const char* type, co
|
||||||
|
|
||||||
/* Store the current and next state on 2 bit */
|
/* Store the current and next state on 2 bit */
|
||||||
const client_maximized_t current = (
|
const client_maximized_t current = (
|
||||||
(c->maximized_vertical ? CLIENT_MAXIMIZED_V : CLIENT_MAXIMIZED_NONE)|
|
(c->maximized_vertical ? CLIENT_MAXIMIZED_V : CLIENT_MAXIMIZED_NONE)|
|
||||||
(c->maximized_horizontal ? CLIENT_MAXIMIZED_H : CLIENT_MAXIMIZED_NONE)
|
(c->maximized_horizontal ? CLIENT_MAXIMIZED_H : CLIENT_MAXIMIZED_NONE)|
|
||||||
|
(c->maximized ? CLIENT_MAXIMIZED_BOTH : CLIENT_MAXIMIZED_NONE)
|
||||||
);
|
);
|
||||||
const client_maximized_t next = s ? val : CLIENT_MAXIMIZED_NONE;
|
client_maximized_t next = s ? (val | current) : (current & (~val));
|
||||||
|
|
||||||
|
/* When both are already set during startup, assume `maximized` is true*/
|
||||||
|
if (next == (CLIENT_MAXIMIZED_H|CLIENT_MAXIMIZED_V) && !globalconf.loop)
|
||||||
|
next = CLIENT_MAXIMIZED_BOTH;
|
||||||
|
|
||||||
if(current != next)
|
if(current != next)
|
||||||
{
|
{
|
||||||
int abs_cidx = luaA_absindex(L, cidx);
|
int abs_cidx = luaA_absindex(L, cidx);
|
||||||
int max_before = client_get_maximized(c);
|
int max_before = c->maximized;
|
||||||
int h_before = c->maximized_horizontal;
|
int h_before = c->maximized_horizontal;
|
||||||
int v_before = c->maximized_vertical;
|
int v_before = c->maximized_vertical;
|
||||||
|
|
||||||
/*Update the client properties */
|
/*Update the client properties */
|
||||||
c->maximized_horizontal = !!(next & CLIENT_MAXIMIZED_H);
|
c->maximized_horizontal = !!(next & CLIENT_MAXIMIZED_H );
|
||||||
c->maximized_vertical = !!(next & CLIENT_MAXIMIZED_V);
|
c->maximized_vertical = !!(next & CLIENT_MAXIMIZED_V );
|
||||||
|
c->maximized = !!(next & CLIENT_MAXIMIZED_BOTH);
|
||||||
|
|
||||||
|
|
||||||
/* Request the changes to be applied */
|
/* Request the changes to be applied */
|
||||||
lua_pushstring(L, type);
|
lua_pushstring(L, type);
|
||||||
|
@ -1987,7 +1985,7 @@ client_set_maximized_common(lua_State *L, int cidx, bool s, const char* type, co
|
||||||
luaA_object_emit_signal(L, abs_cidx, "property::maximized_horizontal", 0);
|
luaA_object_emit_signal(L, abs_cidx, "property::maximized_horizontal", 0);
|
||||||
if (v_before != c->maximized_vertical)
|
if (v_before != c->maximized_vertical)
|
||||||
luaA_object_emit_signal(L, abs_cidx, "property::maximized_vertical", 0);
|
luaA_object_emit_signal(L, abs_cidx, "property::maximized_vertical", 0);
|
||||||
if(max_before != client_get_maximized(c))
|
if(max_before != c->maximized)
|
||||||
luaA_object_emit_signal(L, abs_cidx, "property::maximized", 0);
|
luaA_object_emit_signal(L, abs_cidx, "property::maximized", 0);
|
||||||
|
|
||||||
stack_windows();
|
stack_windows();
|
||||||
|
@ -1998,8 +1996,7 @@ void
|
||||||
client_set_maximized(lua_State *L, int cidx, bool s)
|
client_set_maximized(lua_State *L, int cidx, bool s)
|
||||||
{
|
{
|
||||||
return client_set_maximized_common(
|
return client_set_maximized_common(
|
||||||
L, cidx, s, "maximized",
|
L, cidx, s, "maximized", CLIENT_MAXIMIZED_BOTH
|
||||||
CLIENT_MAXIMIZED_H | CLIENT_MAXIMIZED_V
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3057,15 +3054,9 @@ LUA_OBJECT_EXPORT_PROPERTY(client, client_t, sticky, lua_pushboolean)
|
||||||
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, size_hints_honor, lua_pushboolean)
|
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, size_hints_honor, lua_pushboolean)
|
||||||
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, maximized_horizontal, lua_pushboolean)
|
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, maximized_horizontal, lua_pushboolean)
|
||||||
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, maximized_vertical, lua_pushboolean)
|
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, maximized_vertical, lua_pushboolean)
|
||||||
|
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, maximized, lua_pushboolean)
|
||||||
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, startup_id, lua_pushstring)
|
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, startup_id, lua_pushstring)
|
||||||
|
|
||||||
static int
|
|
||||||
luaA_client_get_maximized(lua_State *L, client_t *c)
|
|
||||||
{
|
|
||||||
lua_pushboolean(L, client_get_maximized(c));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
luaA_client_get_content(lua_State *L, client_t *c)
|
luaA_client_get_content(lua_State *L, client_t *c)
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,6 +82,10 @@ struct client_t
|
||||||
bool maximized_horizontal;
|
bool maximized_horizontal;
|
||||||
/** True if the client is maximized vertically */
|
/** True if the client is maximized vertically */
|
||||||
bool maximized_vertical;
|
bool maximized_vertical;
|
||||||
|
/** True if the client is maximized both horizontally and vertically by the
|
||||||
|
* the user
|
||||||
|
*/
|
||||||
|
bool maximized;
|
||||||
/** True if the client is above others */
|
/** True if the client is above others */
|
||||||
bool above;
|
bool above;
|
||||||
/** True if the client is below others */
|
/** True if the client is below others */
|
||||||
|
|
Loading…
Reference in New Issue