mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
event: handle background changes
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
946b38147e
commit
ede5a54355
5 changed files with 52 additions and 4 deletions
|
@ -484,7 +484,8 @@ main(int argc, char **argv)
|
|||
{
|
||||
XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY
|
||||
| XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW
|
||||
| XCB_EVENT_MASK_STRUCTURE_NOTIFY,
|
||||
| XCB_EVENT_MASK_STRUCTURE_NOTIFY
|
||||
| XCB_EVENT_MASK_PROPERTY_CHANGE,
|
||||
globalconf.cursor[CurNormal]
|
||||
};
|
||||
|
||||
|
|
|
@ -427,4 +427,21 @@ xutil_cursor_new(xcb_connection_t *conn, unsigned int cursor_font)
|
|||
return cursor;
|
||||
}
|
||||
|
||||
/** Convert a root window a physical screen ID.
|
||||
* \param connection The connection to the X server.
|
||||
* \param root Root window.
|
||||
* \return A physical screen number.
|
||||
*/
|
||||
int
|
||||
xutil_root2screen(xcb_connection_t *connection, xcb_window_t root)
|
||||
{
|
||||
xcb_screen_iterator_t iter;
|
||||
int phys_screen = 0;
|
||||
|
||||
for(iter = xcb_setup_roots_iterator(xcb_get_setup(connection));
|
||||
iter.rem && iter.data->root != root; xcb_screen_next(&iter), ++phys_screen);
|
||||
|
||||
return phys_screen;
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
|
@ -143,5 +143,7 @@ xutil_screen_get(xcb_connection_t *c, int screen)
|
|||
return s;
|
||||
}
|
||||
|
||||
int xutil_root2screen(xcb_connection_t *, xcb_window_t);
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
4
event.c
4
event.c
|
@ -511,7 +511,6 @@ event_handle_maprequest(void *data __attribute__ ((unused)),
|
|||
xcb_query_pointer_reply_t *qp_r = NULL;
|
||||
xcb_get_geometry_cookie_t geom_c;
|
||||
xcb_get_geometry_reply_t *geom_r;
|
||||
xcb_screen_iterator_t iter;
|
||||
|
||||
wa_c = xcb_get_window_attributes_unchecked(connection, ev->window);
|
||||
|
||||
|
@ -554,8 +553,7 @@ event_handle_maprequest(void *data __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
|
||||
for(iter = xcb_setup_roots_iterator(xcb_get_setup(connection)), phys_screen = 0;
|
||||
iter.rem && iter.data->root != geom_r->root; xcb_screen_next(&iter), ++phys_screen);
|
||||
phys_screen = xutil_root2screen(connection, geom_r->root);
|
||||
|
||||
if(globalconf.xinerama_is_active
|
||||
&& (qp_r = xcb_query_pointer_reply(connection, qp_c, NULL)))
|
||||
|
|
30
property.c
30
property.c
|
@ -321,6 +321,32 @@ property_handle_xembed_info(void *data __attribute__ ((unused)),
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
property_handle_xrootpmap_id(void *data __attribute__ ((unused)),
|
||||
xcb_connection_t *connection,
|
||||
uint8_t state,
|
||||
xcb_window_t window,
|
||||
xcb_atom_t name,
|
||||
xcb_get_property_reply_t *reply)
|
||||
{
|
||||
if(globalconf.xinerama_is_active)
|
||||
for(int screen = 0; screen < globalconf.nscreen; screen++)
|
||||
{
|
||||
wibox_array_t *w = &globalconf.screens[screen].wiboxes;
|
||||
for(int i = 0; i < w->len; i++)
|
||||
w->tab[i]->need_update = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
int screen = xutil_root2screen(connection, window);
|
||||
wibox_array_t *w = &globalconf.screens[screen].wiboxes;
|
||||
for(int i = 0; i < w->len; i++)
|
||||
w->tab[i]->need_update = true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void a_xcb_set_property_handlers(void)
|
||||
{
|
||||
/* init */
|
||||
|
@ -347,6 +373,10 @@ void a_xcb_set_property_handlers(void)
|
|||
property_handle_net_wm_strut_partial, NULL);
|
||||
xcb_property_set_handler(&globalconf.prophs, _NET_WM_ICON, UINT_MAX,
|
||||
property_handle_net_wm_icon, NULL);
|
||||
|
||||
/* background change */
|
||||
xcb_property_set_handler(&globalconf.prophs, _XROOTPMAP_ID, 1,
|
||||
property_handle_xrootpmap_id, NULL);
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
Loading…
Reference in a new issue