From cd667802db5fc25b6f0d1e3f849d0668008ee6dd Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 29 Dec 2008 12:23:37 +0100 Subject: [PATCH] hooks: manage gets an extra startup arg Signed-off-by: Julien Danjou --- awesome.c | 2 +- awesomerc.lua.in | 2 +- client.c | 6 ++++-- client.h | 2 +- event.c | 2 +- hooks.c | 3 ++- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/awesome.c b/awesome.c index b2130c03..a984d12a 100644 --- a/awesome.c +++ b/awesome.c @@ -178,7 +178,7 @@ scan(void) screen = screen_getbycoord(phys_screen, geom_r->x, geom_r->y); - client_manage(wins[i], geom_r, phys_screen, screen); + client_manage(wins[i], geom_r, phys_screen, screen, true); p_delete(&geom_r); } diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 237f7468..796c863e 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -327,7 +327,7 @@ awful.hooks.mouse_enter.register(function (c) end) -- Hook function to execute when a new client appears. -awful.hooks.manage.register(function (c) +awful.hooks.manage.register(function (c, startup) if use_titlebar then -- Add a titlebar awful.titlebar.add(c, { modkey = modkey }) diff --git a/client.c b/client.c index eacd29ae..e1e5b9cf 100644 --- a/client.c +++ b/client.c @@ -440,9 +440,10 @@ client_duplicate_tags(client_t *src_c, client_t *dst_c) * \param wgeom Window geometry. * \param phys_screen Physical screen number. * \param screen Virtual screen number where to manage client. + * \param startup True if we are managing at startup time. */ void -client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen, int screen) +client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen, int screen, bool startup) { xcb_get_property_cookie_t ewmh_icon_cookie; client_t *c, *tc = NULL, *group = NULL; @@ -591,7 +592,8 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen, if(globalconf.hooks.manage != LUA_REFNIL) { luaA_client_userdata_new(globalconf.L, c); - luaA_dofunction(globalconf.L, globalconf.hooks.manage, 1, 0); + lua_pushboolean(globalconf.L, startup); + luaA_dofunction(globalconf.L, globalconf.hooks.manage, 2, 0); } } diff --git a/client.h b/client.h index 561e9c59..fd6324fd 100644 --- a/client.h +++ b/client.h @@ -50,7 +50,7 @@ client_t * client_getbywin(xcb_window_t); void client_stack(void); void client_ban(client_t *); void client_unban(client_t *); -void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, int, int); +void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, int, int, bool); area_t client_geometry_hints(client_t *, area_t); void client_resize(client_t *, area_t, bool); void client_unmanage(client_t *); diff --git a/event.c b/event.c index d38a92e6..03c3185b 100644 --- a/event.c +++ b/event.c @@ -645,7 +645,7 @@ event_handle_maprequest(void *data __attribute__ ((unused)), else screen = phys_screen; - client_manage(ev->window, geom_r, phys_screen, screen); + client_manage(ev->window, geom_r, phys_screen, screen, false); p_delete(&geom_r); } diff --git a/hooks.c b/hooks.c index f3826c1f..c5d8190c 100644 --- a/hooks.c +++ b/hooks.c @@ -58,7 +58,8 @@ luaA_hooks_unfocus(lua_State *L) } /** Set the function called each time a new client appears. This function is - * called with the client object as argument. + * called with the client object as argument, plus a boolean argument which is + * true if the client is managed at startup. * \param L The Lua VM state. * \return The number of elements pushed on stack. * \luastack