]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Don’t hide assigned clients to inactive but visible workspaces (Thanks xeen)
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 2 Aug 2009 20:31:52 +0000 (22:31 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 2 Aug 2009 20:31:52 +0000 (22:31 +0200)
include/workspace.h
src/commands.c
src/manage.c
src/workspace.c

index 2b41a5276fc169534b50a2916f30e16509937f13..9c69e55b132d55e11e13368050a295093305b35e 100644 (file)
  */
 void workspace_set_name(Workspace *ws, const char *name);
 
+/**
+ * Returns true if the workspace is currently visible. Especially important for
+ * multi-monitor environments, as they can have multiple currenlty active
+ * workspaces.
+ *
+ */
+bool workspace_is_visible(Workspace *ws);
+
 #endif
index 74f8f2a683755782a19c527478057a7f0b397b04..16b2152a138e34cf50b46b821275959aabdcb9b2 100644 (file)
@@ -27,6 +27,7 @@
 #include "floating.h"
 #include "xcb.h"
 #include "config.h"
+#include "workspace.h"
 
 bool focus_window_in_container(xcb_connection_t *conn, Container *container, direction_t direction) {
         /* If this container is empty, we’re done */
@@ -490,10 +491,8 @@ static void move_floating_window_to_workspace(xcb_connection_t *conn, Client *cl
 
         floating_assign_to_workspace(client, t_ws);
 
-        bool target_invisible = t_ws->screen->current_workspace != t_ws->num;
-
         /* If we’re moving it to an invisible screen, we need to unmap it */
-        if (target_invisible) {
+        if (!workspace_is_visible(t_ws)) {
                 LOG("This workspace is not visible, unmapping\n");
                 xcb_unmap_window(conn, client->frame);
         } else {
@@ -515,7 +514,7 @@ static void move_floating_window_to_workspace(xcb_connection_t *conn, Client *cl
 
         render_layout(conn);
 
-        if (!target_invisible)
+        if (workspace_is_visible(t_ws))
                 set_focus(conn, client, true);
 }
 
@@ -575,10 +574,8 @@ static void move_current_window_to_workspace(xcb_connection_t *conn, int workspa
         container->currently_focused = to_focus;
         to_container->currently_focused = current_client;
 
-        bool target_invisible = (to_container->workspace->screen->current_workspace != to_container->workspace->num);
-
         /* If we’re moving it to an invisible screen, we need to unmap it */
-        if (target_invisible) {
+        if (!workspace_is_visible(to_container->workspace)) {
                 LOG("This workspace is not visible, unmapping\n");
                 xcb_unmap_window(conn, current_client->frame);
         } else {
@@ -593,7 +590,7 @@ static void move_current_window_to_workspace(xcb_connection_t *conn, int workspa
 
         render_layout(conn);
 
-        if (!target_invisible)
+        if (workspace_is_visible(to_container->workspace))
                 set_focus(conn, current_client, true);
 }
 
index 5d2468334dcf32de9476ee6f7c167422eda0ff72..12d96c8c683e63758486d51b0dfc1bd278fdd520 100644 (file)
@@ -29,6 +29,7 @@
 #include "manage.h"
 #include "floating.h"
 #include "client.h"
+#include "workspace.h"
 
 /*
  * Go through all existing windows (if the window manager is restarted) and manage them
@@ -325,7 +326,7 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
                                 break;
                         }
 
-                        LOG("Changin container/workspace and unmapping the client\n");
+                        LOG("Changing container/workspace and unmapping the client\n");
                         Workspace *t_ws = &(workspaces[assign->workspace-1]);
                         if (t_ws->screen == NULL) {
                                 LOG("initializing new workspace, setting num to %d\n", assign->workspace);
@@ -338,7 +339,7 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
                         new->workspace = t_ws;
                         old_focused = new->container->currently_focused;
 
-                        map_frame = false;
+                        map_frame = workspace_is_visible(t_ws);
                         break;
                 }
         }
index d3de73e45e560b4087033b31dae9af977c2e518a..1e2aaf4ff9b37d889a36ea830f47b3950be38bf9 100644 (file)
@@ -45,3 +45,13 @@ void workspace_set_name(Workspace *ws, const char *name) {
 
         free(label);
 }
+
+/*
+ * Returns true if the workspace is currently visible. Especially important for
+ * multi-monitor environments, as they can have multiple currenlty active
+ * workspaces.
+ *
+ */
+bool workspace_is_visible(Workspace *ws) {
+        return (ws->screen->current_workspace == ws->num);
+}