Bugfix: Correctly raise the currently focused client when going into stack mode

This commit is contained in:
Michael Stapelberg 2009-06-20 00:31:57 +02:00
parent 8e19f8dabf
commit 83d3146b65
2 changed files with 26 additions and 4 deletions

View File

@ -364,8 +364,7 @@ int handle_button_press(void *ignored, xcb_connection_t *conn, xcb_button_press_
/* Floating clients can be dragged by grabbing their titlebar */ /* Floating clients can be dragged by grabbing their titlebar */
if (client->floating >= FLOATING_AUTO_ON) { if (client->floating >= FLOATING_AUTO_ON) {
/* Firstly, we raise it. Maybe the user just wanted to raise it without grabbing */ /* Firstly, we raise it. Maybe the user just wanted to raise it without grabbing */
uint32_t values[] = { XCB_STACK_MODE_ABOVE }; xcb_raise_window(conn, client->frame);
xcb_configure_window(conn, client->frame, XCB_CONFIG_WINDOW_STACK_MODE, values);
xcb_flush(conn); xcb_flush(conn);
floating_drag_window(conn, client, event); floating_drag_window(conn, client, event);

View File

@ -438,9 +438,32 @@ void switch_layout_mode(xcb_connection_t *conn, Container *container, int mode)
render_layout(conn); render_layout(conn);
if (container->currently_focused != NULL) if (container->currently_focused != NULL) {
/* We need to make sure that this client is above *each* of the
* other clients in this container */
Client *last_focused = get_last_focused_client(conn, container, container->currently_focused);
CIRCLEQ_FOREACH(client, &(container->clients), clients) {
if (client == container->currently_focused || client == last_focused)
continue;
LOG("setting %08x below %08x / %08x\n", client->frame, container->currently_focused->frame);
uint32_t values[] = { container->currently_focused->frame, XCB_STACK_MODE_BELOW };
xcb_configure_window(conn, client->frame,
XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values);
}
if (last_focused != NULL) {
LOG("Putting last_focused directly underneath the currently focused\n");
uint32_t values[] = { container->currently_focused->frame, XCB_STACK_MODE_BELOW };
xcb_configure_window(conn, last_focused->frame,
XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values);
}
set_focus(conn, container->currently_focused, true); set_focus(conn, container->currently_focused, true);
} }
}
/* /*
* Gets the first matching client for the given window class/window title. * Gets the first matching client for the given window class/window title.