From fed803a6bc710301188fb0f8afd1ecb467bf45df Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 16 Mar 2014 20:15:02 +0100 Subject: [PATCH] client manage signal: Remove startup argument We now have awesome.startup which does the same thing in better. Signed-off-by: Uli Schlachter --- awesome.c | 2 +- awesomerc.lua.in | 4 +-- event.c | 2 +- objects/client.c | 74 ++++++++++++++++++++---------------------------- objects/client.h | 2 +- 5 files changed, 35 insertions(+), 49 deletions(-) diff --git a/awesome.c b/awesome.c index 153dfbbb6..cb131e99b 100644 --- a/awesome.c +++ b/awesome.c @@ -149,7 +149,7 @@ scan(xcb_query_tree_cookie_t tree_c) continue; } - client_manage(wins[i], geom_r, attr_r, true); + client_manage(wins[i], geom_r, attr_r); p_delete(&attr_r); p_delete(&geom_r); diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 0be6bf7c9..7b6e39492 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -367,7 +367,7 @@ awful.rules.rules = { -- {{{ Signals -- Signal function to execute when a new client appears. -client.connect_signal("manage", function (c, startup) +client.connect_signal("manage", function (c) -- Enable sloppy focus c:connect_signal("mouse::enter", function(c) if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier @@ -376,7 +376,7 @@ client.connect_signal("manage", function (c, startup) end end) - if not startup then + if not awesome.startup then -- Set the windows at the slave, -- i.e. put it at the end of others instead of setting it master. -- awful.client.setslave(c) diff --git a/event.c b/event.c index 7915d4233..0592c3b54 100644 --- a/event.c +++ b/event.c @@ -632,7 +632,7 @@ event_handle_maprequest(xcb_map_request_event_t *ev) goto bailout; } - client_manage(ev->window, geom_r, wa_r, false); + client_manage(ev->window, geom_r, wa_r); p_delete(&geom_r); } diff --git a/objects/client.c b/objects/client.c index f721f2de4..c98e69670 100644 --- a/objects/client.c +++ b/objects/client.c @@ -422,7 +422,7 @@ client_update_properties(client_t *c) * \param startup True if we are managing at startup time. */ void -client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, xcb_get_window_attributes_reply_t *wattr, bool startup) +client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, xcb_get_window_attributes_reply_t *wattr) { const uint32_t select_input_val[] = { CLIENT_SELECT_INPUT_EVENT_MASK }; @@ -434,10 +434,9 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, xcb_get_window_at /* If this is a new client that just has been launched, then request its * startup id. */ - xcb_get_property_cookie_t startup_id_q = { 0 }; - if(!startup) - startup_id_q = xcb_get_property(globalconf.connection, false, w, - _NET_STARTUP_ID, XCB_GET_PROPERTY_TYPE_ANY, 0, UINT_MAX); + xcb_get_property_cookie_t startup_id_q = xcb_get_property(globalconf.connection, false, + w, _NET_STARTUP_ID, + XCB_GET_PROPERTY_TYPE_ANY, 0, UINT_MAX); /* Make sure the window is automatically mapped if awesome exits or dies. */ xcb_change_save_set(globalconf.connection, XCB_SET_MODE_INSERT, w); @@ -470,33 +469,25 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, xcb_get_window_at globalconf.default_cmap }); - if (startup) - { - /* The client is already mapped, thus we must be sure that we don't send - * ourselves an UnmapNotify due to the xcb_reparent_window(). - * - * Grab the server to make sure we don't lose any events. - */ - uint32_t no_event[] = { 0 }; - xcb_grab_server(globalconf.connection); - - xcb_change_window_attributes(globalconf.connection, - globalconf.screen->root, - XCB_CW_EVENT_MASK, - no_event); - } + /* The client may already be mapped, thus we must be sure that we don't send + * ourselves an UnmapNotify due to the xcb_reparent_window(). + * + * Grab the server to make sure we don't lose any events. + */ + uint32_t no_event[] = { 0 }; + xcb_grab_server(globalconf.connection); + xcb_change_window_attributes(globalconf.connection, + globalconf.screen->root, + XCB_CW_EVENT_MASK, + no_event); xcb_reparent_window(globalconf.connection, w, c->frame_window, 0, 0); xcb_map_window(globalconf.connection, w); - - if (startup) - { - xcb_change_window_attributes(globalconf.connection, - globalconf.screen->root, - XCB_CW_EVENT_MASK, - ROOT_WINDOW_EVENT_MASK); - xcb_ungrab_server(globalconf.connection); - } + xcb_change_window_attributes(globalconf.connection, + globalconf.screen->root, + XCB_CW_EVENT_MASK, + ROOT_WINDOW_EVENT_MASK); + xcb_ungrab_server(globalconf.connection); /* Do this now so that we don't get any events for the above * (Else, reparent could cause an UnmapNotify) */ @@ -571,24 +562,19 @@ HANDLE_GEOM(height) */ xwindow_set_state(c->window, XCB_ICCCM_WM_STATE_NORMAL); - if(!startup) - { - /* Request our response */ - xcb_get_property_reply_t *reply = - xcb_get_property_reply(globalconf.connection, startup_id_q, NULL); - /* Say spawn that a client has been started, with startup id as argument */ - char *startup_id = xutil_get_text_property_from_reply(reply); - c->startup_id = startup_id; - p_delete(&reply); - spawn_start_notify(c, startup_id); - } + /* Request our response */ + xcb_get_property_reply_t *reply = + xcb_get_property_reply(globalconf.connection, startup_id_q, NULL); + /* Say spawn that a client has been started, with startup id as argument */ + char *startup_id = xutil_get_text_property_from_reply(reply); + c->startup_id = startup_id; + p_delete(&reply); + spawn_start_notify(c, startup_id); luaA_class_emit_signal(globalconf.L, &client_class, "list", 0); - /* client is still on top of the stack; push startup value, - * and emit signals with one arg */ - lua_pushboolean(globalconf.L, startup); - luaA_object_emit_signal(globalconf.L, -2, "manage", 1); + /* client is still on top of the stack; emit signal */ + luaA_object_emit_signal(globalconf.L, -1, "manage", 0); /* pop client */ lua_pop(globalconf.L, 1); } diff --git a/objects/client.h b/objects/client.h index 5fd4fa04a..a5bbe902a 100644 --- a/objects/client.h +++ b/objects/client.h @@ -143,7 +143,7 @@ client_t * client_getbyframewin(xcb_window_t); void client_ban(client_t *); void client_ban_unfocus(client_t *); void client_unban(client_t *); -void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, xcb_get_window_attributes_reply_t *, bool); +void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, xcb_get_window_attributes_reply_t *); bool client_resize(client_t *, area_t, bool); void client_unmanage(client_t *, bool); void client_kill(client_t *);