diff options
author | Arnaud Fontaine <arnau@debian.org> | 2009-12-15 23:14:38 +0100 |
---|---|---|
committer | Arnaud Fontaine <arnau@debian.org> | 2010-11-14 20:22:29 +0900 |
commit | ec400624bdfae62cf24c2263c02c4dba281c2d53 (patch) | |
tree | 5fdb7249a86ebae0830f7674c826c2cced2f8c8d /ewmh | |
parent | 53862f31246f7812cf1dd7e07dcada8c34f829e1 (diff) |
A given connection may have several screens associated
Diffstat (limited to 'ewmh')
-rw-r--r-- | ewmh/Makefile.am | 4 | ||||
-rw-r--r-- | ewmh/atomlist.m4 | 1 | ||||
-rw-r--r-- | ewmh/ewmh.c.m4 | 236 | ||||
-rw-r--r-- | ewmh/xcb-ewmh.pc.in | 2 | ||||
-rw-r--r-- | ewmh/xcb_ewmh.h.m4 | 232 |
5 files changed, 321 insertions, 154 deletions
diff --git a/ewmh/Makefile.am b/ewmh/Makefile.am index eb30fc5..42b3a40 100644 --- a/ewmh/Makefile.am +++ b/ewmh/Makefile.am @@ -7,8 +7,8 @@ xcbinclude_HEADERS = xcb_ewmh.h AM_CFLAGS = $(CWARNFLAGS) libxcb_ewmh_la_SOURCES = ewmh.c ewmh.c.m4 atomlist.m4 xcb_ewmh.h.m4 -libxcb_ewmh_la_CPPFLAGS = $(XCB_CFLAGS) $(XPROTO_CFLAGS) $(XCB_AUX_CFLAGS) -libxcb_ewmh_la_LIBADD = $(XCB_LIBS) $(XPROTO_LIBS) $(XCB_AUX_LIBS) +libxcb_ewmh_la_CPPFLAGS = $(XCB_CFLAGS) $(XPROTO_CFLAGS) +libxcb_ewmh_la_LIBADD = $(XCB_LIBS) $(XPROTO_LIBS) libxcb_ewmh_la_LDFLAGS = -version-info 1:0:0 pkgconfig_DATA = xcb-ewmh.pc diff --git a/ewmh/atomlist.m4 b/ewmh/atomlist.m4 index ffa0e7e..76e7636 100644 --- a/ewmh/atomlist.m4 +++ b/ewmh/atomlist.m4 @@ -43,7 +43,6 @@ _NET_WM_FULL_PLACEMENT, UTF8_STRING, WM_PROTOCOLS, MANAGER, -_NET_WM_CM_Sn, _NET_WM_WINDOW_TYPE_DESKTOP, _NET_WM_WINDOW_TYPE_DOCK, _NET_WM_WINDOW_TYPE_TOOLBAR, diff --git a/ewmh/ewmh.c.m4 b/ewmh/ewmh.c.m4 index 59e043e..0b3fb09 100644 --- a/ewmh/ewmh.c.m4 +++ b/ewmh/ewmh.c.m4 @@ -37,7 +37,6 @@ #include <xcb/xproto.h> #include "xcb_ewmh.h" -#include "xcb_aux.h" #include "../xcb-util-common.h" /** @@ -90,16 +89,20 @@ static ewmh_atom_t ewmh_atoms[] = {dnl #define DO_GET_ROOT_PROPERTY(fname, property, atype, length) \ xcb_get_property_cookie_t \ - xcb_ewmh_get_##fname(xcb_ewmh_connection_t *ewmh) \ + xcb_ewmh_get_##fname(xcb_ewmh_connection_t *ewmh, \ + int screen_nbr) \ { \ - return xcb_get_property(ewmh->connection, 0, ewmh->root, \ + return xcb_get_property(ewmh->connection, 0, \ + ewmh->screens[screen_nbr]->root, \ ewmh->property, atype, 0, length); \ } \ \ xcb_get_property_cookie_t \ - xcb_ewmh_get_##fname##_unchecked(xcb_ewmh_connection_t *ewmh) \ + xcb_ewmh_get_##fname##_unchecked(xcb_ewmh_connection_t *ewmh, \ + int screen_nbr) \ { \ - return xcb_get_property_unchecked(ewmh->connection, 0, ewmh->root, \ + return xcb_get_property_unchecked(ewmh->connection, 0, \ + ewmh->screens[screen_nbr]->root, \ ewmh->property, atype, 0, \ length); \ } @@ -188,20 +191,24 @@ DO_REPLY_SINGLE_VALUE(cardinal, XCB_ATOM_CARDINAL, uint32_t) \ xcb_void_cookie_t \ xcb_ewmh_set_##fname##_checked(xcb_ewmh_connection_t *ewmh, \ + int screen_nbr, \ ctype value) \ { \ return xcb_change_property_checked(ewmh->connection, \ XCB_PROP_MODE_REPLACE, \ - ewmh->root, ewmh->property, \ - atype, 32, 1, &value); \ + ewmh->screens[screen_nbr]->root, \ + ewmh->property, atype, 32, 1, \ + &value); \ } \ \ xcb_void_cookie_t \ xcb_ewmh_set_##fname(xcb_ewmh_connection_t *ewmh, \ + int screen_nbr, \ ctype value) \ { \ return xcb_change_property(ewmh->connection, XCB_PROP_MODE_REPLACE, \ - ewmh->root, ewmh->property, atype, \ + ewmh->screens[screen_nbr]->root, \ + ewmh->property, atype, \ 32, 1, &value); \ } @@ -268,24 +275,27 @@ DO_REPLY_SINGLE_VALUE(cardinal, XCB_ATOM_CARDINAL, uint32_t) \ xcb_void_cookie_t \ xcb_ewmh_set_##fname##_checked(xcb_ewmh_connection_t *ewmh, \ + int screen_nbr, \ uint32_t list_len, \ ctype *list) \ { \ return xcb_change_property_checked(ewmh->connection, \ XCB_PROP_MODE_REPLACE, \ - ewmh->root, ewmh->property, \ - atype, 32, \ + ewmh->screens[screen_nbr]->root, \ + ewmh->property, atype, 32, \ list_len * (sizeof(ctype) >> 2), \ list); \ } \ \ xcb_void_cookie_t \ xcb_ewmh_set_##fname(xcb_ewmh_connection_t *ewmh, \ + int screen_nbr, \ uint32_t list_len, \ ctype *list) \ { \ return xcb_change_property(ewmh->connection, XCB_PROP_MODE_REPLACE, \ - ewmh->root, ewmh->property, atype, 32, \ + ewmh->screens[screen_nbr]->root, \ + ewmh->property, atype, 32, \ list_len * (sizeof(ctype) >> 2), \ list); \ } @@ -410,23 +420,26 @@ xcb_ewmh_get_utf8_strings_reply_wipe(xcb_ewmh_get_utf8_strings_reply_t *data) \ xcb_void_cookie_t \ xcb_ewmh_set_##fname(xcb_ewmh_connection_t *ewmh, \ + int screen_nbr, \ uint32_t strings_len, \ const char *strings) \ { \ return xcb_change_property(ewmh->connection, XCB_PROP_MODE_REPLACE, \ - ewmh->root, ewmh->property, \ - ewmh->UTF8_STRING, 8, strings_len, \ - strings); \ + ewmh->screens[screen_nbr]->root, \ + ewmh->property, ewmh->UTF8_STRING, 8, \ + strings_len, strings); \ } \ \ xcb_void_cookie_t \ xcb_ewmh_set_##fname##_checked(xcb_ewmh_connection_t *ewmh, \ + int screen_nbr, \ uint32_t strings_len, \ const char *strings) \ { \ return xcb_change_property_checked(ewmh->connection, \ XCB_PROP_MODE_REPLACE, \ - ewmh->root, ewmh->property, \ + ewmh->screens[screen_nbr]->root, \ + ewmh->property, \ ewmh->UTF8_STRING, 8, \ strings_len, strings); \ } @@ -494,37 +507,53 @@ DO_REPLY_LIST_VALUES(atoms, XCB_ATOM_ATOM, xcb_atom_t) xcb_intern_atom_cookie_t * xcb_ewmh_init_atoms(xcb_connection_t *c, - xcb_ewmh_connection_t *ewmh, - const int screen_nbr) + xcb_ewmh_connection_t *ewmh) { + int screen_nbr, atom_nbr; + ewmh->connection = c; - xcb_screen_t *screen = xcb_aux_get_screen(ewmh->connection, screen_nbr); - if(!screen) - return NULL; + xcb_screen_iterator_t screen_iter = xcb_setup_roots_iterator(xcb_get_setup(c)); + xcb_screen_iterator_t iter; - /* Compute _NET_WM_CM_Sn according to the screen number 'n' */ - char wm_cm_sn[32]; - const int wm_cm_sn_len = snprintf(wm_cm_sn, 32, "_NET_WM_CM_S%d", - screen_nbr); + for(iter = screen_iter; iter.rem; xcb_screen_next(&iter)) + ewmh->nb_screens++; - assert(wm_cm_sn_len > 0 && wm_cm_sn_len < 32); + if(!ewmh->nb_screens) + return NULL; - ewmh->root = screen->root; + /* Allocate the data structures depending of the number of screens */ + ewmh->screens = malloc(sizeof(xcb_screen_t *) * ewmh->nb_screens); + ewmh->_NET_WM_CM_Sn = malloc(sizeof(xcb_atom_t) * ewmh->nb_screens); - xcb_intern_atom_cookie_t *ewmh_cookies = malloc(sizeof(xcb_intern_atom_cookie_t) * - NB_EWMH_ATOMS); + for(iter = screen_iter, screen_nbr = 0; iter.rem; xcb_screen_next(&iter)) + ewmh->screens[screen_nbr++] = iter.data; - uint8_t i; - for(i = 0; i < NB_EWMH_ATOMS; i++) + /* _NET_WM_CM_Sn atoms will be treated differently, by adding them + at the end of this array, than other atoms as it depends on the + number of screens */ + xcb_intern_atom_cookie_t *ewmh_cookies = malloc(sizeof(xcb_intern_atom_cookie_t) * + (NB_EWMH_ATOMS + ewmh->nb_screens)); + + /* First, send InternAtom request for all Atoms except _NET_WM_CM_Sn */ + for(atom_nbr = 0; atom_nbr < NB_EWMH_ATOMS; atom_nbr++) + ewmh_cookies[atom_nbr] = xcb_intern_atom(ewmh->connection, 0, + ewmh_atoms[atom_nbr].name_len, + ewmh_atoms[atom_nbr].name); + + /* Then, send InternAtom requests for _NET_WM_CM_Sn and compute + _NET_WM_CM_Sn according to the screen number 'n' */ + char wm_cm_sn[ewmh->nb_screens][32]; + for(screen_nbr = 0; screen_nbr < ewmh->nb_screens; screen_nbr++) { - if(strcmp(ewmh_atoms[i].name, "_NET_WM_CM_Sn") == 0) - ewmh_cookies[i] = xcb_intern_atom(ewmh->connection, 0, - wm_cm_sn_len, wm_cm_sn); - else - ewmh_cookies[i] = xcb_intern_atom(ewmh->connection, 0, - ewmh_atoms[i].name_len, - ewmh_atoms[i].name); + const int wm_cm_sn_len = snprintf(wm_cm_sn[screen_nbr], 32, + "_NET_WM_CM_S%d", screen_nbr); + + assert(wm_cm_sn_len > 0 && wm_cm_sn_len < 32); + + ewmh_cookies[atom_nbr++] = xcb_intern_atom(ewmh->connection, 0, + wm_cm_sn_len, + wm_cm_sn[screen_nbr]); } return ewmh_cookies; @@ -535,18 +564,30 @@ xcb_ewmh_init_atoms_replies(xcb_ewmh_connection_t *ewmh, xcb_intern_atom_cookie_t *ewmh_cookies, xcb_generic_error_t **e) { - uint8_t i, ret = 1; + int atom_nbr; + int screen_nbr = 0; + uint8_t ret = 1; xcb_intern_atom_reply_t *reply; - for(i = 0; i < NB_EWMH_ATOMS; i++) - if((reply = xcb_intern_atom_reply(ewmh->connection, ewmh_cookies[i], e))) + for(atom_nbr = 0; atom_nbr < NB_EWMH_ATOMS + ewmh->nb_screens; atom_nbr++) + if((reply = xcb_intern_atom_reply(ewmh->connection, ewmh_cookies[atom_nbr], e))) { - *((xcb_atom_t *) (((char *) ewmh) + ewmh_atoms[i].m_offset)) = reply->atom; + if(ret) + { + if(atom_nbr < NB_EWMH_ATOMS) + *((xcb_atom_t *) (((char *) ewmh) + ewmh_atoms[atom_nbr].m_offset)) = reply->atom; + else + ewmh->_NET_WM_CM_Sn[screen_nbr++] = reply->atom; + } + free(reply); } else ret = 0; + if(!ret) + xcb_ewmh_connection_wipe(ewmh); + free(ewmh_cookies); return ret; } @@ -582,34 +623,39 @@ DO_GET_ROOT_PROPERTY(desktop_geometry, _NET_DESKTOP_GEOMETRY, XCB_ATOM_CARDINAL, 2L) xcb_void_cookie_t -xcb_ewmh_set_desktop_geometry(xcb_ewmh_connection_t *ewmh, +xcb_ewmh_set_desktop_geometry(xcb_ewmh_connection_t *ewmh, int screen_nbr, uint32_t new_width, uint32_t new_height) { const uint32_t data[] = { new_width, new_height }; - return xcb_change_property(ewmh->connection, XCB_PROP_MODE_REPLACE, ewmh->root, + return xcb_change_property(ewmh->connection, XCB_PROP_MODE_REPLACE, + ewmh->screens[screen_nbr]->root, ewmh->_NET_DESKTOP_GEOMETRY, XCB_ATOM_CARDINAL, 32, 2, data); } xcb_void_cookie_t xcb_ewmh_set_desktop_geometry_checked(xcb_ewmh_connection_t *ewmh, - uint32_t new_width, uint32_t new_height) + int screen_nbr, uint32_t new_width, + uint32_t new_height) { const uint32_t data[] = { new_width, new_height }; return xcb_change_property_checked(ewmh->connection, XCB_PROP_MODE_REPLACE, - ewmh->root, ewmh->_NET_DESKTOP_GEOMETRY, + ewmh->screens[screen_nbr]->root, + ewmh->_NET_DESKTOP_GEOMETRY, XCB_ATOM_CARDINAL, 32, 2, data); } xcb_void_cookie_t xcb_ewmh_request_change_desktop_geometry(xcb_ewmh_connection_t *ewmh, - uint32_t new_width, uint32_t new_height) + int screen_nbr, uint32_t new_width, + uint32_t new_height) { const uint32_t data[] = { new_width, new_height }; - return xcb_ewmh_send_client_message(ewmh->connection, XCB_NONE, ewmh->root, + return xcb_ewmh_send_client_message(ewmh->connection, XCB_NONE, + ewmh->screens[screen_nbr]->root, ewmh->_NET_DESKTOP_GEOMETRY, sizeof(data), data); } @@ -654,11 +700,13 @@ DO_REPLY_LIST_VALUES(desktop_viewport, XCB_ATOM_CARDINAL, xcb_void_cookie_t xcb_ewmh_request_change_desktop_viewport(xcb_ewmh_connection_t *ewmh, - uint32_t x, uint32_t y) + int screen_nbr, uint32_t x, + uint32_t y) { const uint32_t data[] = { x, y }; - return xcb_ewmh_send_client_message(ewmh->connection, XCB_NONE, ewmh->root, + return xcb_ewmh_send_client_message(ewmh->connection, XCB_NONE, + ewmh->screens[screen_nbr]->root, ewmh->_NET_DESKTOP_VIEWPORT, sizeof(data), data); } @@ -672,12 +720,13 @@ DO_ROOT_SINGLE_VALUE(current_desktop, _NET_CURRENT_DESKTOP, XCB_ATOM_CARDINAL, xcb_void_cookie_t xcb_ewmh_request_change_current_desktop(xcb_ewmh_connection_t *ewmh, - uint32_t new_desktop, + int screen_nbr, uint32_t new_desktop, xcb_timestamp_t timestamp) { const uint32_t data[] = { new_desktop, timestamp }; - return xcb_ewmh_send_client_message(ewmh->connection, XCB_NONE, ewmh->root, + return xcb_ewmh_send_client_message(ewmh->connection, XCB_NONE, + ewmh->screens[screen_nbr]->root, ewmh->_NET_CURRENT_DESKTOP, sizeof(data), data); } @@ -696,6 +745,7 @@ DO_ROOT_SINGLE_VALUE(active_window, _NET_ACTIVE_WINDOW, XCB_ATOM_WINDOW, xcb_void_cookie_t xcb_ewmh_request_change_active_window(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t window_to_activate, xcb_ewmh_client_source_type_t source_indication, xcb_timestamp_t timestamp, @@ -704,8 +754,9 @@ xcb_ewmh_request_change_active_window(xcb_ewmh_connection_t *ewmh, const uint32_t data[] = { source_indication, timestamp, current_active_window }; return xcb_ewmh_send_client_message(ewmh->connection, window_to_activate, - ewmh->root, ewmh->_NET_ACTIVE_WINDOW, - sizeof(data), data); + ewmh->screens[screen_nbr]->root, + ewmh->_NET_ACTIVE_WINDOW, sizeof(data), + data); } /** @@ -739,20 +790,21 @@ DO_GET_ROOT_PROPERTY(desktop_layout, _NET_DESKTOP_LAYOUT, XCB_ATOM_CARDINAL, 4) DO_REPLY_STRUCTURE(desktop_layout, xcb_ewmh_get_desktop_layout_reply_t) xcb_void_cookie_t -xcb_ewmh_set_desktop_layout(xcb_ewmh_connection_t *ewmh, +xcb_ewmh_set_desktop_layout(xcb_ewmh_connection_t *ewmh, int screen_nbr, xcb_ewmh_desktop_layout_orientation_t orientation, uint32_t columns, uint32_t rows, xcb_ewmh_desktop_layout_starting_corner_t starting_corner) { const uint32_t data[] = { orientation, columns, rows, starting_corner }; - return xcb_change_property(ewmh->connection, XCB_PROP_MODE_REPLACE, ewmh->root, + return xcb_change_property(ewmh->connection, XCB_PROP_MODE_REPLACE, + ewmh->screens[screen_nbr]->root, ewmh->_NET_DESKTOP_LAYOUT, XCB_ATOM_CARDINAL, 32, countof(data), data); } xcb_void_cookie_t -xcb_ewmh_set_desktop_layout_checked(xcb_ewmh_connection_t *ewmh, +xcb_ewmh_set_desktop_layout_checked(xcb_ewmh_connection_t *ewmh, int screen_nbr, xcb_ewmh_desktop_layout_orientation_t orientation, uint32_t columns, uint32_t rows, xcb_ewmh_desktop_layout_starting_corner_t starting_corner) @@ -760,7 +812,8 @@ xcb_ewmh_set_desktop_layout_checked(xcb_ewmh_connection_t *ewmh, const uint32_t data[] = { orientation, columns, rows, starting_corner }; return xcb_change_property_checked(ewmh->connection, XCB_PROP_MODE_REPLACE, - ewmh->root, ewmh->_NET_DESKTOP_LAYOUT, + ewmh->screens[screen_nbr]->root, + ewmh->_NET_DESKTOP_LAYOUT, XCB_ATOM_CARDINAL, 32, countof(data), data); } @@ -777,7 +830,7 @@ DO_ROOT_SINGLE_VALUE(showing_desktop, _NET_SHOWING_DESKTOP, XCB_ATOM_CARDINAL, */ xcb_void_cookie_t -xcb_ewmh_request_close_window(xcb_ewmh_connection_t *ewmh, +xcb_ewmh_request_close_window(xcb_ewmh_connection_t *ewmh, int screen_nbr, xcb_window_t window_to_close, xcb_timestamp_t timestamp, xcb_ewmh_client_source_type_t source_indication) @@ -785,8 +838,9 @@ xcb_ewmh_request_close_window(xcb_ewmh_connection_t *ewmh, const uint32_t data[] = { timestamp, source_indication }; return xcb_ewmh_send_client_message(ewmh->connection, window_to_close, - ewmh->root, ewmh->_NET_CLOSE_WINDOW, - sizeof(data), data); + ewmh->screens[screen_nbr]->root, + ewmh->_NET_CLOSE_WINDOW, sizeof(data), + data); } /** @@ -795,7 +849,7 @@ xcb_ewmh_request_close_window(xcb_ewmh_connection_t *ewmh, /* x, y, width, height may be equal to -1 */ xcb_void_cookie_t -xcb_ewmh_request_moveresize_window(xcb_ewmh_connection_t *ewmh, +xcb_ewmh_request_moveresize_window(xcb_ewmh_connection_t *ewmh, int screen_nbr, xcb_window_t moveresize_window, xcb_gravity_t gravity, xcb_ewmh_client_source_type_t source_indication, @@ -807,7 +861,8 @@ xcb_ewmh_request_moveresize_window(xcb_ewmh_connection_t *ewmh, x, y, width, height }; return xcb_ewmh_send_client_message(ewmh->connection, moveresize_window, - ewmh->root, ewmh->_NET_MOVERESIZE_WINDOW, + ewmh->screens[screen_nbr]->root, + ewmh->_NET_MOVERESIZE_WINDOW, sizeof(data), data); } @@ -816,7 +871,7 @@ xcb_ewmh_request_moveresize_window(xcb_ewmh_connection_t *ewmh, */ xcb_void_cookie_t -xcb_ewmh_request_wm_moveresize(xcb_ewmh_connection_t *ewmh, +xcb_ewmh_request_wm_moveresize(xcb_ewmh_connection_t *ewmh, int screen_nbr, xcb_window_t moveresize_window, uint32_t x_root, uint32_t y_root, xcb_ewmh_moveresize_direction_t direction, @@ -826,8 +881,9 @@ xcb_ewmh_request_wm_moveresize(xcb_ewmh_connection_t *ewmh, const uint32_t data[] = { x_root, y_root, direction, button, source_indication }; return xcb_ewmh_send_client_message(ewmh->connection, moveresize_window, - ewmh->root, ewmh->_NET_WM_MOVERESIZE, - sizeof(data), data); + ewmh->screens[screen_nbr]->root, + ewmh->_NET_WM_MOVERESIZE, sizeof(data), + data); } /** @@ -835,7 +891,7 @@ xcb_ewmh_request_wm_moveresize(xcb_ewmh_connection_t *ewmh, */ xcb_void_cookie_t -xcb_ewmh_request_restack_window(xcb_ewmh_connection_t *ewmh, +xcb_ewmh_request_restack_window(xcb_ewmh_connection_t *ewmh, int screen_nbr, xcb_window_t window_to_restack, xcb_window_t sibling_window, xcb_stack_mode_t detail) @@ -844,8 +900,9 @@ xcb_ewmh_request_restack_window(xcb_ewmh_connection_t *ewmh, detail }; return xcb_ewmh_send_client_message(ewmh->connection, window_to_restack, - ewmh->root, ewmh->_NET_RESTACK_WINDOW, - sizeof(data), data); + ewmh->screens[screen_nbr]->root, + ewmh->_NET_RESTACK_WINDOW, sizeof(data), + data); } /** @@ -879,7 +936,7 @@ DO_UTF8_STRING(wm_visible_icon_name, _NET_WM_VISIBLE_ICON_NAME) DO_SINGLE_VALUE(wm_desktop, _NET_WM_DESKTOP, XCB_ATOM_CARDINAL, uint32_t) xcb_void_cookie_t -xcb_ewmh_request_change_wm_desktop(xcb_ewmh_connection_t *ewmh, +xcb_ewmh_request_change_wm_desktop(xcb_ewmh_connection_t *ewmh, int screen_nbr, xcb_window_t client_window, uint32_t new_desktop, xcb_ewmh_client_source_type_t source_indication) @@ -887,8 +944,9 @@ xcb_ewmh_request_change_wm_desktop(xcb_ewmh_connection_t *ewmh, const uint32_t data[] = { new_desktop, source_indication }; return xcb_ewmh_send_client_message(ewmh->connection, client_window, - ewmh->root, ewmh->_NET_WM_DESKTOP, - sizeof(data), data); + ewmh->screens[screen_nbr]->root, + ewmh->_NET_WM_DESKTOP, sizeof(data), + data); } /** @@ -908,7 +966,7 @@ DO_LIST_VALUES(wm_window_type, _NET_WM_WINDOW_TYPE, XCB_ATOM_ATOM, atom) DO_LIST_VALUES(wm_state, _NET_WM_STATE, XCB_ATOM_ATOM, atom) xcb_void_cookie_t -xcb_ewmh_request_change_wm_state(xcb_ewmh_connection_t *ewmh, +xcb_ewmh_request_change_wm_state(xcb_ewmh_connection_t *ewmh, int screen_nbr, xcb_window_t client_window, xcb_ewmh_wm_state_action_t action, xcb_atom_t first_property, @@ -918,7 +976,8 @@ xcb_ewmh_request_change_wm_state(xcb_ewmh_connection_t *ewmh, const uint32_t data[] = { action, first_property, second_property, source_indication }; - return xcb_ewmh_send_client_message(ewmh->connection, client_window, ewmh->root, + return xcb_ewmh_send_client_message(ewmh->connection, client_window, + ewmh->screens[screen_nbr]->root, ewmh->_NET_WM_STATE, sizeof(data), data); } @@ -1305,6 +1364,7 @@ DO_REPLY_STRUCTURE(wm_fullscreen_monitors, xcb_void_cookie_t xcb_ewmh_request_change_wm_fullscreen_monitors(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t window, uint32_t top, uint32_t bottom, uint32_t left, uint32_t right, @@ -1312,7 +1372,8 @@ xcb_ewmh_request_change_wm_fullscreen_monitors(xcb_ewmh_connection_t *ewmh, { const uint32_t data[] = { top, bottom, left, right, source_indication }; - return xcb_ewmh_send_client_message(ewmh->connection, window, ewmh->root, + return xcb_ewmh_send_client_message(ewmh->connection, window, + ewmh->screens[screen_nbr]->root, ewmh->_NET_WM_FULLSCREEN_MONITORS, sizeof(data), data); } @@ -1326,16 +1387,19 @@ xcb_ewmh_request_change_wm_fullscreen_monitors(xcb_ewmh_connection_t *ewmh, */ xcb_get_selection_owner_cookie_t -xcb_ewmh_get_wm_cm_owner(xcb_ewmh_connection_t *ewmh) +xcb_ewmh_get_wm_cm_owner(xcb_ewmh_connection_t *ewmh, + int screen_nbr) { - return xcb_get_selection_owner(ewmh->connection, ewmh->_NET_WM_CM_Sn); + return xcb_get_selection_owner(ewmh->connection, + ewmh->_NET_WM_CM_Sn[screen_nbr]); } xcb_get_selection_owner_cookie_t -xcb_ewmh_get_wm_cm_owner_unchecked(xcb_ewmh_connection_t *ewmh) +xcb_ewmh_get_wm_cm_owner_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr) { return xcb_get_selection_owner_unchecked(ewmh->connection, - ewmh->_NET_WM_CM_Sn); + ewmh->_NET_WM_CM_Sn[screen_nbr]); } uint8_t @@ -1365,6 +1429,7 @@ xcb_ewmh_get_wm_cm_owner_reply(xcb_ewmh_connection_t *ewmh, /* TODO: section 2.1, 2.2 */ static xcb_void_cookie_t set_wm_cm_owner_client_message(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t owner, xcb_timestamp_t timestamp, uint32_t selection_data1, @@ -1377,12 +1442,12 @@ set_wm_cm_owner_client_message(xcb_ewmh_connection_t *ewmh, ev.format = 32; ev.type = ewmh->MANAGER; ev.data.data32[0] = timestamp; - ev.data.data32[1] = ewmh->_NET_WM_CM_Sn; + ev.data.data32[1] = ewmh->_NET_WM_CM_Sn[screen_nbr]; ev.data.data32[2] = owner; ev.data.data32[3] = selection_data1; ev.data.data32[4] = selection_data2; - return xcb_send_event(ewmh->connection, 0, ewmh->root, + return xcb_send_event(ewmh->connection, 0, ewmh->screens[screen_nbr]->root, XCB_EVENT_MASK_STRUCTURE_NOTIFY, (char *) &ev); } @@ -1390,27 +1455,30 @@ set_wm_cm_owner_client_message(xcb_ewmh_connection_t *ewmh, /* TODO: check both */ xcb_void_cookie_t xcb_ewmh_set_wm_cm_owner(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t owner, xcb_timestamp_t timestamp, uint32_t selection_data1, uint32_t selection_data2) { - xcb_set_selection_owner(ewmh->connection, owner, ewmh->_NET_WM_CM_Sn, 0); + xcb_set_selection_owner(ewmh->connection, owner, + ewmh->_NET_WM_CM_Sn[screen_nbr], 0); - return set_wm_cm_owner_client_message(ewmh, owner, timestamp, + return set_wm_cm_owner_client_message(ewmh, screen_nbr, owner, timestamp, selection_data1, selection_data2); } xcb_void_cookie_t xcb_ewmh_set_wm_cm_owner_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t owner, xcb_timestamp_t timestamp, uint32_t selection_data1, uint32_t selection_data2) { xcb_set_selection_owner_checked(ewmh->connection, owner, - ewmh->_NET_WM_CM_Sn, 0); + ewmh->_NET_WM_CM_Sn[screen_nbr], 0); - return set_wm_cm_owner_client_message(ewmh, owner, timestamp, + return set_wm_cm_owner_client_message(ewmh, screen_nbr, owner, timestamp, selection_data1, selection_data2); } diff --git a/ewmh/xcb-ewmh.pc.in b/ewmh/xcb-ewmh.pc.in index 5d35963..84b1fa4 100644 --- a/ewmh/xcb-ewmh.pc.in +++ b/ewmh/xcb-ewmh.pc.in @@ -6,6 +6,6 @@ includedir=@includedir@ Name: XCB EWMH library Description: XCB EWMH binding Version: @PACKAGE_VERSION@ -Requires: xcb xcb-proto xcb-aux +Requires: xcb xcb-proto Libs: -L${libdir} -lxcb-ewmh @LIBS@ Cflags: -I${includedir} diff --git a/ewmh/xcb_ewmh.h.m4 b/ewmh/xcb_ewmh.h.m4 index f4fe745..1d059f1 100644 --- a/ewmh/xcb_ewmh.h.m4 +++ b/ewmh/xcb_ewmh.h.m4 @@ -58,8 +58,11 @@ extern "C" { typedef struct { /** The X connection */ xcb_connection_t *connection; - /** The root window of this connection */ - xcb_window_t root; + /** The screens on this connection */ + xcb_screen_t **screens; + int nb_screens; + /** _NET_WM_CM_Sn atoms depending on the number of screens */ + xcb_atom_t *_NET_WM_CM_Sn; /** The EWMH atoms of this connection */dnl define(`DO', `ifelse(`$1', , , ` xcb_atom_t $1;DO(shift($@))')')dnl @@ -345,8 +348,7 @@ typedef struct { * @return The cookies corresponding to EWMH atoms */ xcb_intern_atom_cookie_t *xcb_ewmh_init_atoms(xcb_connection_t *c, - xcb_ewmh_connection_t *ewmh, - const int screen_nbr); + xcb_ewmh_connection_t *ewmh); /** * @brief Process the replies to the screen initialisation requests @@ -361,6 +363,13 @@ uint8_t xcb_ewmh_init_atoms_replies(xcb_ewmh_connection_t *ewmh, xcb_intern_atom_cookie_t *ewmh_cookies, xcb_generic_error_t **e); +static inline void +xcb_ewmh_connection_wipe(xcb_ewmh_connection_t *ewmh) +{ + free(ewmh->screens); + free(ewmh->_NET_WM_CM_Sn); +} + /** * @brief Send a SendEvent request containing a ClientMessage event * @@ -515,11 +524,13 @@ void xcb_ewmh_get_utf8_strings_reply_wipe(xcb_ewmh_get_utf8_strings_reply_t *dat * _NET_SUPPORTED, ATOM[]/32 * * @param ewmh The per-screen EWMH information + * @param screen_nbr The screen number * @param list_len The number of Atoms supported by the WM * @param list The Atoms supported by the WM * @return Cookie associated with the ChangeProperty _NET_SUPPORTED request */ xcb_void_cookie_t xcb_ewmh_set_supported(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t list_len, xcb_atom_t *list); @@ -527,6 +538,7 @@ xcb_void_cookie_t xcb_ewmh_set_supported(xcb_ewmh_connection_t *ewmh, * @see xcb_ewmh_set_supported */ xcb_void_cookie_t xcb_ewmh_set_supported_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t list_len, xcb_atom_t *list); @@ -547,19 +559,17 @@ xcb_void_cookie_t xcb_ewmh_set_supported_checked(xcb_ewmh_connection_t *ewmh, * generated. Any returned error will be placed in the event queue. * * @param ewmh The information relative to EWMH + * @param screen_nbr The screen number * @return The _NET_SUPPORTED cookie of the GetProperty request */ -xcb_get_property_cookie_t xcb_ewmh_get_supported_unchecked(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_supported_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** - * @brief Send GetProperty request to get _NET_SUPPORTED root window - * property - * * @see xcb_ewmh_get_supported_unchecked - * @param ewmh The information relative to EWMH. - * @return The _NET_SUPPORTED cookie of the GetProperty request. */ -xcb_get_property_cookie_t xcb_ewmh_get_supported(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_supported(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @brief Get the list of supported atoms @@ -602,11 +612,13 @@ xcb_ewmh_get_supported_reply(xcb_ewmh_connection_t *ewmh, * _NET_CLIENT_LIST, WINDOW[]/32 * * @param ewmh The per-screen EWMH information + * @param screen_nbr The screen number * @param list_len The number of Atoms supported by the WM * @param list The Atoms supported by the WM * @return Cookie associated with the ChangeProperty _NET_CLIENT_LIST request */ xcb_void_cookie_t xcb_ewmh_set_client_list(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t list_len, xcb_window_t *list); @@ -614,6 +626,7 @@ xcb_void_cookie_t xcb_ewmh_set_client_list(xcb_ewmh_connection_t *ewmh, * @see xcb_ewmh_set_client_list */ xcb_void_cookie_t xcb_ewmh_set_client_list_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t list_len, xcb_window_t *list); @@ -629,7 +642,8 @@ xcb_void_cookie_t xcb_ewmh_set_client_list_checked(xcb_ewmh_connection_t *ewmh, * @param ewmh The information relative to EWMH. * @return The _NET_CLIENT_LIST cookie of the GetProperty request. */ -xcb_get_property_cookie_t xcb_ewmh_get_client_list_unchecked(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_client_list_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @brief Send GetProperty request to get _NET_CLIENT_LIST root window @@ -639,7 +653,8 @@ xcb_get_property_cookie_t xcb_ewmh_get_client_list_unchecked(xcb_ewmh_connection * @param ewmh The information relative to EWMH. * @return The _NET_CLIENT_LIST cookie of the GetProperty request. */ -xcb_get_property_cookie_t xcb_ewmh_get_client_list(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_client_list(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @brief Get the list of client windows from a GetProperty @@ -683,11 +698,13 @@ xcb_ewmh_get_client_list_reply(xcb_ewmh_connection_t *ewmh, * _NET_CLIENT_LIST_STACKING, WINDOW[]/32 * * @param ewmh The per-screen EWMH information + * @param screen_nbr The screen number * @param list_len The number of Atoms supported by the WM * @param list The Atoms supported by the WM * @return Cookie associated with the ChangeProperty _NET_CLIENT_LIST_STACKING request */ xcb_void_cookie_t xcb_ewmh_set_client_list_stacking(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t list_len, xcb_window_t *list); @@ -695,6 +712,7 @@ xcb_void_cookie_t xcb_ewmh_set_client_list_stacking(xcb_ewmh_connection_t *ewmh, * @see xcb_ewmh_set_client_list_stacking */ xcb_void_cookie_t xcb_ewmh_set_client_list_stacking_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t list_len, xcb_window_t *list); @@ -710,17 +728,14 @@ xcb_void_cookie_t xcb_ewmh_set_client_list_stacking_checked(xcb_ewmh_connection_ * @param ewmh The information relative to EWMH * @return The _NET_CLIENT_LIST_STACKING cookie of the GetProperty request */ -xcb_get_property_cookie_t xcb_ewmh_get_client_list_stacking_unchecked(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_client_list_stacking_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** - * @brief Send GetProperty request to get _NET_CLIENT_LIST_STACKING - * root window property - * * @see xcb_ewmh_get_client_list_unchecked - * @param ewmh The information relative to EWMH - * @return The _NET_CLIENT_LIST_STACKING cookie of the GetProperty request */ -xcb_get_property_cookie_t xcb_ewmh_get_client_list_stacking(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_client_list_stacking(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @brief Get the list of client windows from a GetProperty @@ -765,31 +780,37 @@ xcb_ewmh_get_client_list_stacking_reply(xcb_ewmh_connection_t *ewmh, * _NET_NUMBER_OF_DESKTOPS? CARDINAL/32 * * @param ewmh The per-screen EWMH information + * @param screen_nbr The screen number * @param number_of_desktops The number of desktops * @return Cookie associated with the ChangeProperty _NET_NUMBER_OF_DESKTOPS request */ xcb_void_cookie_t xcb_ewmh_set_number_of_desktops(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t number_of_desktops); /** * @see xcb_ewmh_set_number_of_desktops */ xcb_void_cookie_t xcb_ewmh_set_number_of_desktops_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t number_of_desktops); /** * @brief Send GetProperty request to get _NET_NUMBER_OF_DESKTOPS root * window property * - * @param ewmh The information relative to EWMH. + * @param ewmh The information relative to EWMH + * @param screen_nbr The screen number * @return The _NET_NUMBER_OF_DESKTOPS cookie of the GetProperty request. */ -xcb_get_property_cookie_t xcb_ewmh_get_number_of_desktops_unchecked(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_number_of_desktops_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @see xcb_ewmh_get_number_of_desktops_unchecked */ -xcb_get_property_cookie_t xcb_ewmh_get_number_of_desktops(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_number_of_desktops(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @brief Get the list of client windows from a GetProperty @@ -830,9 +851,11 @@ xcb_ewmh_get_number_of_desktops_reply(xcb_ewmh_connection_t *ewmh, static inline xcb_void_cookie_t xcb_ewmh_request_change_number_of_desktops(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t new_number_of_desktops) { - return xcb_ewmh_send_client_message(ewmh->connection, XCB_NONE, ewmh->root, + return xcb_ewmh_send_client_message(ewmh->connection, XCB_NONE, + ewmh->screens[screen_nbr]->root, ewmh->_NET_NUMBER_OF_DESKTOPS, sizeof(new_number_of_desktops), &new_number_of_desktops); @@ -844,11 +867,13 @@ xcb_ewmh_request_change_number_of_desktops(xcb_ewmh_connection_t *ewmh, * _NET_DESKTOP_GEOMETRY width, height, CARDINAL[2]/32 * * @param ewmh The per-screen EWMH information + * @param screen_nbr The screen number * @param new_width The new desktop width * @param new_height The new desktop height * @return Cookie associated with the ChangeProperty _NET_DESKTOP_GEOMETRY request */ xcb_void_cookie_t xcb_ewmh_set_desktop_geometry(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t new_width, uint32_t new_height); @@ -856,6 +881,7 @@ xcb_void_cookie_t xcb_ewmh_set_desktop_geometry(xcb_ewmh_connection_t *ewmh, * @see xcb_ewmh_set_desktop_geometry */ xcb_void_cookie_t xcb_ewmh_set_desktop_geometry_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t new_width, uint32_t new_height); @@ -864,24 +890,29 @@ xcb_void_cookie_t xcb_ewmh_set_desktop_geometry_checked(xcb_ewmh_connection_t *e * window property * * @param ewmh The information relative to EWMH + * @param screen_nbr The screen number * @return The _NET_DESKTOP_GEOMETRY cookie of the GetProperty request */ -xcb_get_property_cookie_t xcb_ewmh_get_desktop_geometry_unchecked(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_desktop_geometry_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @see xcb_ewmh_get_desktop_geometry_unchecked */ -xcb_get_property_cookie_t xcb_ewmh_get_desktop_geometry(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_desktop_geometry(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @brief Send ClientMessage requesting to change the _NET_DESKTOP_GEOMETRY * * @param ewmh The per-screen EWMH information + * @param screen_nbr The screen number * @param new_width The new desktop width * @param new_height The new desktop height * @return The SendEvent cookie */ xcb_void_cookie_t xcb_ewmh_request_change_desktop_geometry(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t new_width, uint32_t new_height); @@ -923,11 +954,13 @@ uint8_t xcb_ewmh_get_desktop_geometry_reply(xcb_ewmh_connection_t *ewmh, * _NET_DESKTOP_VIEWPORT x, y, CARDINAL[][2]/32 * * @param ewmh The per-screen EWMH information + * @param screen_nbr The screen number * @param list_len The number of desktop viewports * @param list The desktop viewports * @return Cookie associated with the ChangeProperty _NET_DESKTOP_VIEWPORT request */ xcb_void_cookie_t xcb_ewmh_set_desktop_viewport(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t list_len, xcb_ewmh_coordinates_t *list); @@ -935,6 +968,7 @@ xcb_void_cookie_t xcb_ewmh_set_desktop_viewport(xcb_ewmh_connection_t *ewmh, * @see xcb_ewmh_set_desktop_viewport */ xcb_void_cookie_t xcb_ewmh_set_desktop_viewport_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t list_len, xcb_ewmh_coordinates_t *list); @@ -943,24 +977,29 @@ xcb_void_cookie_t xcb_ewmh_set_desktop_viewport_checked(xcb_ewmh_connection_t *e * window property * * @param ewmh The information relative to EWMH + * @param screen_nbr The screen number * @return The _NET_DESKTOP_VIEWPORT cookie of the GetProperty request */ -xcb_get_property_cookie_t xcb_ewmh_get_desktop_viewport_unchecked(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_desktop_viewport_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @see xcb_ewmh_get_desktop_viewport_unchecked */ -xcb_get_property_cookie_t xcb_ewmh_get_desktop_viewport(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_desktop_viewport(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @brief Send ClientMessage requesting to change the _NET_DESKTOP_VIEWPORT * * @param ewmh The per-screen EWMH information + * @param screen_nbr The screen number * @param new_x The new x coordinate * @param new_y The new y coordinate * @return The SendEvent cookie */ xcb_void_cookie_t xcb_ewmh_request_change_desktop_viewport(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t x, uint32_t y); /** @@ -1009,16 +1048,19 @@ void xcb_ewmh_get_desktop_viewport_reply_wipe(xcb_ewmh_get_desktop_viewport_repl * _NET_CURRENT_DESKTOP desktop, CARDINAL/32 * * @param ewmh The per-screen EWMH information + * @param screen_nbr The screen number * @param new_current_desktop The new current desktop * @return Cookie associated with the ChangeProperty _NET_CURRENT_DESKTOP request */ xcb_void_cookie_t xcb_ewmh_set_current_desktop(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t new_current_desktop); /** * @see xcb_ewmh_set_current_desktop */ xcb_void_cookie_t xcb_ewmh_set_current_desktop_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t new_current_desktop); /** @@ -1026,24 +1068,29 @@ xcb_void_cookie_t xcb_ewmh_set_current_desktop_checked(xcb_ewmh_connection_t *ew * window property * * @param ewmh The information relative to EWMH + * @param screen_nbr The screen number * @return The _NET_CURRENT_DESKTOP cookie of the GetProperty request */ -xcb_get_property_cookie_t xcb_ewmh_get_current_desktop_unchecked(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_current_desktop_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @see xcb_ewmh_get_current_desktop_unchecked */ -xcb_get_property_cookie_t xcb_ewmh_get_current_desktop(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_current_desktop(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @brief Send ClientMessage requesting to change the _NET_CURRENT_DESKTOP * * @param ewmh The per-screen EWMH information + * @param screen_nbr The screen number * @param new_desktop The new current desktop * @param timestamp The request timestamp * @return The SendEvent cookie */ xcb_void_cookie_t xcb_ewmh_request_change_current_desktop(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t new_desktop, xcb_timestamp_t timestamp); @@ -1090,11 +1137,13 @@ xcb_ewmh_get_current_desktop_reply(xcb_ewmh_connection_t *ewmh, * _NET_DESKTOP_NAMES, UTF8_STRING[] * * @param ewmh The per-screen EWMH information + * @param screen_nbr The screen number * @param strings_len The number of desktop names * @param strings The desktop names * @return Cookie associated with the ChangeProperty _NET_DESKTOP_NAMES request */ xcb_void_cookie_t xcb_ewmh_set_desktop_names(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t strings_len, const char *strings); @@ -1102,6 +1151,7 @@ xcb_void_cookie_t xcb_ewmh_set_desktop_names(xcb_ewmh_connection_t *ewmh, * @see xcb_ewmh_set_desktop_names */ xcb_void_cookie_t xcb_ewmh_set_desktop_names_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t strings_len, const char *strings); @@ -1112,12 +1162,14 @@ xcb_void_cookie_t xcb_ewmh_set_desktop_names_checked(xcb_ewmh_connection_t *ewmh * @param ewmh The information relative to EWMH * @return The _NET_DESKTOP_NAMES cookie of the GetProperty request */ -xcb_get_property_cookie_t xcb_ewmh_get_desktop_names_unchecked(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_desktop_names_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @see xcb_ewmh_get_desktop_names_unchecked */ -xcb_get_property_cookie_t xcb_ewmh_get_desktop_names(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_desktop_names(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @brief Get the desktop geometry from a GetProperty @@ -1164,16 +1216,19 @@ xcb_ewmh_get_desktop_names_reply(xcb_ewmh_connection_t *ewmh, * _NET_ACTIVE_WINDOW, WINDOW/32 * * @param ewmh The per-screen EWMH information + * @param screen_nbr The screen number * @param new_active_window The window to make active * @return Cookie associated with the ChangeProperty _NET_ACTIVE_WINDOW request */ xcb_void_cookie_t xcb_ewmh_set_active_window(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t new_active_window); /** * @see xcb_ewmh_set_active_window */ xcb_void_cookie_t xcb_ewmh_set_active_window_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t new_active_window); /** @@ -1190,13 +1245,15 @@ xcb_void_cookie_t xcb_ewmh_set_active_window_checked(xcb_ewmh_connection_t *ewmh * active window to another). * * @see xcb_ewmh_client_source_type_t - * @param ewmh The information relative to EWMH. - * @param window_to_active The window ID to activate. - * @param source_indication The source indication. - * @param timestamp The client's last user activity timestamp. + * @param ewmh The information relative to EWMH + * @param screen_nbr The screen number + * @param window_to_active The window ID to activate + * @param source_indication The source indication + * @param timestamp The client's last user activity timestamp * @param current_active_window The currently active window or None */ xcb_void_cookie_t xcb_ewmh_request_change_active_window(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t window_to_activate, xcb_ewmh_client_source_type_t source_indication, xcb_timestamp_t timestamp, @@ -1214,20 +1271,24 @@ xcb_void_cookie_t xcb_ewmh_request_change_active_window(xcb_ewmh_connection_t *e * This form can be used only if the request will cause a reply to be * generated. Any returned error will be placed in the event queue. * - * @param ewmh The information relative to EWMH. - * @return The _NET_ACTIVE_WINDOW cookie of the GetProperty request. + * @param ewmh The information relative to EWMH + * @param screen_nbr The screen number + * @return The _NET_ACTIVE_WINDOW cookie of the GetProperty request */ -xcb_get_property_cookie_t xcb_ewmh_get_active_window_unchecked(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_active_window_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @brief Send GetProperty request to get _NET_ACTIVE_WINDOW root * window property * * @see xcb_ewmh_get_active_window_unchecked - * @param ewmh The information relative to EWMH. - * @return The _NET_ACTIVE_WINDOW cookie of the GetProperty request. + * @param ewmh The information relative to EWMH + * @param screen_nbr The screen number + * @return The _NET_ACTIVE_WINDOW cookie of the GetProperty request */ -xcb_get_property_cookie_t xcb_ewmh_get_active_window(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_active_window(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @brief Get the list of client windows from a GetProperty @@ -1272,11 +1333,13 @@ xcb_ewmh_get_active_window_reply(xcb_ewmh_connection_t *ewmh, * _NET_WORKAREA, x, y, width, height CARDINAL[][4]/32 * * @param ewmh The per-screen EWMH information + * @param screen_nbr The screen number * @param list_len The number of desktops workareas * @param list The desktops workareas * @return Cookie associated with the ChangeProperty _NET_WORKAREA request */ xcb_void_cookie_t xcb_ewmh_set_workarea(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t list_len, xcb_ewmh_geometry_t *list); @@ -1284,6 +1347,7 @@ xcb_void_cookie_t xcb_ewmh_set_workarea(xcb_ewmh_connection_t *ewmh, * @see xcb_ewmh_set_workarea */ xcb_void_cookie_t xcb_ewmh_set_workarea_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t list_len, xcb_ewmh_geometry_t *list); @@ -1292,14 +1356,17 @@ xcb_void_cookie_t xcb_ewmh_set_workarea_checked(xcb_ewmh_connection_t *ewmh, * window property * * @param ewmh The information relative to EWMH + * @param screen_nbr The screen number * @return The _NET_WORKAREA cookie of the GetProperty request */ -xcb_get_property_cookie_t xcb_ewmh_get_workarea_unchecked(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_workarea_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @see xcb_ewmh_get_virtual_roots_unchecked */ -xcb_get_property_cookie_t xcb_ewmh_get_workarea(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_workarea(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @brief Get the desktop geometry from a GetProperty _NET_WORKAREA @@ -1347,16 +1414,19 @@ void xcb_ewmh_get_workarea_reply_wipe(xcb_ewmh_get_workarea_reply_t *r); * _NET_SUPPORTING_WM_CHECK, WINDOW/32 * * @param ewmh The per-screen EWMH information + * @param screen_nbr The screen number * @param new_window The child window created by the WM * @return Cookie associated with the ChangeProperty _NET_SUPPORTING_WM_CHECK request */ xcb_void_cookie_t xcb_ewmh_set_supporting_wm_check(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t new_window); /** * @see xcb_ewmh_set_supporting_wm_check */ xcb_void_cookie_t xcb_ewmh_set_supporting_wm_check_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t new_window); /** @@ -1364,14 +1434,17 @@ xcb_void_cookie_t xcb_ewmh_set_supporting_wm_check_checked(xcb_ewmh_connection_t * root window property * * @param ewmh The information relative to EWMH + * @param screen_nbr The screen number * @return The _NET_SUPPORTING_WM_CHECK cookie of the GetProperty request */ -xcb_get_property_cookie_t xcb_ewmh_get_supporting_wm_check_unchecked(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_supporting_wm_check_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @see xcb_ewmh_get_supporting_wm_check_unchecked */ -xcb_get_property_cookie_t xcb_ewmh_get_supporting_wm_check(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_supporting_wm_check(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @brief Get the list of client windows from a GetProperty @@ -1417,11 +1490,13 @@ xcb_ewmh_get_supporting_wm_check_reply(xcb_ewmh_connection_t *ewmh, * _NET_VIRTUAL_ROOTS, WINDOW[]/32 * * @param ewmh The per-screen EWMH information + * @param screen_nbr The screen number * @param list_len The number of virtual root windows * @param list The virtual root windows * @return Cookie associated with the ChangeProperty _NET_VIRTUAL_ROOTS request */ xcb_void_cookie_t xcb_ewmh_set_virtual_roots(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t list_len, xcb_window_t *list); @@ -1429,6 +1504,7 @@ xcb_void_cookie_t xcb_ewmh_set_virtual_roots(xcb_ewmh_connection_t *ewmh, * @see xcb_ewmh_set_virtual_roots */ xcb_void_cookie_t xcb_ewmh_set_virtual_roots_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t list_len, xcb_window_t *list); @@ -1437,14 +1513,17 @@ xcb_void_cookie_t xcb_ewmh_set_virtual_roots_checked(xcb_ewmh_connection_t *ewmh * window property * * @param ewmh The information relative to EWMH + * @param screen_nbr The screen number * @return The _NET_VIRTUAL_ROOTS cookie of the GetProperty request */ -xcb_get_property_cookie_t xcb_ewmh_get_virtual_roots_unchecked(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_virtual_roots_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @see xcb_ewmh_get_virtual_roots_unchecked */ -xcb_get_property_cookie_t xcb_ewmh_get_virtual_roots(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_virtual_roots(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @brief Get the desktop geometry from a GetProperty _NET_WORKAREA @@ -1484,11 +1563,13 @@ xcb_ewmh_get_virtual_roots_reply(xcb_ewmh_connection_t *ewmh, } xcb_void_cookie_t xcb_ewmh_set_desktop_layout(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_ewmh_desktop_layout_orientation_t orientation, uint32_t columns, uint32_t rows, xcb_ewmh_desktop_layout_starting_corner_t starting_corner); xcb_void_cookie_t xcb_ewmh_set_desktop_layout_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_ewmh_desktop_layout_orientation_t orientation, uint32_t columns, uint32_t rows, xcb_ewmh_desktop_layout_starting_corner_t starting_corner); @@ -1498,14 +1579,17 @@ xcb_void_cookie_t xcb_ewmh_set_desktop_layout_checked(xcb_ewmh_connection_t *ewm * window property * * @param ewmh The information relative to EWMH + * @param screen_nbr The screen number * @return The _NET_DESKTOP_LAYOUT cookie of the GetProperty request */ -xcb_get_property_cookie_t xcb_ewmh_get_desktop_layout_unchecked(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_desktop_layout_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** * @see xcb_ewmh_get_desktop_layout_unchecked */ -xcb_get_property_cookie_t xcb_ewmh_get_desktop_layout(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_desktop_layout(xcb_ewmh_connection_t *ewmh, + int screen_nbr); uint8_t xcb_ewmh_get_desktop_layout_from_reply(xcb_ewmh_get_desktop_layout_reply_t *desktop_layouts, xcb_get_property_reply_t *r); @@ -1516,14 +1600,18 @@ uint8_t xcb_ewmh_get_desktop_layout_reply(xcb_ewmh_connection_t *ewmh, xcb_generic_error_t **e); xcb_void_cookie_t xcb_ewmh_set_showing_desktop(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t desktop); xcb_void_cookie_t xcb_ewmh_set_showing_desktop_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t desktop); -xcb_get_property_cookie_t xcb_ewmh_get_showing_desktop_unchecked(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_showing_desktop_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr); -xcb_get_property_cookie_t xcb_ewmh_get_showing_desktop(xcb_ewmh_connection_t *ewmh); +xcb_get_property_cookie_t xcb_ewmh_get_showing_desktop(xcb_ewmh_connection_t *ewmh, + int screen_nbr); static inline uint8_t xcb_ewmh_get_showing_desktop_from_reply(uint32_t *desktop, @@ -1543,19 +1631,23 @@ xcb_ewmh_get_showing_desktop_reply(xcb_ewmh_connection_t *ewmh, static inline xcb_void_cookie_t xcb_ewmh_request_change_showing_desktop(xcb_ewmh_connection_t *ewmh, + int screen_nbr, uint32_t enter) { - return xcb_ewmh_send_client_message(ewmh->connection, XCB_NONE, ewmh->root, + return xcb_ewmh_send_client_message(ewmh->connection, XCB_NONE, + ewmh->screens[screen_nbr]->root, ewmh->_NET_SHOWING_DESKTOP, sizeof(enter), &enter); } xcb_void_cookie_t xcb_ewmh_request_close_window(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t window_to_close, xcb_timestamp_t timestamp, xcb_ewmh_client_source_type_t source_indication); xcb_void_cookie_t xcb_ewmh_request_moveresize_window(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t moveresize_window, xcb_gravity_t gravity, xcb_ewmh_client_source_type_t source_indication, @@ -1564,6 +1656,7 @@ xcb_void_cookie_t xcb_ewmh_request_moveresize_window(xcb_ewmh_connection_t *ewmh uint32_t width, uint32_t height); xcb_void_cookie_t xcb_ewmh_request_wm_moveresize(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t moveresize_window, uint32_t x_root, uint32_t y_root, xcb_ewmh_moveresize_direction_t direction, @@ -1571,15 +1664,18 @@ xcb_void_cookie_t xcb_ewmh_request_wm_moveresize(xcb_ewmh_connection_t *ewmh, xcb_ewmh_client_source_type_t source_indication); xcb_void_cookie_t xcb_ewmh_request_restack_window(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t window_to_restack, xcb_window_t sibling_window, xcb_stack_mode_t detail); static inline xcb_void_cookie_t xcb_ewmh_request_frame_extents(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t client_window) { - return xcb_ewmh_send_client_message(ewmh->connection, client_window, ewmh->root, + return xcb_ewmh_send_client_message(ewmh->connection, client_window, + ewmh->screens[screen_nbr]->root, ewmh->_NET_REQUEST_FRAME_EXTENTS, 0, NULL); } @@ -1746,6 +1842,7 @@ xcb_ewmh_get_wm_desktop_reply(xcb_ewmh_connection_t *ewmh, } xcb_void_cookie_t xcb_ewmh_request_change_wm_desktop(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t client_window, uint32_t new_desktop, xcb_ewmh_client_source_type_t source_indication); @@ -1799,6 +1896,7 @@ uint8_t xcb_ewmh_get_wm_state_reply(xcb_ewmh_connection_t *ewmh, xcb_generic_error_t **e); xcb_void_cookie_t xcb_ewmh_request_change_wm_state(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t client_window, xcb_ewmh_wm_state_action_t action, xcb_atom_t first_property, @@ -2130,6 +2228,7 @@ uint8_t xcb_ewmh_get_wm_fullscreen_monitors_reply(xcb_ewmh_connection_t *ewmh, xcb_void_cookie_t xcb_ewmh_request_change_wm_fullscreen_monitors(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t window, uint32_t top, uint32_t bottom, uint32_t left, uint32_t right, @@ -2142,13 +2241,15 @@ xcb_void_cookie_t xcb_ewmh_request_change_wm_fullscreen_monitors(xcb_ewmh_connec * ownership of a selection named _NET_WM_CM_Sn, where n is the screen * number. * - * @param ewmh The information relative to EWMH. - * @param owner The new owner of _NET_WM_CM_Sn selection. - * @param timestamp The client's last user activity timestamp. + * @param ewmh The information relative to EWMH + * @param screen_nbr The screen number + * @param owner The new owner of _NET_WM_CM_Sn selection + * @param timestamp The client's last user activity timestamp * @param selection_data1 Optional data described by ICCCM * @param selection_data2 Optional data described by ICCCM */ xcb_void_cookie_t xcb_ewmh_set_wm_cm_owner(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t owner, xcb_timestamp_t timestamp, uint32_t selection_data1, @@ -2158,6 +2259,7 @@ xcb_void_cookie_t xcb_ewmh_set_wm_cm_owner(xcb_ewmh_connection_t *ewmh, * @see xcb_ewmh_set_wm_cm_owner */ xcb_void_cookie_t xcb_ewmh_set_wm_cm_owner_checked(xcb_ewmh_connection_t *ewmh, + int screen_nbr, xcb_window_t owner, xcb_timestamp_t timestamp, uint32_t selection_data1, @@ -2167,20 +2269,18 @@ xcb_void_cookie_t xcb_ewmh_set_wm_cm_owner_checked(xcb_ewmh_connection_t *ewmh, * @brief Send GetSelectOwner request to get the owner of * _NET_WM_CM_Sn root window property * - * @param ewmh The information relative to EWMH. - * @return The _NET_WM_CM_Sn cookie of the GetSelectionOwner request. + * @param ewmh The information relative to EWMH + * @param screen_nbr The screen number + * @return The _NET_WM_CM_Sn cookie of the GetSelectionOwner request */ -xcb_get_selection_owner_cookie_t xcb_ewmh_get_wm_cm_owner_unchecked(xcb_ewmh_connection_t *ewmh); +xcb_get_selection_owner_cookie_t xcb_ewmh_get_wm_cm_owner_unchecked(xcb_ewmh_connection_t *ewmh, + int screen_nbr); /** - * @brief Send GetSelectOwner request to get the owner of - * _NET_WM_CM_Sn root window property - * * @see xcb_ewmh_get_wm_cm_owner_unchecked - * @param ewmh The information relative to EWMH. - * @return The _NET_WM_CM_Sn cookie of the GetSelectionOwner request. */ -xcb_get_selection_owner_cookie_t xcb_ewmh_get_wm_cm_owner(xcb_ewmh_connection_t *ewmh); +xcb_get_selection_owner_cookie_t xcb_ewmh_get_wm_cm_owner(xcb_ewmh_connection_t *ewmh, + int screen_nbr); uint8_t xcb_ewmh_get_wm_cm_owner_from_reply(xcb_window_t *owner, xcb_get_selection_owner_reply_t *r); |