Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
spectrwm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
54d1d17
)
convert root_to_region to XCB
author
David Hill
<dhill@conformal.com>
Fri, 6 Jul 2012 03:29:47 +0000
(23:29 -0400)
committer
Reginald Kennedy
<rk@rejii.com>
Fri, 20 Jul 2012 21:58:31 +0000
(
05:58
+0800)
spectrwm.c
patch
|
blob
|
history
diff --git
a/spectrwm.c
b/spectrwm.c
index
605ba36
..
da56a79
100644
(file)
--- a/
spectrwm.c
+++ b/
spectrwm.c
@@
-2229,29
+2229,32
@@
restart(struct swm_region *r, union arg *args)
}
struct swm_region *
}
struct swm_region *
-root_to_region(Window root)
+root_to_region(xcb_window_t root)
{
struct swm_region *r = NULL;
{
struct swm_region *r = NULL;
- Window rr, cr;
- int i, x, y, wx, wy, num_screens;
- unsigned int mask;
+ int i, num_screens;
+ xcb_query_pointer_cookie_t qpc;
+ xcb_query_pointer_reply_t *qpr;
- DNPRINTF(SWM_D_MISC, "root_to_region: window: 0x%lx\n", root);
+ DNPRINTF(SWM_D_MISC, "root_to_region: window: 0x%x\n", root);
num_screens = xcb_setup_roots_length(xcb_get_setup(conn));
for (i = 0; i < num_screens; i++)
if (screens[i].root == root)
break;
num_screens = xcb_setup_roots_length(xcb_get_setup(conn));
for (i = 0; i < num_screens; i++)
if (screens[i].root == root)
break;
- if (XQueryPointer(display, screens[i].root,
- &rr, &cr, &x, &y, &wx, &wy, &mask) != False) {
+ qpc = xcb_query_pointer(conn, screens[i].root);
+ qpr = xcb_query_pointer_reply(conn, qpc, NULL);
+
+ if (qpr) {
DNPRINTF(SWM_D_MISC, "root_to_region: pointer: (%d,%d)\n",
DNPRINTF(SWM_D_MISC, "root_to_region: pointer: (%d,%d)\n",
- x, y);
+ qpr->root_x, qpr->root_y);
/* choose a region based on pointer location */
TAILQ_FOREACH(r, &screens[i].rl, entry)
/* choose a region based on pointer location */
TAILQ_FOREACH(r, &screens[i].rl, entry)
- if (X(r) <= x && x < MAX_X(r) &&
- Y(r) <= y && y < MAX_Y(r))
+ if (X(r) <= qpr->root_x && qpr->root_x < MAX_X(r) &&
+ Y(r) <= qpr->root_y && qpr->root_y < MAX_Y(r))
break;
break;
+ free(qpr);
}
if (r == NULL)
}
if (r == NULL)