Bugfix: Set focus to the client which was previously focused instead of the next client when moving windows
This fixes ticket #21
This commit is contained in:
parent
28aa13d831
commit
cb7b7a73d2
|
@ -171,12 +171,22 @@ static void move_current_window(xcb_connection_t *conn, direction_t direction) {
|
||||||
container->currently_focused->dock)
|
container->currently_focused->dock)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* As soon as the client is moved away, the next client in the old
|
/* As soon as the client is moved away, the last focused client in the old
|
||||||
* container needs to get focus, if any. Therefore, we save it here. */
|
* container needs to get focus, if any. Therefore, we save it here. */
|
||||||
Client *current_client = container->currently_focused;
|
Client *current_client = container->currently_focused;
|
||||||
Client *to_focus = CIRCLEQ_NEXT_OR_NULL(&(container->clients), current_client, clients);
|
Client *to_focus = NULL, *client_loop;
|
||||||
if (to_focus == NULL)
|
|
||||||
to_focus = CIRCLEQ_PREV_OR_NULL(&(container->clients), current_client, clients);
|
SLIST_FOREACH(client_loop, &(container->workspace->focus_stack), focus_clients)
|
||||||
|
if ((client_loop->container == container) && (client_loop != current_client)) {
|
||||||
|
to_focus = client_loop;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (to_focus == NULL) {
|
||||||
|
to_focus = CIRCLEQ_NEXT_OR_NULL(&(container->clients), current_client, clients);
|
||||||
|
if (to_focus == NULL)
|
||||||
|
to_focus = CIRCLEQ_PREV_OR_NULL(&(container->clients), current_client, clients);
|
||||||
|
}
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case D_LEFT:
|
case D_LEFT:
|
||||||
|
|
Loading…
Reference in New Issue