Hi people, the attached patches add calls to property hooks with "before_" inserted before the property name and they change the behaviour of titlebars a bit, in that they are removed when a client is fullscreened and reattached if the client goes out of fullscreen mode.
--
GCS/IT/M d- s+:- a--- C++ UL+++ US UB++ P+++ L+++ E--- W+ N+ o--
K- w--- O M-- V PS+ PE- Y+ PGP+++ t+ 5 X+ R tv+ b++ DI+++ D+++ G+
e- h! r y+
Gregor Best
From d32926dc312875f422799af4a5714c7d5567d0d2 Mon Sep 17 00:00:00 2001 From: Gregor Best <[email protected]> Date: Sun, 22 Mar 2009 15:25:58 +0100 Subject: [PATCH 1/2] client: add before_ property hooks Signed-off-by: Gregor Best <[email protected]> --- client.c | 22 ++++++++++++++++++++++ property.c | 3 +++ titlebar.c | 1 + 3 files changed, 26 insertions(+), 0 deletions(-) diff --git a/client.c b/client.c index da6262d..ec0eeb3 100644 --- a/client.c +++ b/client.c @@ -95,6 +95,8 @@ client_seturgent(client_t *c, bool urgent) { if(c->isurgent != urgent) { + hooks_property(c, "before_urgent"); + xcb_get_property_cookie_t hints = xcb_get_wm_hints_unchecked(globalconf.connection, c->win); @@ -746,6 +748,8 @@ client_resize(client_t *c, area_t geometry, bool hints) || c->geometries.internal.width != geometry_internal.width || c->geometries.internal.height != geometry_internal.height) { + hooks_property(c, "before_geometry"); + new_screen = screen_getbycoord(c->screen, geometry_internal.x, geometry_internal.y); /* Values to configure a window is an array where values are @@ -797,6 +801,8 @@ client_setminimized(client_t *c, bool s) { if(c->isminimized != s) { + hooks_property(c, "before_minimized"); + client_need_arrange(c); c->isminimized = s; client_need_arrange(c); @@ -815,6 +821,8 @@ client_setsticky(client_t *c, bool s) { if(c->issticky != s) { + hooks_property(c, "before_sticky"); + client_need_arrange(c); c->issticky = s; client_need_arrange(c); @@ -834,6 +842,7 @@ client_setfullscreen(client_t *c, bool s) { area_t geometry; + hooks_property(c, "before_fullscreen"); /* become fullscreen! */ if((c->isfullscreen = s)) { @@ -872,6 +881,8 @@ client_setmaxhoriz(client_t *c, bool s) { if(c->ismaxhoriz != s) { + hooks_property(c, "before_maximized_horizontal"); + area_t geometry; if((c->ismaxhoriz = s)) @@ -914,6 +925,8 @@ client_setmaxvert(client_t *c, bool s) { area_t geometry; + hooks_property(c, "before_maximized_vertical"); + if((c->ismaxvert = s)) { /* remove fullscreen mode */ @@ -952,6 +965,8 @@ client_setabove(client_t *c, bool s) { if(c->isabove != s) { + hooks_property(c, "before_above"); + /* You can only be part of one of the special layers. */ if(s) { @@ -976,6 +991,8 @@ client_setbelow(client_t *c, bool s) { if(c->isbelow != s) { + hooks_property(c, "before_below"); + /* You can only be part of one of the special layers. */ if(s) { @@ -1000,6 +1017,7 @@ client_setmodal(client_t *c, bool s) { if(c->ismodal != s) { + hooks_property(c, "before_modal"); c->ismodal = s; client_stack(); ewmh_client_update_hints(c); @@ -1017,6 +1035,7 @@ client_setontop(client_t *c, bool s) { if(c->isontop != s) { + hooks_property(c, "before_ontop"); /* You can only be part of one of the special layers. */ if(s) { @@ -1222,6 +1241,8 @@ client_setborder(client_t *c, int width) { uint32_t w = width; + hooks_property(c, "before_border_width"); + if(width > 0 && (c->type == WINDOW_TYPE_DOCK || c->type == WINDOW_TYPE_SPLASH || c->type == WINDOW_TYPE_DESKTOP @@ -1554,6 +1575,7 @@ luaA_client_newindex(lua_State *L) client_setmaxvert(*c, luaA_checkboolean(L, 3)); break; case A_TK_ICON: + hooks_property(*c, "before_icon"); image = luaA_checkudata(L, 3, "image"); image_unref(&(*c)->icon); image_ref(image); diff --git a/property.c b/property.c index 3caa0b0..8bd0e92 100644 --- a/property.c +++ b/property.c @@ -210,6 +210,7 @@ property_update_wm_name(client_t *c) char *name; ssize_t len; + hooks_property(c, "before_name"); if(!xutil_text_prop_get(globalconf.connection, c->win, _NET_WM_NAME, &name, &len)) if(!xutil_text_prop_get(globalconf.connection, c->win, WM_NAME, &name, &len)) return; @@ -232,6 +233,7 @@ property_update_wm_icon_name(client_t *c) char *name; ssize_t len; + hooks_property(c, "before_icon_name"); if(!xutil_text_prop_get(globalconf.connection, c->win, _NET_WM_ICON_NAME, &name, &len)) if(!xutil_text_prop_get(globalconf.connection, c->win, WM_ICON_NAME, &name, &len)) return; @@ -304,6 +306,7 @@ property_handle_net_wm_icon(void *data, if(c) { + hooks_property(c, "before_icon"); image_t *icon; image_unref(&c->icon); icon = ewmh_window_icon_from_reply(reply); diff --git a/titlebar.c b/titlebar.c index d5de3e4..1ea8af4 100644 --- a/titlebar.c +++ b/titlebar.c @@ -380,6 +380,7 @@ luaA_titlebar_newindex(lua_State *L, wibox_t *titlebar, awesome_token_t tok) titlebar->position = position; if((c = client_getbytitlebar(titlebar))) { + hooks_property(c, "before_geometry"); titlebar_update_geometry(c); /* call geometry hook for client because some like to * set titlebar width in that hook, which make sense */ -- 1.6.2
From 1daa69498e15a4186848aeffa1eef9d9fa846264 Mon Sep 17 00:00:00 2001 From: Gregor Best <[email protected]> Date: Sun, 22 Mar 2009 15:40:30 +0100 Subject: [PATCH 2/2] titlebar: remove and readd on fullscreen change Signed-off-by: Gregor Best <[email protected]> --- lib/awful/titlebar.lua.in | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/lib/awful/titlebar.lua.in b/lib/awful/titlebar.lua.in index 04b2736..40f7b79 100644 --- a/lib/awful/titlebar.lua.in +++ b/lib/awful/titlebar.lua.in @@ -126,6 +126,14 @@ end -- @param c The client to update. -- @param prop The property name which has changed. function update(c, prop) + if prop and (prop == "before_fullscreen" or prop:match("before_maximized_.*")) then + if c.titlebar then + c.titlebar = nil + elseif data[c] then + add(c) + end + return + end if c.titlebar and data[c] then local widgets = c.titlebar.widgets if prop == "name" then -- 1.6.2
signature.asc
Description: PGP signature
