Bugfix: don't lose focus on fullscreen windows when another window

gets moved to that workspace
(upstream git commit f78caf8c5815ae7a66de9e4b734546fd740cc19d)

Bugfix: open new windows in the correct place when assignments match
(upstream git commit d4238c778a199ad88ebe8540904d98f81f110621)

Fix assignments of floating windows to (yet) unused workspaces
(upstream git commit 96c491a4885bf33802e1be883dbf5fe24bece650)
This commit is contained in:
dcoppa 2012-01-11 13:33:48 +00:00
parent b607262b7e
commit c4fa8c3728
3 changed files with 90 additions and 1 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.22 2011/12/27 09:05:17 dcoppa Exp $
# $OpenBSD: Makefile,v 1.23 2012/01/11 13:33:48 dcoppa Exp $
COMMENT = improved dynamic tiling window manager
DISTNAME = i3-4.1.1
REVISION = 0
CATEGORIES = x11
EXTRACT_SUFX = .tar.bz2

View File

@ -0,0 +1,51 @@
$OpenBSD: patch-src_con_c,v 1.4 2012/01/11 13:33:48 dcoppa Exp $
Bugfix: don't lose focus on fullscreen windows when another window
gets moved to that workspace
(upstream git commit f78caf8c5815ae7a66de9e4b734546fd740cc19d)
Bugfix: open new windows in the correct place when assignments match
(upstream git commit d4238c778a199ad88ebe8540904d98f81f110621)
--- src/con.c.orig Wed Jan 11 14:13:26 2012
+++ src/con.c Wed Jan 11 14:17:15 2012
@@ -656,8 +656,10 @@ void con_move_to_workspace(Con *con, Con *workspace, b
con_fix_percent(next);
/* 7: focus the con on the target workspace (the X focus is only updated by
- * calling tree_render(), so for the "real" focus this is a no-op). */
- con_focus(con_descend_focused(con));
+ * calling tree_render(), so for the "real" focus this is a no-op).
+ * We don't focus when there is a fullscreen con on that workspace. */
+ if (con_get_fullscreen_con(workspace, CF_OUTPUT) == NULL)
+ con_focus(con_descend_focused(con));
/* 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
@@ -806,7 +808,7 @@ Con *con_get_next(Con *con, char way, orientation_t or
*/
Con *con_descend_focused(Con *con) {
Con *next = con;
- while (!TAILQ_EMPTY(&(next->focus_head)))
+ while (next != focused && !TAILQ_EMPTY(&(next->focus_head)))
next = TAILQ_FIRST(&(next->focus_head));
return next;
}
@@ -823,6 +825,8 @@ Con *con_descend_tiling_focused(Con *con) {
Con *next = con;
Con *before;
Con *child;
+ if (next == focused)
+ return next;
do {
before = next;
TAILQ_FOREACH(child, &(next->focus_head), focused) {
@@ -832,7 +836,7 @@ Con *con_descend_tiling_focused(Con *con) {
next = child;
break;
}
- } while (before != next);
+ } while (before != next && next != focused);
return next;
}

View File

@ -0,0 +1,37 @@
$OpenBSD: patch-src_floating_c,v 1.7 2012/01/11 13:33:48 dcoppa Exp $
Fix assignments of floating windows to (yet) unused workspaces
(upstream git commit 96c491a4885bf33802e1be883dbf5fe24bece650)
--- src/floating.c.orig Wed Jan 11 14:18:12 2012
+++ src/floating.c Wed Jan 11 14:19:35 2012
@@ -82,9 +82,17 @@ void floating_enable(Con *con, bool automatic) {
* otherwise. */
Con *ws = con_get_workspace(con);
nc->parent = ws;
+ nc->orientation = NO_ORIENTATION;
+ nc->type = CT_FLOATING_CON;
+ /* We insert nc already, even though its rect is not yet calculated. This
+ * is necessary because otherwise the workspace might be empty (and get
+ * closed in tree_close()) even though it's not. */
+ TAILQ_INSERT_TAIL(&(ws->floating_head), nc, floating_windows);
+ TAILQ_INSERT_TAIL(&(ws->focus_head), nc, focused);
/* check if the parent container is empty and close it if so */
- if ((con->parent->type == CT_CON || con->parent->type == CT_FLOATING_CON) && con_num_children(con->parent) == 0) {
+ if ((con->parent->type == CT_CON || con->parent->type == CT_FLOATING_CON) &&
+ con_num_children(con->parent) == 0) {
DLOG("Old container empty after setting this child to floating, closing\n");
tree_close(con->parent, DONT_KILL_WINDOW, false, false);
}
@@ -158,10 +166,6 @@ void floating_enable(Con *con, bool automatic) {
}
DLOG("Floating rect: (%d, %d) with %d x %d\n", nc->rect.x, nc->rect.y, nc->rect.width, nc->rect.height);
- nc->orientation = NO_ORIENTATION;
- nc->type = CT_FLOATING_CON;
- TAILQ_INSERT_TAIL(&(ws->floating_head), nc, floating_windows);
- TAILQ_INSERT_TAIL(&(ws->focus_head), nc, focused);
/* 3: attach the child to the new parent container */
con->parent = nc;