Bugfix: Correctly warp pointer *after* rendering the layout
This is necessary because otherwise the window into which the pointer is warped still is at its old position, so that the pointer will effectively be warped onto the wrong screen in case of moving a window to another screen.
This commit is contained in:
parent
739f4f35aa
commit
6f2638f526
|
@ -111,12 +111,11 @@ void workspace_show(xcb_connection_t *conn, int workspace) {
|
||||||
/* Check if we need to change something or if we’re already there */
|
/* Check if we need to change something or if we’re already there */
|
||||||
if (c_ws->screen->current_workspace == (workspace-1)) {
|
if (c_ws->screen->current_workspace == (workspace-1)) {
|
||||||
Client *last_focused = SLIST_FIRST(&(c_ws->focus_stack));
|
Client *last_focused = SLIST_FIRST(&(c_ws->focus_stack));
|
||||||
if (last_focused != SLIST_END(&(c_ws->focus_stack))) {
|
if (last_focused != SLIST_END(&(c_ws->focus_stack)))
|
||||||
set_focus(conn, last_focused, true);
|
set_focus(conn, last_focused, true);
|
||||||
if (need_warp) {
|
if (need_warp) {
|
||||||
client_warp_pointer_into(conn, last_focused);
|
client_warp_pointer_into(conn, last_focused);
|
||||||
xcb_flush(conn);
|
xcb_flush(conn);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -135,17 +134,28 @@ void workspace_show(xcb_connection_t *conn, int workspace) {
|
||||||
|
|
||||||
workspace_map_clients(conn, c_ws);
|
workspace_map_clients(conn, c_ws);
|
||||||
|
|
||||||
|
/* POTENTIAL TO IMPROVE HERE: due to the call to _map_clients first and
|
||||||
|
* render_layout afterwards, there is a short flickering on the source
|
||||||
|
* workspace (assign ws 3 to screen 0, ws 4 to screen 1, create single
|
||||||
|
* client on ws 4, move it to ws 3, switch to ws 3, you’ll see the
|
||||||
|
* flickering). */
|
||||||
|
|
||||||
/* Restore focus on the new workspace */
|
/* Restore focus on the new workspace */
|
||||||
Client *last_focused = SLIST_FIRST(&(c_ws->focus_stack));
|
Client *last_focused = SLIST_FIRST(&(c_ws->focus_stack));
|
||||||
if (last_focused != SLIST_END(&(c_ws->focus_stack))) {
|
if (last_focused != SLIST_END(&(c_ws->focus_stack)))
|
||||||
set_focus(conn, last_focused, true);
|
set_focus(conn, last_focused, true);
|
||||||
if (need_warp) {
|
else xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, root, XCB_CURRENT_TIME);
|
||||||
client_warp_pointer_into(conn, last_focused);
|
|
||||||
xcb_flush(conn);
|
|
||||||
}
|
|
||||||
} else xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, root, XCB_CURRENT_TIME);
|
|
||||||
|
|
||||||
render_layout(conn);
|
render_layout(conn);
|
||||||
|
|
||||||
|
/* We can warp the pointer only after the window has been
|
||||||
|
* reconfigured in render_layout, otherwise the pointer will
|
||||||
|
* be warped to the old position, which will not work when we
|
||||||
|
* moved it to another screen. */
|
||||||
|
if (last_focused != SLIST_END(&(c_ws->focus_stack)) && need_warp) {
|
||||||
|
client_warp_pointer_into(conn, last_focused);
|
||||||
|
xcb_flush(conn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue