]> git.sur5r.net Git - i3/i3/commitdiff
floating: Don’t let clients become hidden under stack windows or fulscreen clients...
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 19 Jun 2009 21:18:43 +0000 (23:18 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 19 Jun 2009 21:18:43 +0000 (23:18 +0200)
include/client.h
src/client.c
src/floating.c
src/layout.c
src/manage.c

index 252f36196836170fba2e3f62c8ae0381b9e2dd21..068a364a518a278bab507fb0451aa6abd4863b1b 100644 (file)
@@ -52,4 +52,12 @@ bool client_matches_class_name(Client *client, char *to_class, char *to_title,
  */
 void client_toggle_fullscreen(xcb_connection_t *conn, Client *client);
 
+/**
+ * Sets the position of the given client in the X stack to the highest (tiling layer is always
+ * on the same position, so this doesn’t matter) below the first floating client, so that
+ * floating windows are always on top.
+ *
+ */
+void client_set_below_floating(xcb_connection_t *conn, Client *client);
+
 #endif
index a7a6e3e8a88bf42603e0e0223f4004dd9d8359d0..18126a1a911cd290e83bbfc653e964a024615f29 100644 (file)
@@ -23,6 +23,7 @@
 #include "util.h"
 #include "queue.h"
 #include "layout.h"
+#include "client.h"
 
 /*
  * Removes the given client from the container, either because it will be inserted into another
@@ -194,6 +195,8 @@ void client_toggle_fullscreen(xcb_connection_t *conn, Client *client) {
                         /* redecorate_window flushes */
                         redecorate_window(conn, client);
                 } else {
+                        client_set_below_floating(conn, client);
+
                         /* Because the coordinates of the window haven’t changed, it would not be
                            re-configured if we don’t set the following flag */
                         client->force_reconfigure = true;
@@ -204,3 +207,19 @@ void client_toggle_fullscreen(xcb_connection_t *conn, Client *client) {
 
         xcb_flush(conn);
 }
+
+/*
+ * Sets the position of the given client in the X stack to the highest (tiling layer is always
+ * on the same position, so this doesn’t matter) below the first floating client, so that
+ * floating windows are always on top.
+ *
+ */
+void client_set_below_floating(xcb_connection_t *conn, Client *client) {
+        /* Ensure that it is below all floating clients */
+        Client *first_floating = TAILQ_FIRST(&(client->workspace->floating_clients));
+        if (first_floating != TAILQ_END(&(client->workspace->floating_clients))) {
+                LOG("Setting below floating\n");
+                uint32_t values[] = { first_floating->frame, XCB_STACK_MODE_BELOW };
+                xcb_configure_window(conn, client->frame, XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values);
+        }
+}
index f416160a4e4ba5400c13d9c058549fdc067e3e50..f4b228235b445e7aa69c63058f52b2b01d704e4b 100644 (file)
@@ -78,13 +78,7 @@ void toggle_floating_mode(xcb_connection_t *conn, Client *client, bool automatic
                 LOG("Re-inserted the client into the matrix.\n");
                 con->currently_focused = client;
 
-                /* Ensure that it is below all floating clients */
-                Client *first_floating = TAILQ_FIRST(&(client->workspace->floating_clients));
-                if (first_floating != TAILQ_END(&(client->workspace->floating_clients))) {
-                        LOG("Setting below floating\n");
-                        uint32_t values[] = { first_floating->frame, XCB_STACK_MODE_BELOW };
-                        xcb_configure_window(conn, client->frame, XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values);
-                }
+                client_set_below_floating(conn, client);
 
                 render_container(conn, con);
                 xcb_flush(conn);
index 426dd0277ed629e99894243edc4c6f57ebb58487..952f3d60453cefdc2cd721649d90f377eceaaec4 100644 (file)
@@ -327,8 +327,13 @@ void render_container(xcb_connection_t *conn, Container *container) {
                                         XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT |
                                         XCB_CONFIG_WINDOW_STACK_MODE;
 
-                        /* If there is no fullscreen client, we raise the stack window */
-                        if (container->workspace->fullscreen_client != NULL) {
+                        /* Raise the stack window, but keep it below the first floating client
+                         * and below the fullscreen client (if any) */
+                        Client *first_floating = TAILQ_FIRST(&(container->workspace->floating_clients));
+                        if (first_floating != TAILQ_END(&(container->workspace->floating_clients))) {
+                                mask |= XCB_CONFIG_WINDOW_SIBLING;
+                                values[4] = first_floating->frame;
+                        } else if (container->workspace->fullscreen_client != NULL) {
                                 mask |= XCB_CONFIG_WINDOW_SIBLING;
                                 values[4] = container->workspace->fullscreen_client->frame;
                         }
index 827c05ca870ed037c8c92dda4add89fbf9d8e158..948e9aba971ca30b0cd72671bfff05f16b2dc79f 100644 (file)
@@ -373,13 +373,7 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
 
                 SLIST_INSERT_HEAD(&(new->container->workspace->focus_stack), new, focus_clients);
 
-                /* Ensure that it is below all floating clients */
-                Client *first_floating = TAILQ_FIRST(&(new->workspace->floating_clients));
-                if (first_floating != TAILQ_END(&(new->workspace->floating_clients))) {
-                        LOG("Setting below floating\n");
-                        uint32_t values[] = { first_floating->frame, XCB_STACK_MODE_BELOW };
-                        xcb_configure_window(conn, new->frame, XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values);
-                }
+                client_set_below_floating(conn, new);
         }
 
         if (new->floating >= FLOATING_AUTO_ON) {