]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Correctly raise the currently focused client when going into stack mode
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 19 Jun 2009 22:31:57 +0000 (00:31 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 19 Jun 2009 22:31:57 +0000 (00:31 +0200)
src/handlers.c
src/util.c

index 803c6f3b18e9704d49f50dc1071a1e64fcd1ff81..3a422171088771910cfda28ec1853429205ff874 100644 (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 */
                 if (client->floating >= FLOATING_AUTO_ON) {
                         /* Firstly, we raise it. Maybe the user just wanted to raise it without grabbing */
-                        uint32_t values[] = { XCB_STACK_MODE_ABOVE };
-                        xcb_configure_window(conn, client->frame, XCB_CONFIG_WINDOW_STACK_MODE, values);
+                        xcb_raise_window(conn, client->frame);
                         xcb_flush(conn);
 
                         floating_drag_window(conn, client, event);
index c0268358fa6c9aebed425cc965826786c46b1745..762b9481338a14fa58e3da63561a939cd91c5d23 100644 (file)
@@ -399,7 +399,7 @@ void switch_layout_mode(xcb_connection_t *conn, Container *container, int mode)
                 /* When entering stacking mode, we need to open a window on which we can draw the
                    title bars of the clients, it has height 1 because we don’t bother here with
                    calculating the correct height - it will be adjusted when rendering anyways. */
-                Rect rect = {container->x, container->y, container->width, 1 };
+                Rect rect = {container->x, container->y, container->width, 1};
 
                 uint32_t mask = 0;
                 uint32_t values[2];
@@ -438,8 +438,31 @@ void switch_layout_mode(xcb_connection_t *conn, Container *container, int mode)
 
         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);
+        }
 }
 
 /*