From 6ac098a45e823aaea84db9298d42e07d5d64efe8 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 10 Oct 2011 13:30:52 +0100 Subject: [PATCH] support _NET_STARTUP_ID on the client leader window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (necessary for GIMP, geeqie, …) --- src/startup.c | 17 ++++++++++++++--- testcases/t/175-startup-notification.t | 12 +++++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/startup.c b/src/startup.c index 30932e33..dca7b999 100644 --- a/src/startup.c +++ b/src/startup.c @@ -129,10 +129,21 @@ char *startup_workspace_for_window(i3Window *cwindow, xcb_get_property_reply_t * /* The _NET_STARTUP_ID is only needed during this function, so we get it * here and don’t save it in the 'cwindow'. */ if (startup_id_reply == NULL || xcb_get_property_value_length(startup_id_reply) == 0) { - DLOG("No _NET_STARTUP_ID set on this window\n"); - /* TODO: check the leader, if any */ FREE(startup_id_reply); - return NULL; + DLOG("No _NET_STARTUP_ID set on this window\n"); + if (cwindow->leader == XCB_NONE) + return NULL; + + xcb_get_property_cookie_t cookie; + cookie = xcb_get_property(conn, false, cwindow->leader, A__NET_STARTUP_ID, XCB_GET_PROPERTY_TYPE_ANY, 0, 512); + DLOG("Checking leader window 0x%08x\n", cwindow->leader); + startup_id_reply = xcb_get_property_reply(conn, cookie, NULL); + + if (startup_id_reply == NULL || xcb_get_property_value_length(startup_id_reply) == 0) { + DLOG("No _NET_STARTUP_ID set on the leader either\n"); + FREE(startup_id_reply); + return NULL; + } } char *startup_id; diff --git a/testcases/t/175-startup-notification.t b/testcases/t/175-startup-notification.t index 710b3af7..56088719 100644 --- a/testcases/t/175-startup-notification.t +++ b/testcases/t/175-startup-notification.t @@ -106,7 +106,17 @@ sync_with_i3($x); is(@{get_ws_content($second_ws)}, 0, 'still no containers on the second workspace'); is(@{get_ws_content($first_ws)}, 1, 'one container on the first workspace'); -# TODO: the same thing, but in a CLIENT_LEADER situation +###################################################################### +# same thing, but with _NET_STARTUP_ID set on the leader +###################################################################### + +my $leader = open_window($x, { dont_map => 1 }); +mark_window($leader->id); + +$win = open_window($x, { client_leader => $leader }); + +is(@{get_ws_content($second_ws)}, 0, 'still no containers on the second workspace'); +is(@{get_ws_content($first_ws)}, 2, 'two containers on the first workspace'); ###################################################################### # 2) open another window after the startup process is completed