client, spawn: stop storing startup_id

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-24 10:16:52 +02:00
parent e5048f72d5
commit 73a1011364
4 changed files with 21 additions and 9 deletions

View File

@ -54,7 +54,6 @@ luaA_client_gc(lua_State *L)
key_array_wipe(&c->keys);
xcb_get_wm_protocols_reply_wipe(&c->protocols);
p_delete(&c->class);
p_delete(&c->startup_id);
p_delete(&c->instance);
p_delete(&c->icon_name);
p_delete(&c->name);
@ -588,6 +587,13 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
return;
}
/* 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_any_property(globalconf.connection,
false, w, _NET_STARTUP_ID, UINT_MAX);
xcb_change_window_attributes(globalconf.connection, w, XCB_CW_EVENT_MASK, select_input_val);
client_t *c = client_new(globalconf.L);
@ -652,8 +658,6 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
property_update_wm_class(c, NULL);
property_update_wm_protocols(c);
xutil_text_prop_get(globalconf.connection, c->window, _NET_STARTUP_ID, &c->startup_id, NULL);
/* update strut */
ewmh_process_client_strut(c, NULL);
@ -678,7 +682,16 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
window_state_set(c->window, XCB_WM_STATE_NORMAL);
if(!startup)
spawn_start_notify(c);
{
/* 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);
p_delete(&reply);
spawn_start_notify(c, startup_id);
p_delete(&startup_id);
}
/* Call hook to notify list change */
if(globalconf.hooks.clients != LUA_REFNIL)

View File

@ -66,8 +66,6 @@ struct client_t
char *name, *icon_name;
/** WM_CLASS stuff */
char *class, *instance;
/** Startup ID */
char *startup_id;
/** Window geometry */
area_t geometry;
struct

View File

@ -195,9 +195,10 @@ spawn_monitor_event(SnMonitorEvent *event, void *data)
/** Tell the spawn module that an app has been started.
* \param c The client that just started.
* \param startup_id The startup id of the started application.
*/
void
spawn_start_notify(client_t *c)
spawn_start_notify(client_t *c, const char * startup_id)
{
foreach(_seq, sn_waits)
{
@ -205,7 +206,7 @@ spawn_start_notify(client_t *c)
bool found = false;
const char *seqid = sn_startup_sequence_get_id(seq);
if(!a_strcmp(seqid, c->startup_id))
if(!a_strcmp(seqid, startup_id))
found = true;
else
{

View File

@ -25,7 +25,7 @@
#include "structs.h"
void spawn_init(void);
void spawn_start_notify(client_t *);
void spawn_start_notify(client_t *, const char *);
int luaA_spawn(lua_State *);
#endif