systray: Only register/unregister when needed
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
df3e89ad5c
commit
0face4fea7
|
@ -121,6 +121,8 @@ typedef struct
|
|||
xcb_window_t window;
|
||||
/** Atom for _NET_SYSTEM_TRAY_%d */
|
||||
xcb_atom_t atom;
|
||||
/** Do we own the systray selection? */
|
||||
bool registered;
|
||||
/** Systray window parent */
|
||||
drawin_t *parent;
|
||||
} systray;
|
||||
|
|
12
systray.c
12
systray.c
|
@ -74,6 +74,11 @@ systray_register(void)
|
|||
xcb_client_message_event_t ev;
|
||||
xcb_screen_t *xscreen = globalconf.screen;
|
||||
|
||||
if(globalconf.systray.registered)
|
||||
return;
|
||||
|
||||
globalconf.systray.registered = true;
|
||||
|
||||
/* Fill event */
|
||||
p_clear(&ev, 1);
|
||||
ev.response_type = XCB_CLIENT_MESSAGE;
|
||||
|
@ -98,6 +103,11 @@ systray_register(void)
|
|||
void
|
||||
systray_cleanup(void)
|
||||
{
|
||||
if(!globalconf.systray.registered)
|
||||
return;
|
||||
|
||||
globalconf.systray.registered = false;
|
||||
|
||||
xcb_set_selection_owner(globalconf.connection,
|
||||
XCB_NONE,
|
||||
globalconf.systray.atom,
|
||||
|
@ -297,8 +307,6 @@ systray_update(int base_size, bool horizontal, bool reverse, int spacing)
|
|||
int
|
||||
luaA_systray(lua_State *L)
|
||||
{
|
||||
|
||||
if(globalconf.systray.parent == NULL)
|
||||
systray_register();
|
||||
|
||||
if(lua_gettop(L) != 0)
|
||||
|
|
Loading…
Reference in New Issue