Prefix xutil functions properly

This commit is contained in:
Arnaud Fontaine 2008-03-26 18:58:30 +00:00 committed by Julien Danjou
parent 1eab0e44e7
commit 02c99fccb8
17 changed files with 78 additions and 84 deletions

View File

@ -847,16 +847,13 @@ main(int argc, char **argv)
if(xcb_connection_has_error(globalconf.connection)) if(xcb_connection_has_error(globalconf.connection))
eprint("unable to open display"); eprint("unable to open display");
/* Get the numlock mask */
globalconf.numlockmask = xgetnumlockmask(globalconf.connection);
si = screensinfo_new(globalconf.connection); si = screensinfo_new(globalconf.connection);
if(si->xinerama_is_active) if(si->xinerama_is_active)
{ {
if((xqp = xcb_query_pointer_reply(globalconf.connection, if((xqp = xcb_query_pointer_reply(globalconf.connection,
xcb_query_pointer(globalconf.connection, xcb_query_pointer(globalconf.connection,
root_window(globalconf.connection, xutil_root_window(globalconf.connection,
globalconf.default_screen)), globalconf.default_screen)),
NULL)) != NULL) NULL)) != NULL)
{ {
screen = screen_get_bycoord(si, 0, xqp->root_x, xqp->root_y); screen = screen_get_bycoord(si, 0, xqp->root_x, xqp->root_y);
@ -924,7 +921,7 @@ main(int argc, char **argv)
globalconf.keysyms = xcb_key_symbols_alloc(globalconf.connection); globalconf.keysyms = xcb_key_symbols_alloc(globalconf.connection);
/* Get the numlock, capslock and shiftlock mask */ /* Get the numlock, capslock and shiftlock mask */
xutil_get_lock_mask(conn, globalconf.keysyms, &globalconf.numlockmask, xutil_get_lock_mask(globalconf.connection, globalconf.keysyms, &globalconf.numlockmask,
&globalconf.shiftlockmask, &globalconf.capslockmask); &globalconf.shiftlockmask, &globalconf.capslockmask);
xutil_map_raised(globalconf.connection, globalconf.sw->window); xutil_map_raised(globalconf.connection, globalconf.sw->window);

View File

@ -174,8 +174,8 @@ main(int argc, char **argv)
{ {
if((xqp = xcb_query_pointer_reply(globalconf.connection, if((xqp = xcb_query_pointer_reply(globalconf.connection,
xcb_query_pointer(globalconf.connection, xcb_query_pointer(globalconf.connection,
root_window(globalconf.connection, xutil_root_window(globalconf.connection,
globalconf.default_screen)), globalconf.default_screen)),
NULL)) != NULL) NULL)) != NULL)
{ {
screen = screen_get_bycoord(si, 0, xqp->root_x, xqp->root_y); screen = screen_get_bycoord(si, 0, xqp->root_x, xqp->root_y);

View File

@ -112,7 +112,7 @@ scan()
for(screen = 0; screen < screen_max; screen++) for(screen = 0; screen < screen_max; screen++)
{ {
w = root_window(globalconf.connection, screen); w = xutil_root_window(globalconf.connection, screen);
/* Get parent geometry informations, useful to get the real /* Get parent geometry informations, useful to get the real
* coordinates of the window because Xlib set 'x' and 'y' * coordinates of the window because Xlib set 'x' and 'y'
@ -389,13 +389,10 @@ main(int argc, char *argv[])
for(screen_nbr = 0; for(screen_nbr = 0;
screen_nbr < xcb_setup_roots_length(xcb_get_setup(conn)); screen_nbr < xcb_setup_roots_length(xcb_get_setup(conn));
screen_nbr++) screen_nbr++)
{ /* this causes an error if some other window manager is running */
/* this causes an error if some other window manager is
* running */
xcb_change_window_attributes(conn, xcb_change_window_attributes(conn,
root_window(conn, screen_nbr), xutil_root_window(conn, screen_nbr),
XCB_CW_EVENT_MASK, &select_input_val); XCB_CW_EVENT_MASK, &select_input_val);
}
/* need to xcb_flush to validate error handler */ /* need to xcb_flush to validate error handler */
xcb_aux_sync(conn); xcb_aux_sync(conn);
@ -462,7 +459,7 @@ main(int argc, char *argv[])
screen_nbr++) screen_nbr++)
{ {
xcb_change_window_attributes(globalconf.connection, xcb_change_window_attributes(globalconf.connection,
root_window(globalconf.connection, screen_nbr), xutil_root_window(globalconf.connection, screen_nbr),
XCB_CW_EVENT_MASK | XCB_CW_CURSOR, XCB_CW_EVENT_MASK | XCB_CW_CURSOR,
change_win_vals); change_win_vals);
ewmh_set_supported_hints(screen_nbr); ewmh_set_supported_hints(screen_nbr);

View File

@ -63,7 +63,7 @@ client_loadprops(Client * c, int screen)
prop = p_new(char, ntags + 3); prop = p_new(char, ntags + 3);
if(xgettextprop(globalconf.connection, c->win, if(xgettextprop(globalconf.connection, c->win,
x_intern_atom(globalconf.connection, "_AWESOME_PROPERTIES"), xutil_intern_atom(globalconf.connection, "_AWESOME_PROPERTIES"),
prop, ntags + 3)) prop, ntags + 3))
{ {
for(i = 0, tag = globalconf.screens[screen].tags; tag && i < ntags && prop[i]; i++, tag = tag->next) for(i = 0, tag = globalconf.screens[screen].tags; tag && i < ntags && prop[i]; i++, tag = tag->next)
@ -99,7 +99,7 @@ client_isprotodel(xcb_connection_t *c, xcb_window_t win)
if(xcb_get_wm_protocols(c, win, &n, &protocols)) if(xcb_get_wm_protocols(c, win, &n, &protocols))
{ {
for(i = 0; !ret && i < n; i++) for(i = 0; !ret && i < n; i++)
if(protocols[i] == x_intern_atom(c, "WM_DELETE_WINDOW")) if(protocols[i] == xutil_intern_atom(c, "WM_DELETE_WINDOW"))
ret = true; ret = true;
p_delete(&protocols); p_delete(&protocols);
} }
@ -144,9 +144,9 @@ void
client_updatetitle(Client *c) client_updatetitle(Client *c)
{ {
if(!xgettextprop(globalconf.connection, c->win, if(!xgettextprop(globalconf.connection, c->win,
x_intern_atom(globalconf.connection, "_NET_WM_NAME"), c->name, sizeof(c->name))) xutil_intern_atom(globalconf.connection, "_NET_WM_NAME"), c->name, sizeof(c->name)))
xgettextprop(globalconf.connection, c->win, xgettextprop(globalconf.connection, c->win,
x_intern_atom(globalconf.connection, "WM_NAME"), c->name, sizeof(c->name)); xutil_intern_atom(globalconf.connection, "WM_NAME"), c->name, sizeof(c->name));
titlebar_draw(c); titlebar_draw(c);
@ -233,7 +233,7 @@ client_focus(Client *c, int screen, bool raise)
phys_screen = screen_virttophys(screen); phys_screen = screen_virttophys(screen);
xcb_set_input_focus(globalconf.connection, xcb_set_input_focus(globalconf.connection,
XCB_INPUT_FOCUS_POINTER_ROOT, XCB_INPUT_FOCUS_POINTER_ROOT,
root_window(globalconf.connection, phys_screen), xutil_root_window(globalconf.connection, phys_screen),
XCB_CURRENT_TIME); XCB_CURRENT_TIME);
} }
@ -379,7 +379,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen)
} }
/* check for transient and set tags like its parent */ /* check for transient and set tags like its parent */
if((rettrans = x_get_transient_for_hint(globalconf.connection, w, &trans)) if((rettrans = xutil_get_transient_for_hint(globalconf.connection, w, &trans))
&& (t = client_get_bywin(globalconf.clients, trans))) && (t = client_get_bywin(globalconf.clients, trans)))
for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next) for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next)
if(is_client_tagged(t, tag)) if(is_client_tagged(t, tag))
@ -638,7 +638,7 @@ client_saveprops(Client *c)
prop[++i] = '\0'; prop[++i] = '\0';
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, c->win, xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, c->win,
x_intern_atom(globalconf.connection, "_AWESOME_PROPERTIES"), xutil_intern_atom(globalconf.connection, "_AWESOME_PROPERTIES"),
STRING, 8, i, (unsigned char *) prop); STRING, 8, i, (unsigned char *) prop);
p_delete(&prop); p_delete(&prop);
@ -691,7 +691,7 @@ client_unmanage(Client *c)
void void
client_updatewmhints(Client *c) client_updatewmhints(Client *c)
{ {
xcb_wm_hints_t *wmh; xcb_wm_hints_t *wmh = NULL;
if((wmh = xcb_get_wm_hints(globalconf.connection, c->win))) if((wmh = xcb_get_wm_hints(globalconf.connection, c->win)))
{ {
@ -799,7 +799,7 @@ uicb_client_settrans(int screen __attribute__ ((unused)), char *arg)
prop_r = xcb_get_property_reply(globalconf.connection, prop_r = xcb_get_property_reply(globalconf.connection,
xcb_get_property_unchecked(globalconf.connection, xcb_get_property_unchecked(globalconf.connection,
false, sel->win, false, sel->win,
x_intern_atom(globalconf.connection, "_NET_WM_WINDOW_OPACITY"), xutil_intern_atom(globalconf.connection, "_NET_WM_WINDOW_OPACITY"),
CARDINAL, CARDINAL,
0, 1), 0, 1),
NULL); NULL);
@ -927,7 +927,7 @@ uicb_client_moveresize(int screen, char *arg)
xqp = xcb_query_pointer_reply(globalconf.connection, xqp = xcb_query_pointer_reply(globalconf.connection,
xcb_query_pointer_unchecked(globalconf.connection, xcb_query_pointer_unchecked(globalconf.connection,
root_window(globalconf.connection, sel->phys_screen)), xutil_root_window(globalconf.connection, sel->phys_screen)),
NULL); NULL);
if(globalconf.screens[sel->screen].resize_hints) if(globalconf.screens[sel->screen].resize_hints)
geometry = client_geometry_hints(sel, geometry); geometry = client_geometry_hints(sel, geometry);
@ -961,9 +961,9 @@ client_kill(Client *c)
if(client_isprotodel(globalconf.connection, c->win)) if(client_isprotodel(globalconf.connection, c->win))
{ {
ev.window = c->win; ev.window = c->win;
ev.type = x_intern_atom(globalconf.connection, "WM_PROTOCOLS"); ev.type = xutil_intern_atom(globalconf.connection, "WM_PROTOCOLS");
ev.data.data32[0] = x_intern_atom(globalconf.connection, "WM_DELETE_WINDOW"); ev.data.data32[0] = xutil_intern_atom(globalconf.connection, "WM_DELETE_WINDOW");
ev.data.data32[1] = XCB_CURRENT_TIME; ev.data.data32[1] = XCB_CURRENT_TIME;
/* TODO: really useful? */ /* TODO: really useful? */

View File

@ -62,7 +62,7 @@ simplewindow_new(xcb_connection_t *conn, int phys_screen, int x, int y,
sw->window = xcb_generate_id(conn); sw->window = xcb_generate_id(conn);
xcb_create_window(conn, s->root_depth, sw->window, xcb_create_window(conn, s->root_depth, sw->window,
root_window(conn, phys_screen), xutil_root_window(conn, phys_screen),
x, y, w, h, border_width, x, y, w, h, border_width,
XCB_COPY_FROM_PARENT, XCB_COPY_FROM_PARENT,
s->root_visual, s->root_visual,
@ -71,7 +71,7 @@ simplewindow_new(xcb_connection_t *conn, int phys_screen, int x, int y,
sw->drawable = xcb_generate_id(conn); sw->drawable = xcb_generate_id(conn);
xcb_create_pixmap(conn, s->root_depth, sw->drawable, xcb_create_pixmap(conn, s->root_depth, sw->drawable,
root_window(conn, phys_screen), w, h); xutil_root_window(conn, phys_screen), w, h);
return sw; return sw;
} }
@ -120,7 +120,7 @@ simplewindow_resize(SimpleWindow *sw, unsigned int w, unsigned int h)
xcb_free_pixmap(sw->connection, sw->drawable); xcb_free_pixmap(sw->connection, sw->drawable);
sw->drawable = xcb_generate_id(sw->connection); sw->drawable = xcb_generate_id(sw->connection);
xcb_create_pixmap(sw->connection, s->root_depth, sw->drawable, xcb_create_pixmap(sw->connection, s->root_depth, sw->drawable,
root_window(sw->connection, sw->phys_screen), w, h); xutil_root_window(sw->connection, sw->phys_screen), w, h);
xcb_configure_window(sw->connection, sw->window, xcb_configure_window(sw->connection, sw->window,
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
resize_win_vals); resize_win_vals);

View File

@ -112,7 +112,7 @@ xutil_get_lock_mask(xcb_connection_t *conn, xcb_key_symbols_t *keysyms,
* \return return true if successfull * \return return true if successfull
*/ */
bool bool
x_get_transient_for_hint(xcb_connection_t *c, xcb_window_t win, xutil_get_transient_for_hint(xcb_connection_t *c, xcb_window_t win,
xcb_window_t *prop_win) xcb_window_t *prop_win)
{ {
xcb_get_property_reply_t *r; xcb_get_property_reply_t *r;
@ -141,13 +141,13 @@ x_get_transient_for_hint(xcb_connection_t *c, xcb_window_t win,
} }
xcb_window_t xcb_window_t
root_window(xcb_connection_t *c, int screen_number) xutil_root_window(xcb_connection_t *c, int screen_number)
{ {
return xcb_aux_get_screen(c, screen_number)->root; return xcb_aux_get_screen(c, screen_number)->root;
} }
xcb_atom_t xcb_atom_t
x_intern_atom(xcb_connection_t *c, const char *property) xutil_intern_atom(xcb_connection_t *c, const char *property)
{ {
xcb_atom_t atom; xcb_atom_t atom;
xcb_intern_atom_reply_t *r_atom; xcb_intern_atom_reply_t *r_atom;
@ -166,7 +166,7 @@ x_intern_atom(xcb_connection_t *c, const char *property)
} }
class_hint_t * class_hint_t *
x_get_class_hint(xcb_connection_t *conn, xcb_window_t win) xutil_get_class_hint(xcb_connection_t *conn, xcb_window_t win)
{ {
xcb_get_property_reply_t *r = NULL; xcb_get_property_reply_t *r = NULL;
char *data = NULL; char *data = NULL;
@ -182,7 +182,7 @@ x_get_class_hint(xcb_connection_t *conn, xcb_window_t win)
STRING, 0L, 2048), STRING, 0L, 2048),
NULL); NULL);
if(!r || r->type != STRING || r->format == 8) if(!r || r->type != STRING || r->format != 8)
return NULL; return NULL;
data = xcb_get_property_value(r); data = xcb_get_property_value(r);

View File

@ -78,8 +78,8 @@ void xutil_get_lock_mask(xcb_connection_t *, xcb_key_symbols_t *,
/* End of macros not defined in XCB */ /* End of macros not defined in XCB */
/* Common function defined in Xlib but not in XCB */ /* Common function defined in Xlib but not in XCB */
bool x_get_transient_for_hint(xcb_connection_t *, xcb_window_t, xcb_window_t *); bool xutil_get_transient_for_hint(xcb_connection_t *, xcb_window_t, xcb_window_t *);
xcb_window_t root_window(xcb_connection_t *, int); xcb_window_t xutil_root_window(xcb_connection_t *, int);
typedef struct _class_hint_t typedef struct _class_hint_t
{ {
@ -95,14 +95,14 @@ typedef struct
uint16_t blue; uint16_t blue;
} xcolor_t; } xcolor_t;
class_hint_t *x_get_class_hint(xcb_connection_t *, xcb_window_t); class_hint_t *xutil_get_class_hint(xcb_connection_t *, xcb_window_t);
/* Equivalent call to XInternAtom /* Equivalent call to XInternAtom
* *
* WARNING: should not be used in loop, in this case, it should send * WARNING: should not be used in loop, in this case, it should send
* the queries first and then treat the answer as late as possible) * the queries first and then treat the answer as late as possible)
*/ */
xcb_atom_t x_intern_atom(xcb_connection_t *, const char *); xcb_atom_t xutil_intern_atom(xcb_connection_t *, const char *);
/* Equivalent XCB call to XMapRaised, which actually raises the /* Equivalent XCB call to XMapRaised, which actually raises the
specified window to the top of the stack and maps it */ specified window to the top of the stack and maps it */

16
event.c
View File

@ -154,7 +154,7 @@ event_handle_buttonpress(void *data __attribute__ ((unused)),
} }
else else
for(screen = 0; screen < xcb_setup_roots_length(xcb_get_setup (connection)); screen++) for(screen = 0; screen < xcb_setup_roots_length(xcb_get_setup (connection)); screen++)
if(root_window(connection, screen) == ev->event if(xutil_root_window(connection, screen) == ev->event
&& (qr = xcb_query_pointer_reply(connection, && (qr = xcb_query_pointer_reply(connection,
xcb_query_pointer(connection, ev->event), xcb_query_pointer(connection, ev->event),
NULL)) != NULL) NULL)) != NULL)
@ -274,7 +274,7 @@ event_handle_configurenotify(void *data __attribute__ ((unused)),
const xcb_screen_t *screen; const xcb_screen_t *screen;
for(screen_nbr = 0; screen_nbr < xcb_setup_roots_length(xcb_get_setup (connection)); screen_nbr++) for(screen_nbr = 0; screen_nbr < xcb_setup_roots_length(xcb_get_setup (connection)); screen_nbr++)
if(ev->window == root_window(connection, screen_nbr) if(ev->window == xutil_root_window(connection, screen_nbr)
&& (screen = xcb_aux_get_screen(connection, screen_nbr)) != NULL && (screen = xcb_aux_get_screen(connection, screen_nbr)) != NULL
&& (ev->width != screen->width_in_pixels && (ev->width != screen->width_in_pixels
|| ev->height != screen->height_in_pixels)) || ev->height != screen->height_in_pixels))
@ -336,7 +336,7 @@ event_handle_enternotify(void *data __attribute__ ((unused)),
} }
else else
for(screen = 0; screen < xcb_setup_roots_length(xcb_get_setup(connection)); screen++) for(screen = 0; screen < xcb_setup_roots_length(xcb_get_setup(connection)); screen++)
if(ev->event == root_window(connection, screen)) if(ev->event == xutil_root_window(connection, screen))
{ {
window_root_grabbuttons(screen); window_root_grabbuttons(screen);
return 0; return 0;
@ -395,7 +395,7 @@ event_handle_keypress(void *data __attribute__ ((unused)),
for(screen = 0; screen < xcb_setup_roots_length (xcb_get_setup (connection)); screen++) for(screen = 0; screen < xcb_setup_roots_length (xcb_get_setup (connection)); screen++)
if((qpr = xcb_query_pointer_reply(connection, if((qpr = xcb_query_pointer_reply(connection,
xcb_query_pointer(connection, xcb_query_pointer(connection,
root_window(connection, screen)), xutil_root_window(connection, screen)),
NULL)) != NULL) NULL)) != NULL)
{ {
/* if screen is 0, we are on first Zaphod screen or on the /* if screen is 0, we are on first Zaphod screen or on the
@ -466,7 +466,7 @@ event_handle_maprequest(void *data __attribute__ ((unused)),
if(globalconf.screens_info->xinerama_is_active if(globalconf.screens_info->xinerama_is_active
&& (qpr = xcb_query_pointer_reply(connection, && (qpr = xcb_query_pointer_reply(connection,
xcb_query_pointer(connection, xcb_query_pointer(connection,
root_window(globalconf.connection, screen_nbr)), xutil_root_window(globalconf.connection, screen_nbr)),
NULL)) != NULL) NULL)) != NULL)
screen_nbr = screen_get_bycoord(globalconf.screens_info, screen_nbr, qpr->root_x, qpr->root_y); screen_nbr = screen_get_bycoord(globalconf.screens_info, screen_nbr, qpr->root_x, qpr->root_y);
else else
@ -500,7 +500,7 @@ event_handle_propertynotify(void *data __attribute__ ((unused)),
{ {
if(ev->atom == WM_TRANSIENT_FOR) if(ev->atom == WM_TRANSIENT_FOR)
{ {
x_get_transient_for_hint(connection, c->win, &trans); xutil_get_transient_for_hint(connection, c->win, &trans);
if(!c->isfloating if(!c->isfloating
&& (c->isfloating = (client_get_bywin(globalconf.clients, trans) != NULL))) && (c->isfloating = (client_get_bywin(globalconf.clients, trans) != NULL)))
globalconf.screens[c->screen].need_arrange = true; globalconf.screens[c->screen].need_arrange = true;
@ -510,7 +510,7 @@ event_handle_propertynotify(void *data __attribute__ ((unused)),
else if (ev->atom == WM_HINTS) else if (ev->atom == WM_HINTS)
client_updatewmhints(c); client_updatewmhints(c);
if(ev->atom == WM_NAME || ev->atom == x_intern_atom(globalconf.connection, "_NET_WM_NAME")) if(ev->atom == WM_NAME || ev->atom == xutil_intern_atom(globalconf.connection, "_NET_WM_NAME"))
client_updatetitle(c); client_updatetitle(c);
} }
@ -535,7 +535,7 @@ event_handle_unmapnotify(void *data __attribute__ ((unused)),
bool send_event = ((ev->response_type & 0x80) >> 7); bool send_event = ((ev->response_type & 0x80) >> 7);
if((c = client_get_bywin(globalconf.clients, ev->window)) if((c = client_get_bywin(globalconf.clients, ev->window))
&& ev->event == root_window(connection, c->phys_screen) && ev->event == xutil_root_window(connection, c->phys_screen)
&& send_event && window_getstate(c->win) == XCB_WM_NORMAL_STATE) && send_event && window_getstate(c->win) == XCB_WM_NORMAL_STATE)
client_unmanage(c); client_unmanage(c);

14
ewmh.c
View File

@ -157,7 +157,7 @@ ewmh_set_supported_hints(int phys_screen)
atom[i++] = net_wm_state_below; atom[i++] = net_wm_state_below;
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
root_window(globalconf.connection, phys_screen), xutil_root_window(globalconf.connection, phys_screen),
net_supported, ATOM, 32, i, atom); net_supported, ATOM, 32, i, atom);
} }
@ -178,7 +178,7 @@ ewmh_update_net_client_list(int phys_screen)
wins[n] = c->win; wins[n] = c->win;
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
root_window(globalconf.connection, phys_screen), xutil_root_window(globalconf.connection, phys_screen),
net_client_list, WINDOW, 32, n, wins); net_client_list, WINDOW, 32, n, wins);
p_delete(&wins); p_delete(&wins);
@ -194,7 +194,7 @@ ewmh_update_net_numbers_of_desktop(int phys_screen)
count++; count++;
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
root_window(globalconf.connection, phys_screen), xutil_root_window(globalconf.connection, phys_screen),
net_number_of_desktops, CARDINAL, 32, 1, &count); net_number_of_desktops, CARDINAL, 32, 1, &count);
} }
@ -208,7 +208,7 @@ ewmh_update_net_current_desktop(int phys_screen)
count++; count++;
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
root_window(globalconf.connection, phys_screen), xutil_root_window(globalconf.connection, phys_screen),
net_current_desktop, CARDINAL, 32, 1, &count); net_current_desktop, CARDINAL, 32, 1, &count);
p_delete(&curtags); p_delete(&curtags);
@ -232,7 +232,7 @@ ewmh_update_net_desktop_names(int phys_screen)
} }
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
root_window(globalconf.connection, phys_screen), xutil_root_window(globalconf.connection, phys_screen),
net_desktop_names, utf8_string, 8, len, buf); net_desktop_names, utf8_string, 8, len, buf);
} }
@ -245,7 +245,7 @@ ewmh_update_net_active_window(int phys_screen)
win = sel ? sel->win : XCB_NONE; win = sel ? sel->win : XCB_NONE;
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
root_window(globalconf.connection, phys_screen), xutil_root_window(globalconf.connection, phys_screen),
net_active_window, WINDOW, 32, 1, &win); net_active_window, WINDOW, 32, 1, &win);
} }
@ -362,7 +362,7 @@ ewmh_process_client_message(xcb_client_message_event_t *ev)
screen < xcb_setup_roots_length(xcb_get_setup(globalconf.connection)); screen < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
screen++) screen++)
{ {
if(ev->window == root_window(globalconf.connection, screen)) if(ev->window == xutil_root_window(globalconf.connection, screen))
tag_view_only_byindex(screen, ev->data.data32[0]); tag_view_only_byindex(screen, ev->data.data32[0]);
} }

View File

@ -80,8 +80,8 @@ arrange(int screen)
/* check that the mouse is on a window or not */ /* check that the mouse is on a window or not */
if((xqp = xcb_query_pointer_reply(globalconf.connection, if((xqp = xcb_query_pointer_reply(globalconf.connection,
xcb_query_pointer_unchecked(globalconf.connection, xcb_query_pointer_unchecked(globalconf.connection,
root_window(globalconf.connection, xutil_root_window(globalconf.connection,
phys_screen)), phys_screen)),
NULL)) != NULL NULL)) != NULL
&& (xqp->root == XCB_NONE || xqp->child == XCB_NONE || xqp->root == xqp->child)) && (xqp->root == XCB_NONE || xqp->child == XCB_NONE || xqp->root == xqp->child))
{ {

12
mouse.c
View File

@ -151,16 +151,16 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
if(!c if(!c
|| xcb_grab_pointer_reply(globalconf.connection, || xcb_grab_pointer_reply(globalconf.connection,
xcb_grab_pointer(globalconf.connection, false, xcb_grab_pointer(globalconf.connection, false,
root_window(globalconf.connection, c->phys_screen), xutil_root_window(globalconf.connection, c->phys_screen),
MOUSEMASK, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, MOUSEMASK, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC,
root_window(globalconf.connection, c->phys_screen), xutil_root_window(globalconf.connection, c->phys_screen),
globalconf.cursor[CurMove], XCB_CURRENT_TIME), globalconf.cursor[CurMove], XCB_CURRENT_TIME),
NULL)) NULL))
return; return;
query_pointer_r = xcb_query_pointer_reply(globalconf.connection, query_pointer_r = xcb_query_pointer_reply(globalconf.connection,
xcb_query_pointer_unchecked(globalconf.connection, xcb_query_pointer_unchecked(globalconf.connection,
root_window(globalconf.connection, c->phys_screen)), xutil_root_window(globalconf.connection, c->phys_screen)),
NULL); NULL);
geometry = c->geometry; geometry = c->geometry;
@ -230,7 +230,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
{ {
mquery_pointer_r = xcb_query_pointer_reply(globalconf.connection, mquery_pointer_r = xcb_query_pointer_reply(globalconf.connection,
xcb_query_pointer_unchecked(globalconf.connection, xcb_query_pointer_unchecked(globalconf.connection,
root_window(globalconf.connection, c->phys_screen)), xutil_root_window(globalconf.connection, c->phys_screen)),
NULL); NULL);
if((newscreen = screen_get_bycoord(globalconf.screens_info, c->screen, if((newscreen = screen_get_bycoord(globalconf.screens_info, c->screen,
mquery_pointer_r->root_x, mquery_pointer_r->root_x,
@ -336,9 +336,9 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
return; return;
grab_pointer_c = xcb_grab_pointer(globalconf.connection, false, grab_pointer_c = xcb_grab_pointer(globalconf.connection, false,
root_window(globalconf.connection, c->phys_screen), xutil_root_window(globalconf.connection, c->phys_screen),
MOUSEMASK, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, MOUSEMASK, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC,
root_window(globalconf.connection, c->phys_screen), xutil_root_window(globalconf.connection, c->phys_screen),
globalconf.cursor[CurResize], XCB_CURRENT_TIME); globalconf.cursor[CurResize], XCB_CURRENT_TIME);
if(layout->arrange == layout_floating || c->isfloating) if(layout->arrange == layout_floating || c->isfloating)

View File

@ -133,7 +133,7 @@ placement_under_mouse(Client *c)
if((xqp = xcb_query_pointer_reply(globalconf.connection, if((xqp = xcb_query_pointer_reply(globalconf.connection,
xcb_query_pointer(globalconf.connection, xcb_query_pointer(globalconf.connection,
root_window(globalconf.connection, c->phys_screen)), xutil_root_window(globalconf.connection, c->phys_screen)),
NULL)) != NULL) NULL)) != NULL)
{ {
finalgeometry.x = xqp->root_x - c->f_geometry.width / 2; finalgeometry.x = xqp->root_x - c->f_geometry.width / 2;

View File

@ -53,7 +53,7 @@ client_match_rule(Client *c, Rule *r)
if(r->prop_r) if(r->prop_r)
{ {
/* first try to match on name */ /* first try to match on name */
ch = x_get_class_hint(globalconf.connection, c->win); ch = xutil_get_class_hint(globalconf.connection, c->win);
if (!ch) if (!ch)
return false; return false;
@ -82,7 +82,7 @@ client_match_rule(Client *c, Rule *r)
if(r->xprop if(r->xprop
&& r->xpropval_r && r->xpropval_r
&& xgettextprop(globalconf.connection, c->win, && xgettextprop(globalconf.connection, c->win,
x_intern_atom(globalconf.connection, r->xprop), xutil_intern_atom(globalconf.connection, r->xprop),
buf, ssizeof(buf))) buf, ssizeof(buf)))
ret = !regexec(r->xpropval_r, buf, 1, &tmp, 0); ret = !regexec(r->xpropval_r, buf, 1, &tmp, 0);

View File

@ -229,7 +229,7 @@ move_mouse_pointer_to_screen(int phys_screen)
else else
xcb_warp_pointer(globalconf.connection, xcb_warp_pointer(globalconf.connection,
XCB_NONE, XCB_NONE,
root_window(globalconf.connection, phys_screen), xutil_root_window(globalconf.connection, phys_screen),
0, 0, 0, 0, 0, 0); 0, 0, 0, 0, 0, 0);
} }

View File

@ -243,7 +243,7 @@ statusbar_init(Statusbar *statusbar)
dw = xcb_generate_id(globalconf.connection); dw = xcb_generate_id(globalconf.connection);
xcb_create_pixmap(globalconf.connection, xcb_create_pixmap(globalconf.connection,
s->root_depth, dw, s->root_depth, dw,
root_window(globalconf.connection, phys_screen), xutil_root_window(globalconf.connection, phys_screen),
statusbar->width, statusbar->height); statusbar->width, statusbar->height);
statusbar->ctx = draw_context_new(globalconf.connection, statusbar->ctx = draw_context_new(globalconf.connection,
phys_screen, phys_screen,

View File

@ -172,7 +172,7 @@ titlebar_draw(Client *c)
dw = xcb_generate_id(globalconf.connection); dw = xcb_generate_id(globalconf.connection);
xcb_create_pixmap(globalconf.connection, s->root_depth, xcb_create_pixmap(globalconf.connection, s->root_depth,
dw, dw,
root_window(globalconf.connection, c->titlebar.sw->phys_screen), xutil_root_window(globalconf.connection, c->titlebar.sw->phys_screen),
c->titlebar.sw->geometry.height, c->titlebar.sw->geometry.height,
c->titlebar.sw->geometry.width); c->titlebar.sw->geometry.width);
ctx = draw_context_new(globalconf.connection, c->titlebar.sw->phys_screen, ctx = draw_context_new(globalconf.connection, c->titlebar.sw->phys_screen,

View File

@ -43,8 +43,8 @@ window_setstate(xcb_window_t win, long state)
long data[] = { state, XCB_NONE }; long data[] = { state, XCB_NONE };
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, win, xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, win,
x_intern_atom(globalconf.connection, "WM_STATE"), xutil_intern_atom(globalconf.connection, "WM_STATE"),
x_intern_atom(globalconf.connection, "WM_STATE"), 32, xutil_intern_atom(globalconf.connection, "WM_STATE"), 32,
2, data); 2, data);
} }
@ -58,7 +58,7 @@ window_getstate(xcb_window_t w)
long result = -1; long result = -1;
unsigned char *p = NULL; unsigned char *p = NULL;
xcb_get_property_cookie_t prop_c; xcb_get_property_cookie_t prop_c;
xcb_atom_t wm_state_atom = x_intern_atom(globalconf.connection, "WM_STATE"); xcb_atom_t wm_state_atom = xutil_intern_atom(globalconf.connection, "WM_STATE");
xcb_get_property_reply_t *prop_r; xcb_get_property_reply_t *prop_r;
prop_c = xcb_get_property_unchecked(globalconf.connection, false, w, prop_c = xcb_get_property_unchecked(globalconf.connection, false, w,
@ -140,7 +140,7 @@ window_grabbuttons(xcb_window_t win, int phys_screen)
} }
xcb_ungrab_button(globalconf.connection, XCB_BUTTON_INDEX_ANY, xcb_ungrab_button(globalconf.connection, XCB_BUTTON_INDEX_ANY,
root_window(globalconf.connection, phys_screen), ANY_MODIFIER); xutil_root_window(globalconf.connection, phys_screen), ANY_MODIFIER);
} }
/** Grab buttons on root window /** Grab buttons on root window
@ -154,19 +154,19 @@ window_root_grabbuttons(int phys_screen)
for(b = globalconf.buttons.root; b; b = b->next) for(b = globalconf.buttons.root; b; b = b->next)
{ {
xcb_grab_button(globalconf.connection, false, xcb_grab_button(globalconf.connection, false,
root_window(globalconf.connection, phys_screen), BUTTONMASK, xutil_root_window(globalconf.connection, phys_screen), BUTTONMASK,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_SYNC, XCB_NONE, XCB_NONE, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_SYNC, XCB_NONE, XCB_NONE,
b->button, b->mod); b->button, b->mod);
xcb_grab_button(globalconf.connection, false, xcb_grab_button(globalconf.connection, false,
root_window(globalconf.connection, phys_screen), BUTTONMASK, xutil_root_window(globalconf.connection, phys_screen), BUTTONMASK,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_SYNC, XCB_NONE, XCB_NONE, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_SYNC, XCB_NONE, XCB_NONE,
b->button, b->mod | XCB_MOD_MASK_LOCK); b->button, b->mod | XCB_MOD_MASK_LOCK);
xcb_grab_button(globalconf.connection, false, xcb_grab_button(globalconf.connection, false,
root_window(globalconf.connection, phys_screen), BUTTONMASK, xutil_root_window(globalconf.connection, phys_screen), BUTTONMASK,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_SYNC, XCB_NONE, XCB_NONE, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_SYNC, XCB_NONE, XCB_NONE,
b->button, b->mod | globalconf.numlockmask); b->button, b->mod | globalconf.numlockmask);
xcb_grab_button(globalconf.connection, false, xcb_grab_button(globalconf.connection, false,
root_window(globalconf.connection, phys_screen), BUTTONMASK, xutil_root_window(globalconf.connection, phys_screen), BUTTONMASK,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_SYNC, XCB_NONE, XCB_NONE, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_SYNC, XCB_NONE, XCB_NONE,
b->button, b->mod | globalconf.numlockmask | XCB_MOD_MASK_LOCK); b->button, b->mod | globalconf.numlockmask | XCB_MOD_MASK_LOCK);
} }
@ -182,18 +182,18 @@ window_root_grabkeys(int phys_screen)
xcb_keycode_t kc; xcb_keycode_t kc;
xcb_ungrab_key(globalconf.connection, ANY_KEY, xcb_ungrab_key(globalconf.connection, ANY_KEY,
root_window(globalconf.connection, phys_screen), ANY_MODIFIER); xutil_root_window(globalconf.connection, phys_screen), ANY_MODIFIER);
for(k = globalconf.keys; k; k = k->next) for(k = globalconf.keys; k; k = k->next)
if((kc = k->keycode) || (k->keysym && (kc = xcb_key_symbols_get_keycode(globalconf.keysyms, k->keysym)))) if((kc = k->keycode) || (k->keysym && (kc = xcb_key_symbols_get_keycode(globalconf.keysyms, k->keysym))))
{ {
xcb_grab_key(globalconf.connection, true, root_window(globalconf.connection, phys_screen), xcb_grab_key(globalconf.connection, true, xutil_root_window(globalconf.connection, phys_screen),
k->mod, kc, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC); k->mod, kc, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
xcb_grab_key(globalconf.connection, true, root_window(globalconf.connection, phys_screen), xcb_grab_key(globalconf.connection, true, xutil_root_window(globalconf.connection, phys_screen),
k->mod | XCB_MOD_MASK_LOCK, kc, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC); k->mod | XCB_MOD_MASK_LOCK, kc, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
xcb_grab_key(globalconf.connection, true, root_window(globalconf.connection, phys_screen), xcb_grab_key(globalconf.connection, true, xutil_root_window(globalconf.connection, phys_screen),
k->mod | globalconf.numlockmask, kc, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC); k->mod | globalconf.numlockmask, kc, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
xcb_grab_key(globalconf.connection, true, root_window(globalconf.connection, phys_screen), xcb_grab_key(globalconf.connection, true, xutil_root_window(globalconf.connection, phys_screen),
k->mod | globalconf.numlockmask | XCB_MOD_MASK_LOCK, kc, XCB_GRAB_MODE_ASYNC, k->mod | globalconf.numlockmask | XCB_MOD_MASK_LOCK, kc, XCB_GRAB_MODE_ASYNC,
XCB_GRAB_MODE_ASYNC); XCB_GRAB_MODE_ASYNC);
} }
@ -211,7 +211,7 @@ window_setshape(xcb_window_t win, int phys_screen)
{ {
xcb_shape_combine(globalconf.connection, XCB_SHAPE_SO_SET, xcb_shape_combine(globalconf.connection, XCB_SHAPE_SO_SET,
XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING,
root_window(globalconf.connection, phys_screen), xutil_root_window(globalconf.connection, phys_screen),
0, 0, win); 0, 0, win);
p_delete(&r); p_delete(&r);
@ -227,12 +227,12 @@ window_settrans(xcb_window_t win, double opacity)
{ {
real_opacity = opacity * 0xffffffff; real_opacity = opacity * 0xffffffff;
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, win, xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, win,
x_intern_atom(globalconf.connection, "_NET_WM_WINDOW_OPACITY"), xutil_intern_atom(globalconf.connection, "_NET_WM_WINDOW_OPACITY"),
CARDINAL, 32, 1L, &real_opacity); CARDINAL, 32, 1L, &real_opacity);
} }
else else
xcb_delete_property(globalconf.connection, win, xcb_delete_property(globalconf.connection, win,
x_intern_atom(globalconf.connection, "_NET_WM_WINDOW_OPACITY")); xutil_intern_atom(globalconf.connection, "_NET_WM_WINDOW_OPACITY"));
} }
// 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