Hello,

Since it got annoying to me, I tried to fix issue 809 
(http://bugs.i3wm.org/report/ticket/809). I'm not completely sure if I made 
everything right, but it worked as expected when I tested it.

Best Regards
From a5f28f8602ec01a086fc791fc080116a10c8d9cc Mon Sep 17 00:00:00 2001
From: Sebastian Rachuj <[email protected]>
Date: Sat, 9 Feb 2013 20:23:01 +0100
Subject: [PATCH] Bugfix: Do not move the focus if a container is moved on a
 visible output

---
 src/con.c | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/src/con.c b/src/con.c
index ad5025a..09f3bae 100644
--- a/src/con.c
+++ b/src/con.c
@@ -762,24 +762,18 @@ void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates, bool
             con_focus(old_focus);
     }
 
-    /* 8: when moving to a visible workspace on a different output, we keep the
-     * con focused. Otherwise, we leave the focus on the current workspace as we
-     * don’t want to focus invisible workspaces */
-    if (source_output != dest_output &&
-        workspace_is_visible(workspace) &&
-        !con_is_internal(workspace)) {
-        DLOG("Moved to a different output, focusing target\n");
-    } else {
-        /* Descend focus stack in case focus_next is a workspace which can
-         * occur if we move to the same workspace.  Also show current workspace
-         * to ensure it is focused. */
-        workspace_show(current_ws);
-
-        /* Set focus only if con was on current workspace before moving.
-         * Otherwise we would give focus to some window on different workspace. */
-        if (source_ws == current_ws)
+    /* 8: when moving to another workspace, we leave the focus on the current
+     * workspace. (see also #809) */
+
+    /* Descend focus stack in case focus_next is a workspace which can
+     * occur if we move to the same workspace.  Also show current workspace
+     * to ensure it is focused. */
+    workspace_show(current_ws);
+
+    /* Set focus only if con was on current workspace before moving.
+     * Otherwise we would give focus to some window on different workspace. */
+    if (source_ws == current_ws)
             con_focus(con_descend_focused(focus_next));
-    }
 
     /* If anything within the container is associated with a startup sequence,
      * delete it so child windows won't be created on the old workspace. */
-- 
1.8.1.3

Reply via email to