Move the systray info to globalconf
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
32d9a5b2ab
commit
a488d3f49d
|
@ -98,6 +98,15 @@ typedef struct
|
|||
SnDisplay *sndisplay;
|
||||
/** Latest timestamp we got from the X server */
|
||||
xcb_timestamp_t timestamp;
|
||||
/** Window that contains the systray */
|
||||
struct
|
||||
{
|
||||
xcb_window_t window;
|
||||
/** Systray window parent */
|
||||
xcb_window_t parent;
|
||||
/** Is awesome the systray owner? */
|
||||
bool registered;
|
||||
} systray;
|
||||
} awesome_t;
|
||||
|
||||
extern awesome_t globalconf;
|
||||
|
|
|
@ -40,16 +40,16 @@ wibox_systray_kickout(void)
|
|||
{
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
|
||||
if(globalconf.screens.tab[0].systray.parent != s->root)
|
||||
if(globalconf.systray.parent != s->root)
|
||||
{
|
||||
/* Who! Check that we're not deleting a wibox with a systray, because it
|
||||
* may be its parent. If so, we reparent to root before, otherwise it will
|
||||
* hurt very much. */
|
||||
xcb_reparent_window(globalconf.connection,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
globalconf.systray.window,
|
||||
s->root, -512, -512);
|
||||
|
||||
globalconf.screens.tab[0].systray.parent = s->root;
|
||||
globalconf.systray.parent = s->root;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ wibox_wipe_resources(wibox_t *w)
|
|||
/* Activate BMA */
|
||||
client_ignore_enterleave_events();
|
||||
/* Make sure we don't accidentally kill the systray window */
|
||||
if(globalconf.screens.tab[0].systray.parent == w->window)
|
||||
if(globalconf.systray.parent == w->window)
|
||||
wibox_systray_kickout();
|
||||
xcb_destroy_window(globalconf.connection, w->window);
|
||||
/* Deactivate BMA */
|
||||
|
@ -429,10 +429,10 @@ wibox_systray_refresh(wibox_t *wibox)
|
|||
{
|
||||
/* Set background of the systray window. */
|
||||
xcb_change_window_attributes(globalconf.connection,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
globalconf.systray.window,
|
||||
XCB_CW_BACK_PIXEL, config_back);
|
||||
/* Map it. */
|
||||
xcb_map_window(globalconf.connection, globalconf.screens.tab[0].systray.window);
|
||||
xcb_map_window(globalconf.connection, globalconf.systray.window);
|
||||
/* Move it. */
|
||||
switch(wibox->orientation)
|
||||
{
|
||||
|
@ -456,16 +456,16 @@ wibox_systray_refresh(wibox_t *wibox)
|
|||
break;
|
||||
}
|
||||
/* reparent */
|
||||
if(globalconf.screens.tab[0].systray.parent != wibox->window)
|
||||
if(globalconf.systray.parent != wibox->window)
|
||||
{
|
||||
xcb_reparent_window(globalconf.connection,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
globalconf.systray.window,
|
||||
wibox->window,
|
||||
config_win_vals[0], config_win_vals[1]);
|
||||
globalconf.screens.tab[0].systray.parent = wibox->window;
|
||||
globalconf.systray.parent = wibox->window;
|
||||
}
|
||||
xcb_configure_window(globalconf.connection,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
globalconf.systray.window,
|
||||
XCB_CONFIG_WINDOW_X
|
||||
| XCB_CONFIG_WINDOW_Y
|
||||
| XCB_CONFIG_WINDOW_WIDTH
|
||||
|
|
|
@ -72,7 +72,7 @@ systray_draw(widget_t *widget, draw_context_t *ctx,
|
|||
/* set wibox orientation */
|
||||
/** \todo stop setting that property on each redraw */
|
||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
globalconf.systray.window,
|
||||
_NET_SYSTEM_TRAY_ORIENTATION, XCB_ATOM_CARDINAL, 32, 1, &orient);
|
||||
}
|
||||
|
||||
|
|
9
screen.h
9
screen.h
|
@ -34,15 +34,6 @@ struct a_screen
|
|||
area_t geometry;
|
||||
/** Tag list */
|
||||
tag_array_t tags;
|
||||
/** Window that contains the systray */
|
||||
struct
|
||||
{
|
||||
xcb_window_t window;
|
||||
/** Systray window parent */
|
||||
xcb_window_t parent;
|
||||
/** Is awesome the systray owner? */
|
||||
bool registered;
|
||||
} systray;
|
||||
/** Previously focused client */
|
||||
client_t *prev_client_focus;
|
||||
/** Focused client */
|
||||
|
|
20
systray.c
20
systray.c
|
@ -41,9 +41,9 @@ systray_init(void)
|
|||
{
|
||||
xcb_screen_t *xscreen = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
|
||||
globalconf.screens.tab[0].systray.window = xcb_generate_id(globalconf.connection);
|
||||
globalconf.systray.window = xcb_generate_id(globalconf.connection);
|
||||
xcb_create_window(globalconf.connection, xscreen->root_depth,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
globalconf.systray.window,
|
||||
xscreen->root,
|
||||
-1, -1, 1, 1, 0,
|
||||
XCB_COPY_FROM_PARENT, xscreen->root_visual, 0, NULL);
|
||||
|
@ -81,9 +81,9 @@ systray_register(void)
|
|||
xcb_atom_t atom_systray;
|
||||
|
||||
/* Set registered even if it fails to don't try again unless forced */
|
||||
if(globalconf.screens.tab[0].systray.registered)
|
||||
if(globalconf.systray.registered)
|
||||
return;
|
||||
globalconf.screens.tab[0].systray.registered = true;
|
||||
globalconf.systray.registered = true;
|
||||
|
||||
/* Send requests */
|
||||
if(!(atom_name = xcb_atom_name_by_screen("_NET_SYSTEM_TRAY", globalconf.default_screen)))
|
||||
|
@ -104,7 +104,7 @@ systray_register(void)
|
|||
ev.format = 32;
|
||||
ev.type = MANAGER;
|
||||
ev.data.data32[0] = XCB_CURRENT_TIME;
|
||||
ev.data.data32[2] = globalconf.screens.tab[0].systray.window;
|
||||
ev.data.data32[2] = globalconf.systray.window;
|
||||
ev.data.data32[3] = ev.data.data32[4] = 0;
|
||||
|
||||
if(!(atom_systray_r = xcb_intern_atom_reply(globalconf.connection, atom_systray_q, NULL)))
|
||||
|
@ -118,7 +118,7 @@ systray_register(void)
|
|||
p_delete(&atom_systray_r);
|
||||
|
||||
xcb_set_selection_owner(globalconf.connection,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
globalconf.systray.window,
|
||||
atom_systray,
|
||||
XCB_CURRENT_TIME);
|
||||
|
||||
|
@ -133,9 +133,9 @@ systray_cleanup(void)
|
|||
xcb_intern_atom_reply_t *atom_systray_r;
|
||||
char *atom_name;
|
||||
|
||||
if(!globalconf.screens.tab[0].systray.registered)
|
||||
if(!globalconf.systray.registered)
|
||||
return;
|
||||
globalconf.screens.tab[0].systray.registered = false;
|
||||
globalconf.systray.registered = false;
|
||||
|
||||
if(!(atom_name = xcb_atom_name_by_screen("_NET_SYSTEM_TRAY", globalconf.default_screen))
|
||||
|| !(atom_systray_r = xcb_intern_atom_reply(globalconf.connection,
|
||||
|
@ -195,7 +195,7 @@ systray_request_handle(xcb_window_t embed_win, xembed_info_t *info)
|
|||
*/
|
||||
xcb_change_save_set(globalconf.connection, XCB_SET_MODE_INSERT, embed_win);
|
||||
xcb_reparent_window(globalconf.connection, embed_win,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
globalconf.systray.window,
|
||||
0, 0);
|
||||
|
||||
em.win = embed_win;
|
||||
|
@ -206,7 +206,7 @@ systray_request_handle(xcb_window_t embed_win, xembed_info_t *info)
|
|||
xembed_info_get_reply(globalconf.connection, em_cookie, &em.info);
|
||||
|
||||
xembed_embedded_notify(globalconf.connection, em.win,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
globalconf.systray.window,
|
||||
MIN(XEMBED_VERSION, em.info.version));
|
||||
|
||||
xembed_window_array_append(&globalconf.embedded, em);
|
||||
|
|
Loading…
Reference in New Issue