mouse: add mouse_get_client_under_pointer

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Michael Gehring 2008-06-15 17:30:21 +02:00 committed by Julien Danjou
parent ba171ed9e6
commit 6a96c25be2
1 changed files with 26 additions and 0 deletions

26
mouse.c
View File

@ -337,6 +337,32 @@ mouse_track_mouse_drag(int *x, int *y)
}
}
/** Get the client that contains the Pointer.
*
* \return The client that contains the Pointer or NULL.
*/
static client_t *
mouse_get_client_under_pointer()
{
xcb_window_t root;
xcb_query_pointer_cookie_t query_ptr_c;
xcb_query_pointer_reply_t *query_ptr_r;
client_t *c = NULL;
root = xcb_aux_get_screen(globalconf.connection, globalconf.default_screen)->root;
query_ptr_c = xcb_query_pointer_unchecked(globalconf.connection, root);
query_ptr_r = xcb_query_pointer_reply(globalconf.connection, query_ptr_c, NULL);
if(query_ptr_r)
{
c = client_getbywin(query_ptr_r->child);
p_delete(&query_ptr_r);
}
return c;
}
/** Move the focused window with the mouse.
*/
static void