JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fix: show (opaque) slave when floater has focused
authorJason Woofenden <jason@jasonwoof.com>
Mon, 23 Feb 2015 03:09:23 +0000 (22:09 -0500)
committerJason Woofenden <jason@jasonwoof.com>
Mon, 23 Feb 2015 03:24:34 +0000 (22:24 -0500)
Previously there was a bug where it was tabified when a floater was focused.

In addition to correcting the placement of the first slave window, it is made
opaque when a floater has focus. The master window has this behavior already,
and why not the slave too?

The primary use-case for behavior (going opaque when a floater has focus) is
dialogs that show "live changes" in the main window, such as the "Colorize..."
dialog in the gimp.

dwm.c

diff --git a/dwm.c b/dwm.c
index 362e902..6f43444 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -317,7 +317,7 @@ update_window_opacities(Monitor *m) {
        }
        for (c = m->clients; c; c = c->next) {
                if (ISVISIBLE(c)) {
        }
        for (c = m->clients; c; c = c->next) {
                if (ISVISIBLE(c)) {
-                       if (c->isfloating || c == m->sel || (c == master && selection_floating)) {
+                       if (c->isfloating || c == m->sel || (selection_floating && (c == master || c == slave))) {
                                window_set_opaque(c);
                        } else if (c == master || c == slave) {
                                window_set_translucent(c);
                                window_set_opaque(c);
                        } else if (c == master || c == slave) {
                                window_set_translucent(c);
@@ -1778,12 +1778,12 @@ jason_layout(Monitor *m) {
 
        for(tiled_count = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), tiled_count++) {
                if (tiled_count == 0) { // master
 
        for(tiled_count = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), tiled_count++) {
                if (tiled_count == 0) { // master
-                       if (c == m->sel) {
-                               if (c->next) {
+                       if (c->next) {
+                               if (m->sel && (m->sel == c || m->sel->isfloating || !ISVISIBLE(m->sel))) {
                                        vis_slave = nexttiled(c->next);
                                        vis_slave = nexttiled(c->next);
+                               } else {
+                                       vis_slave = m->sel;
                                }
                                }
-                       } else {
-                               vis_slave = m->sel;
                        }
                } else {
                        if (c == vis_slave) {
                        }
                } else {
                        if (c == vis_slave) {
@@ -1800,10 +1800,6 @@ jason_layout(Monitor *m) {
        if(tiled_count > 1 || (tiled_count == 1 && !nexttiled(m->clients)->screen_hog)) {
                mw = m->ww * m->mfact;
        } else {
        if(tiled_count > 1 || (tiled_count == 1 && !nexttiled(m->clients)->screen_hog)) {
                mw = m->ww * m->mfact;
        } else {
-               // one of these:
-               // * zero tiled windows
-               // * one tiled window that's not a screen hog
-               // * miltiple tiled windows
                mw = m->ww;
        }
        right_width = m->ww - mw;
                mw = m->ww;
        }
        right_width = m->ww - mw;