xproperty: Emit on "awesome" for root window properties

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2014-03-23 18:23:38 +01:00
parent a6fb932bbc
commit 6fcfd45e96
1 changed files with 17 additions and 8 deletions

View File

@ -394,20 +394,28 @@ property_handle_propertynotify_xproperty(xcb_property_notify_event_t *ev)
/* Property is not registered */ /* Property is not registered */
return; return;
obj = client_getbywin(ev->window); if (ev->window != globalconf.screen->root)
if(!obj) {
obj = drawin_getbywin(ev->window); obj = client_getbywin(ev->window);
if(!obj) if(!obj)
return; obj = drawin_getbywin(ev->window);
if(!obj)
return;
} else
obj = NULL;
/* Get us the name of the property */ /* Get us the name of the property */
buffer_inita(&buf, a_strlen(prop->name) + a_strlen("xproperty::") + 1); buffer_inita(&buf, a_strlen(prop->name) + a_strlen("xproperty::") + 1);
buffer_addf(&buf, "xproperty::%s", prop->name); buffer_addf(&buf, "xproperty::%s", prop->name);
/* And emit the right signal */ /* And emit the right signal */
luaA_object_push(globalconf.L, obj); if (obj)
luaA_object_emit_signal(globalconf.L, -1, buf.s, 0); {
lua_pop(globalconf.L, 1); luaA_object_push(globalconf.L, obj);
luaA_object_emit_signal(globalconf.L, -1, buf.s, 0);
lua_pop(globalconf.L, 1);
} else
signal_object_emit(globalconf.L, &global_signals, buf.s, 0);
buffer_wipe(&buf); buffer_wipe(&buf);
} }
@ -519,6 +527,7 @@ luaA_register_xproperty(lua_State *L)
property.name = a_strdup(name); property.name = a_strdup(name);
xproperty_array_insert(&globalconf.xproperties, property); xproperty_array_insert(&globalconf.xproperties, property);
signal_add(&window_class.signals, buf.s); signal_add(&window_class.signals, buf.s);
signal_add(&global_signals, buf.s);
buffer_wipe(&buf); buffer_wipe(&buf);
} }