Merge branch 'warp-pointer'

This commit is contained in:
Michael Stapelberg 2011-08-11 22:22:36 +02:00
commit 79479617c7
3 changed files with 25 additions and 0 deletions

View File

@ -152,4 +152,10 @@ void xcb_set_window_rect(xcb_connection_t *conn, xcb_window_t window, Rect r);
bool xcb_reply_contains_atom(xcb_get_property_reply_t *prop, xcb_atom_t atom); bool xcb_reply_contains_atom(xcb_get_property_reply_t *prop, xcb_atom_t atom);
/**
* Moves the mouse pointer into the middle of rect.
*
*/
void xcb_warp_pointer_rect(xcb_connection_t *conn, Rect *rect);
#endif #endif

View File

@ -217,10 +217,19 @@ void workspace_show(const char *num) {
} }
} }
/* Memorize current output */
Con *old_output = con_get_output(focused);
con_focus(next); con_focus(next);
workspace->fullscreen_mode = CF_OUTPUT; workspace->fullscreen_mode = CF_OUTPUT;
LOG("focused now = %p / %s\n", focused, focused->name); LOG("focused now = %p / %s\n", focused, focused->name);
/* Set mouse pointer */
Con *new_output = con_get_output(focused);
if (old_output != new_output) {
xcb_warp_pointer_rect(conn, &next->rect);
}
/* Update the EWMH hints */ /* Update the EWMH hints */
if (changed_num_workspaces) if (changed_num_workspaces)
ewmh_update_workarea(); ewmh_update_workarea();

View File

@ -361,3 +361,13 @@ bool xcb_reply_contains_atom(xcb_get_property_reply_t *prop, xcb_atom_t atom) {
return false; return false;
} }
/**
* Moves the mouse pointer into the middle of rect.
*
*/
void xcb_warp_pointer_rect(xcb_connection_t *conn, Rect *rect) {
xcb_warp_pointer(conn, XCB_NONE, root, 0, 0, 0, 0,
rect->x + (rect->width / 2),
rect->y + (rect->height / 2));
}