Remove useless xutil_root_window()

This commit is contained in:
Arnaud Fontaine 2008-03-27 15:05:37 +00:00 committed by Julien Danjou
parent da5236d57a
commit 71e9100927
16 changed files with 63 additions and 77 deletions

View File

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

View File

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

View File

@ -88,7 +88,7 @@ scan()
for(screen = 0; screen < screen_max; screen++)
{
root_wins[screen].id = xutil_root_window(globalconf.connection, screen);
root_wins[screen].id = xcb_aux_get_screen(globalconf.connection, screen)->root;
/* Get the window tree */
root_wins[screen].tree_cookie = xcb_query_tree_unchecked(globalconf.connection,
@ -356,7 +356,7 @@ main(int argc, char *argv[])
screen_nbr++)
/* this causes an error if some other window manager is running */
xcb_change_window_attributes(conn,
xutil_root_window(conn, screen_nbr),
xcb_aux_get_screen(conn, screen_nbr)->root,
XCB_CW_EVENT_MASK, &select_input_val);
/* need to xcb_flush to validate error handler */
@ -424,7 +424,7 @@ main(int argc, char *argv[])
screen_nbr++)
{
xcb_change_window_attributes(globalconf.connection,
xutil_root_window(globalconf.connection, screen_nbr),
xcb_aux_get_screen(globalconf.connection, screen_nbr)->root,
XCB_CW_EVENT_MASK | XCB_CW_CURSOR,
change_win_vals);
ewmh_set_supported_hints(screen_nbr);

View File

@ -233,7 +233,7 @@ client_focus(Client *c, int screen, bool raise)
phys_screen = screen_virttophys(screen);
xcb_set_input_focus(globalconf.connection,
XCB_INPUT_FOCUS_POINTER_ROOT,
xutil_root_window(globalconf.connection, phys_screen),
xcb_aux_get_screen(globalconf.connection, phys_screen)->root,
XCB_CURRENT_TIME);
}
@ -927,7 +927,7 @@ uicb_client_moveresize(int screen, char *arg)
xqp = xcb_query_pointer_reply(globalconf.connection,
xcb_query_pointer_unchecked(globalconf.connection,
xutil_root_window(globalconf.connection, sel->phys_screen)),
xcb_aux_get_screen(globalconf.connection, sel->phys_screen)->root),
NULL);
if(globalconf.screens[sel->screen].resize_hints)
geometry = client_geometry_hints(sel, geometry);

View File

@ -23,7 +23,6 @@
#include <xcb/xcb_aux.h>
#include "common/swindow.h"
#include "common/util.h"
/** Create a simple window
* \param conn Connection ref
@ -61,17 +60,13 @@ simplewindow_new(xcb_connection_t *conn, int phys_screen, int x, int y,
XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_EXPOSURE;
sw->window = xcb_generate_id(conn);
xcb_create_window(conn, s->root_depth, sw->window,
xutil_root_window(conn, phys_screen),
x, y, w, h, border_width,
XCB_COPY_FROM_PARENT,
s->root_visual,
xcb_create_window(conn, s->root_depth, sw->window, s->root, x, y, w, h,
border_width, XCB_COPY_FROM_PARENT, s->root_visual,
XCB_CW_BACK_PIXMAP | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK,
create_win_val);
sw->drawable = xcb_generate_id(conn);
xcb_create_pixmap(conn, s->root_depth, sw->drawable,
xutil_root_window(conn, phys_screen), w, h);
xcb_create_pixmap(conn, s->root_depth, sw->drawable, s->root, w, h);
return sw;
}
@ -119,8 +114,7 @@ simplewindow_resize(SimpleWindow *sw, unsigned int w, unsigned int h)
sw->geometry.height = h;
xcb_free_pixmap(sw->connection, sw->drawable);
sw->drawable = xcb_generate_id(sw->connection);
xcb_create_pixmap(sw->connection, s->root_depth, sw->drawable,
xutil_root_window(sw->connection, sw->phys_screen), w, h);
xcb_create_pixmap(sw->connection, s->root_depth, sw->drawable, s->root, w, h);
xcb_configure_window(sw->connection, sw->window,
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
resize_win_vals);

View File

@ -23,7 +23,6 @@
#define _GNU_SOURCE
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_atom.h>
#include <xcb/xinerama.h>
@ -138,12 +137,6 @@ xutil_get_transient_for_hint(xcb_connection_t *c, xcb_window_t win,
return true;
}
xcb_window_t
xutil_root_window(xcb_connection_t *c, int screen_number)
{
return xcb_aux_get_screen(c, screen_number)->root;
}
xcb_atom_t
xutil_intern_atom(xcb_connection_t *c, const char *property)
{

View File

@ -79,7 +79,6 @@ void xutil_get_lock_mask(xcb_connection_t *, xcb_key_symbols_t *,
/* Common function defined in Xlib but not in XCB */
bool xutil_get_transient_for_hint(xcb_connection_t *, xcb_window_t, xcb_window_t *);
xcb_window_t xutil_root_window(xcb_connection_t *, int);
typedef struct _class_hint_t
{

16
event.c
View File

@ -153,8 +153,8 @@ event_handle_buttonpress(void *data __attribute__ ((unused)),
event_handle_mouse_button_press(c->screen, ev->detail, ev->state, globalconf.buttons.client, NULL);
}
else
for(screen = 0; screen < xcb_setup_roots_length(xcb_get_setup (connection)); screen++)
if(xutil_root_window(connection, screen) == ev->event
for(screen = 0; screen < xcb_setup_roots_length(xcb_get_setup(connection)); screen++)
if(xcb_aux_get_screen(connection, screen)->root == ev->event
&& (qr = xcb_query_pointer_reply(connection,
xcb_query_pointer(connection, ev->event),
NULL)) != NULL)
@ -274,8 +274,8 @@ event_handle_configurenotify(void *data __attribute__ ((unused)),
const xcb_screen_t *screen;
for(screen_nbr = 0; screen_nbr < xcb_setup_roots_length(xcb_get_setup (connection)); screen_nbr++)
if(ev->window == xutil_root_window(connection, screen_nbr)
&& (screen = xcb_aux_get_screen(connection, screen_nbr)) != NULL
if((screen = xcb_aux_get_screen(connection, screen_nbr)) != NULL
&& ev->window == screen->root
&& (ev->width != screen->width_in_pixels
|| ev->height != screen->height_in_pixels))
/* it's not that we panic, but restart */
@ -336,7 +336,7 @@ event_handle_enternotify(void *data __attribute__ ((unused)),
}
else
for(screen = 0; screen < xcb_setup_roots_length(xcb_get_setup(connection)); screen++)
if(ev->event == xutil_root_window(connection, screen))
if(ev->event == xcb_aux_get_screen(connection, screen)->root)
{
window_root_grabbuttons(screen);
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++)
if((qpr = xcb_query_pointer_reply(connection,
xcb_query_pointer(connection,
xutil_root_window(connection, screen)),
xcb_aux_get_screen(connection, screen)->root),
NULL)) != NULL)
{
/* 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
&& (qpr = xcb_query_pointer_reply(connection,
xcb_query_pointer(connection,
xutil_root_window(globalconf.connection, screen_nbr)),
xcb_aux_get_screen(globalconf.connection, screen_nbr)->root),
NULL)) != NULL)
screen_nbr = screen_get_bycoord(globalconf.screens_info, screen_nbr, qpr->root_x, qpr->root_y);
else
@ -535,7 +535,7 @@ event_handle_unmapnotify(void *data __attribute__ ((unused)),
bool send_event = ((ev->response_type & 0x80) >> 7);
if((c = client_get_bywin(globalconf.clients, ev->window))
&& ev->event == xutil_root_window(connection, c->phys_screen)
&& ev->event == xcb_aux_get_screen(connection, c->phys_screen)->root
&& send_event && window_getstate(c->win) == XCB_WM_NORMAL_STATE)
client_unmanage(c);

15
ewmh.c
View File

@ -21,6 +21,7 @@
#include <xcb/xcb.h>
#include <xcb/xcb_atom.h>
#include <xcb/xcb_aux.h>
#include "ewmh.h"
#include "tag.h"
@ -157,7 +158,7 @@ ewmh_set_supported_hints(int phys_screen)
atom[i++] = net_wm_state_below;
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
xutil_root_window(globalconf.connection, phys_screen),
xcb_aux_get_screen(globalconf.connection, phys_screen)->root,
net_supported, ATOM, 32, i, atom);
}
@ -178,7 +179,7 @@ ewmh_update_net_client_list(int phys_screen)
wins[n] = c->win;
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
xutil_root_window(globalconf.connection, phys_screen),
xcb_aux_get_screen(globalconf.connection, phys_screen)->root,
net_client_list, WINDOW, 32, n, wins);
p_delete(&wins);
@ -194,7 +195,7 @@ ewmh_update_net_numbers_of_desktop(int phys_screen)
count++;
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
xutil_root_window(globalconf.connection, phys_screen),
xcb_aux_get_screen(globalconf.connection, phys_screen)->root,
net_number_of_desktops, CARDINAL, 32, 1, &count);
}
@ -208,7 +209,7 @@ ewmh_update_net_current_desktop(int phys_screen)
count++;
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
xutil_root_window(globalconf.connection, phys_screen),
xcb_aux_get_screen(globalconf.connection, phys_screen)->root,
net_current_desktop, CARDINAL, 32, 1, &count);
p_delete(&curtags);
@ -232,7 +233,7 @@ ewmh_update_net_desktop_names(int phys_screen)
}
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
xutil_root_window(globalconf.connection, phys_screen),
xcb_aux_get_screen(globalconf.connection, phys_screen)->root,
net_desktop_names, utf8_string, 8, len, buf);
}
@ -245,7 +246,7 @@ ewmh_update_net_active_window(int phys_screen)
win = sel ? sel->win : XCB_NONE;
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
xutil_root_window(globalconf.connection, phys_screen),
xcb_aux_get_screen(globalconf.connection, phys_screen)->root,
net_active_window, WINDOW, 32, 1, &win);
}
@ -362,7 +363,7 @@ ewmh_process_client_message(xcb_client_message_event_t *ev)
screen < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
screen++)
{
if(ev->window == xutil_root_window(globalconf.connection, screen))
if(ev->window == xcb_aux_get_screen(globalconf.connection, screen)->root)
tag_view_only_byindex(screen, ev->data.data32[0]);
}

View File

@ -21,6 +21,7 @@
#include <xcb/xcb.h>
#include <xcb/xcb_atom.h>
#include <xcb/xcb_aux.h>
#include "tag.h"
#include "focus.h"
@ -80,8 +81,8 @@ arrange(int screen)
/* check that the mouse is on a window or not */
if((xqp = xcb_query_pointer_reply(globalconf.connection,
xcb_query_pointer_unchecked(globalconf.connection,
xutil_root_window(globalconf.connection,
phys_screen)),
xcb_aux_get_screen(globalconf.connection,
phys_screen)->root),
NULL)) != NULL
&& (xqp->root == XCB_NONE || xqp->child == XCB_NONE || xqp->root == xqp->child))
{

16
mouse.c
View File

@ -147,20 +147,21 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
xcb_motion_notify_event_t *ev_motion = NULL;
xcb_grab_pointer_reply_t *grab_pointer_r = NULL;
xcb_query_pointer_reply_t *query_pointer_r = NULL, *mquery_pointer_r = NULL;
xcb_screen_t *s = xcb_aux_get_screen(globalconf.connection, c->phys_screen);
if(!c
|| xcb_grab_pointer_reply(globalconf.connection,
xcb_grab_pointer(globalconf.connection, false,
xutil_root_window(globalconf.connection, c->phys_screen),
s->root,
MOUSEMASK, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC,
xutil_root_window(globalconf.connection, c->phys_screen),
s->root,
globalconf.cursor[CurMove], XCB_CURRENT_TIME),
NULL))
return;
query_pointer_r = xcb_query_pointer_reply(globalconf.connection,
xcb_query_pointer_unchecked(globalconf.connection,
xutil_root_window(globalconf.connection, c->phys_screen)),
s->root),
NULL);
geometry = c->geometry;
@ -230,7 +231,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
{
mquery_pointer_r = xcb_query_pointer_reply(globalconf.connection,
xcb_query_pointer_unchecked(globalconf.connection,
xutil_root_window(globalconf.connection, c->phys_screen)),
s->root),
NULL);
if((newscreen = screen_get_bycoord(globalconf.screens_info, c->screen,
mquery_pointer_r->root_x,
@ -290,6 +291,7 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
style_t style;
xcb_grab_pointer_cookie_t grab_pointer_c;
xcb_grab_pointer_reply_t *grab_pointer_r = NULL;
xcb_screen_t *s = xcb_aux_get_screen(globalconf.connection, c->phys_screen);
/* only handle floating and tiled layouts */
if(!c || c->isfixed)
@ -335,11 +337,9 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
else
return;
grab_pointer_c = xcb_grab_pointer(globalconf.connection, false,
xutil_root_window(globalconf.connection, c->phys_screen),
grab_pointer_c = xcb_grab_pointer(globalconf.connection, false, s->root,
MOUSEMASK, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC,
xutil_root_window(globalconf.connection, c->phys_screen),
globalconf.cursor[CurResize], XCB_CURRENT_TIME);
s->root, globalconf.cursor[CurResize], XCB_CURRENT_TIME);
if(layout->arrange == layout_floating || c->isfloating)
{

View File

@ -19,6 +19,9 @@
*
*/
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include "placement.h"
#include "screen.h"
#include "client.h"
@ -133,7 +136,7 @@ placement_under_mouse(Client *c)
if((xqp = xcb_query_pointer_reply(globalconf.connection,
xcb_query_pointer(globalconf.connection,
xutil_root_window(globalconf.connection, c->phys_screen)),
xcb_aux_get_screen(globalconf.connection, c->phys_screen)->root),
NULL)) != NULL)
{
finalgeometry.x = xqp->root_x - c->f_geometry.width / 2;

View File

@ -216,21 +216,18 @@ move_client_to_screen(Client *c, int new_screen, bool doresize)
static void
move_mouse_pointer_to_screen(int phys_screen)
{
xcb_screen_t *s;
if(globalconf.screens_info->xinerama_is_active)
{
s = xcb_aux_get_screen(globalconf.connection, globalconf.default_screen);
area_t area = screen_get_area(phys_screen, NULL, NULL);
xcb_warp_pointer(globalconf.connection,
XCB_NONE,
s->root,
xcb_aux_get_screen(globalconf.connection, globalconf.default_screen)->root,
0, 0, 0, 0, area.x, area.y);
}
else
xcb_warp_pointer(globalconf.connection,
XCB_NONE,
xutil_root_window(globalconf.connection, phys_screen),
xcb_aux_get_screen(globalconf.connection, phys_screen)->root,
0, 0, 0, 0, 0, 0);
}

View File

@ -242,8 +242,7 @@ statusbar_init(Statusbar *statusbar)
/* we need a new pixmap this way [ ] to render */
dw = xcb_generate_id(globalconf.connection);
xcb_create_pixmap(globalconf.connection,
s->root_depth, dw,
xutil_root_window(globalconf.connection, phys_screen),
s->root_depth, dw, s->root,
statusbar->width, statusbar->height);
statusbar->ctx = draw_context_new(globalconf.connection,
phys_screen,

View File

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

View File

@ -23,6 +23,7 @@
#include <xcb/xcb_atom.h>
#include <xcb/shape.h>
#include <xcb/xcb_keysyms.h>
#include <xcb/xcb_aux.h>
#include "structs.h"
#include "window.h"
@ -140,7 +141,8 @@ window_grabbuttons(xcb_window_t win, int phys_screen)
}
xcb_ungrab_button(globalconf.connection, XCB_BUTTON_INDEX_ANY,
xutil_root_window(globalconf.connection, phys_screen), ANY_MODIFIER);
xcb_aux_get_screen(globalconf.connection, phys_screen)->root,
ANY_MODIFIER);
}
/** Grab buttons on root window
@ -150,23 +152,20 @@ void
window_root_grabbuttons(int phys_screen)
{
Button *b;
xcb_screen_t *s = xcb_aux_get_screen(globalconf.connection, phys_screen);
for(b = globalconf.buttons.root; b; b = b->next)
{
xcb_grab_button(globalconf.connection, false,
xutil_root_window(globalconf.connection, phys_screen), BUTTONMASK,
xcb_grab_button(globalconf.connection, false, s->root, BUTTONMASK,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_SYNC, XCB_NONE, XCB_NONE,
b->button, b->mod);
xcb_grab_button(globalconf.connection, false,
xutil_root_window(globalconf.connection, phys_screen), BUTTONMASK,
xcb_grab_button(globalconf.connection, false, s->root, BUTTONMASK,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_SYNC, XCB_NONE, XCB_NONE,
b->button, b->mod | XCB_MOD_MASK_LOCK);
xcb_grab_button(globalconf.connection, false,
xutil_root_window(globalconf.connection, phys_screen), BUTTONMASK,
xcb_grab_button(globalconf.connection, false, s->root, BUTTONMASK,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_SYNC, XCB_NONE, XCB_NONE,
b->button, b->mod | globalconf.numlockmask);
xcb_grab_button(globalconf.connection, false,
xutil_root_window(globalconf.connection, phys_screen), BUTTONMASK,
xcb_grab_button(globalconf.connection, false, s->root, BUTTONMASK,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_SYNC, XCB_NONE, XCB_NONE,
b->button, b->mod | globalconf.numlockmask | XCB_MOD_MASK_LOCK);
}
@ -178,22 +177,22 @@ window_root_grabbuttons(int phys_screen)
void
window_root_grabkeys(int phys_screen)
{
xcb_screen_t *s = xcb_aux_get_screen(globalconf.connection, phys_screen);
Key *k;
xcb_keycode_t kc;
xcb_ungrab_key(globalconf.connection, ANY_KEY,
xutil_root_window(globalconf.connection, phys_screen), ANY_MODIFIER);
xcb_ungrab_key(globalconf.connection, ANY_KEY, s->root, ANY_MODIFIER);
for(k = globalconf.keys; k; k = k->next)
if((kc = k->keycode) || (k->keysym && (kc = xcb_key_symbols_get_keycode(globalconf.keysyms, k->keysym))))
{
xcb_grab_key(globalconf.connection, true, xutil_root_window(globalconf.connection, phys_screen),
xcb_grab_key(globalconf.connection, true, s->root,
k->mod, kc, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
xcb_grab_key(globalconf.connection, true, xutil_root_window(globalconf.connection, phys_screen),
xcb_grab_key(globalconf.connection, true, s->root,
k->mod | XCB_MOD_MASK_LOCK, kc, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
xcb_grab_key(globalconf.connection, true, xutil_root_window(globalconf.connection, phys_screen),
xcb_grab_key(globalconf.connection, true, s->root,
k->mod | globalconf.numlockmask, kc, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
xcb_grab_key(globalconf.connection, true, xutil_root_window(globalconf.connection, phys_screen),
xcb_grab_key(globalconf.connection, true, s->root,
k->mod | globalconf.numlockmask | XCB_MOD_MASK_LOCK, kc, XCB_GRAB_MODE_ASYNC,
XCB_GRAB_MODE_ASYNC);
}
@ -211,7 +210,7 @@ window_setshape(xcb_window_t win, int phys_screen)
{
xcb_shape_combine(globalconf.connection, XCB_SHAPE_SO_SET,
XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING,
xutil_root_window(globalconf.connection, phys_screen),
xcb_aux_get_screen(globalconf.connection, phys_screen)->root,
0, 0, win);
p_delete(&r);