systray: add some cleanup code
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
11dfa832a8
commit
97cf3a7719
|
@ -56,6 +56,7 @@ awesome_atexit(void)
|
||||||
{
|
{
|
||||||
client_t *c;
|
client_t *c;
|
||||||
xembed_window_t *em;
|
xembed_window_t *em;
|
||||||
|
int screen_nbr;
|
||||||
|
|
||||||
a_dbus_cleanup();
|
a_dbus_cleanup();
|
||||||
luaA_cs_cleanup();
|
luaA_cs_cleanup();
|
||||||
|
@ -64,9 +65,15 @@ awesome_atexit(void)
|
||||||
for(em = globalconf.embedded; em; em = em->next)
|
for(em = globalconf.embedded; em; em = em->next)
|
||||||
{
|
{
|
||||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, em->phys_screen);
|
xcb_screen_t *s = xutil_screen_get(globalconf.connection, em->phys_screen);
|
||||||
xcb_reparent_window(globalconf.connection, em->win, s->root, 0, 0);
|
xembed_window_unembed(globalconf.connection, em->win, s->root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* do this only for real screen */
|
||||||
|
for(screen_nbr = 0;
|
||||||
|
screen_nbr < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||||
|
screen_nbr++)
|
||||||
|
systray_cleanup(screen_nbr);
|
||||||
|
|
||||||
/* remap all clients since some WM won't handle them otherwise */
|
/* remap all clients since some WM won't handle them otherwise */
|
||||||
for(c = globalconf.clients; c; c = c->next)
|
for(c = globalconf.clients; c; c = c->next)
|
||||||
client_unban(c);
|
client_unban(c);
|
||||||
|
|
|
@ -25,28 +25,6 @@
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "common/atoms.h"
|
#include "common/atoms.h"
|
||||||
|
|
||||||
/** Have the embedder end XEMBED protocol communication with a child.
|
|
||||||
* \param connection The X connection.
|
|
||||||
* \param child The window to unembed.
|
|
||||||
* \param root The root window to reparent to.
|
|
||||||
*/
|
|
||||||
static inline void
|
|
||||||
xembed_window_unembed(xcb_connection_t *connection, xcb_window_t child, xcb_window_t root)
|
|
||||||
{
|
|
||||||
xcb_unmap_window(connection, child);
|
|
||||||
xcb_reparent_window(connection, child, root, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Indicate to an embedded window that it has lost focus.
|
|
||||||
* \param c The X connection.
|
|
||||||
* \param client The client to send message to.
|
|
||||||
*/
|
|
||||||
static inline void
|
|
||||||
xembed_focus_out(xcb_connection_t *c, xcb_window_t client)
|
|
||||||
{
|
|
||||||
xembed_message_send(c, client, XEMBED_FOCUS_OUT, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Send an XEMBED message to a window.
|
/** Send an XEMBED message to a window.
|
||||||
* \param connection Connection to the X server.
|
* \param connection Connection to the X server.
|
||||||
* \param towin Destination window
|
* \param towin Destination window
|
||||||
|
|
|
@ -145,5 +145,27 @@ xembed_embedded_notify(xcb_connection_t *c,
|
||||||
xembed_message_send(c, client, XEMBED_EMBEDDED_NOTIFY, 0, embedder, version);
|
xembed_message_send(c, client, XEMBED_EMBEDDED_NOTIFY, 0, embedder, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Have the embedder end XEMBED protocol communication with a child.
|
||||||
|
* \param connection The X connection.
|
||||||
|
* \param child The window to unembed.
|
||||||
|
* \param root The root window to reparent to.
|
||||||
|
*/
|
||||||
|
static inline void
|
||||||
|
xembed_window_unembed(xcb_connection_t *connection, xcb_window_t child, xcb_window_t root)
|
||||||
|
{
|
||||||
|
xcb_reparent_window(connection, child, root, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Indicate to an embedded window that it has lost focus.
|
||||||
|
* \param c The X connection.
|
||||||
|
* \param client The client to send message to.
|
||||||
|
*/
|
||||||
|
static inline void
|
||||||
|
xembed_focus_out(xcb_connection_t *c, xcb_window_t client)
|
||||||
|
{
|
||||||
|
xembed_message_send(c, client, XEMBED_FOCUS_OUT, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||||
|
|
31
systray.c
31
systray.c
|
@ -32,6 +32,9 @@
|
||||||
|
|
||||||
extern awesome_t globalconf;
|
extern awesome_t globalconf;
|
||||||
|
|
||||||
|
/** Initialize systray information in X.
|
||||||
|
* \param phys_screen Physical screen.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
systray_init(int phys_screen)
|
systray_init(int phys_screen)
|
||||||
{
|
{
|
||||||
|
@ -82,6 +85,34 @@ systray_init(int phys_screen)
|
||||||
xcb_send_event(globalconf.connection, false, xscreen->root, 0xFFFFFF, (char *) &ev);
|
xcb_send_event(globalconf.connection, false, xscreen->root, 0xFFFFFF, (char *) &ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Remove systray information in X.
|
||||||
|
* \param phys_screen Physical screen.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
systray_cleanup(int phys_screen)
|
||||||
|
{
|
||||||
|
xcb_intern_atom_cookie_t atom_systray_q;
|
||||||
|
xcb_intern_atom_reply_t *atom_systray_r;
|
||||||
|
ssize_t len;
|
||||||
|
char atom_name[22];
|
||||||
|
|
||||||
|
len = snprintf(atom_name, sizeof(atom_name), "_NET_SYSTEM_TRAY_S%d", phys_screen);
|
||||||
|
atom_systray_q = xcb_intern_atom_unchecked(globalconf.connection, false, len, atom_name);
|
||||||
|
|
||||||
|
if(!(atom_systray_r = xcb_intern_atom_reply(globalconf.connection, atom_systray_q, NULL)))
|
||||||
|
{
|
||||||
|
warn("error getting systray atom");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
xcb_set_selection_owner(globalconf.connection,
|
||||||
|
XCB_NONE,
|
||||||
|
atom_systray_r->atom,
|
||||||
|
XCB_CURRENT_TIME);
|
||||||
|
|
||||||
|
p_delete(&atom_systray_r);
|
||||||
|
}
|
||||||
|
|
||||||
/** Handle a systray request.
|
/** Handle a systray request.
|
||||||
* \param embed_win The window to embed.
|
* \param embed_win The window to embed.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "common/xembed.h"
|
#include "common/xembed.h"
|
||||||
|
|
||||||
void systray_init(int);
|
void systray_init(int);
|
||||||
|
void systray_cleanup(int);
|
||||||
int systray_request_handle(xcb_window_t, int, xembed_info_t *);
|
int systray_request_handle(xcb_window_t, int, xembed_info_t *);
|
||||||
bool systray_iskdedockapp(xcb_window_t);
|
bool systray_iskdedockapp(xcb_window_t);
|
||||||
int systray_process_client_message(xcb_client_message_event_t *);
|
int systray_process_client_message(xcb_client_message_event_t *);
|
||||||
|
|
Loading…
Reference in New Issue