I'm sorry, I've attached the wrong file. This is the correct one

On Wed, Jul 27, 2022 at 1:34 AM Vitaly Shevtsov <loki...@gmail.com> wrote:
>
> Hello! I tried a patch that implements stack-based window switching.
> This works pretty much as I would expect, except for one thing. ctwm
> does not update the stack when a window receives focus. I made some
> changes to the attached patch. Could you review it and let me know
> what you think? This updates the stack when the window gets focus and
> makes ctwm more usable (from my point of view).
> --
> Vitaly



-- 
Vitaly
diff --git a/win_ops.c b/win_ops.c
index 4bb5842a..07ef341f 100644
--- a/win_ops.c
+++ b/win_ops.c
@@ -18,6 +18,7 @@
 #include "win_iconify.h"
 #include "win_ops.h"
 #include "win_utils.h"
+#include "win_ring.h"
 
 
 /*
@@ -103,6 +104,7 @@ SetFocusVisualAttributes(TwmWindow *tmp_win, bool focus)
 		if(tmp_win->iconmanagerlist) {
 			NotActiveIconManager(tmp_win->iconmanagerlist);
 		}
+
 	}
 	if(Scr->use3Dtitles && Scr->SunkFocusWindowTitle && tmp_win->title_height) {
 		ButtonState bs;
@@ -172,6 +174,13 @@ SetFocus(TwmWindow *tmp_win, Time tim)
 			// Pre-sets Scr->Focus
 		}
 #endif
+
+        if (Scr->StackLeader) {
+            UnlinkWindowFromRing(tmp_win);
+            AddWindowToRingUnchecked(tmp_win, Scr->StackLeader->ring.prev);
+            Scr->RingLeader = tmp_win;
+            Scr->StackLeader = NULL;
+        }
 	}
 
 	// in the EWMH cases, this was already done.

Reply via email to