Some enhancements for stack based window switching

Vitaly Shevtsov <[email protected]> Wed, 27 Jul 2022 01:34:17 +0500
Newsgroups gmane.comp.window-managers.ctwm
Message-ID <CAPHwUj4=5NVQHUpewUY9ajL-uNnj4Dixuc_bxhPPVus384L1yw@mail.gmail.com>
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
ctwm_update_stack_on_focus.diff (text/x-patch, 620 B)
--- win_ops.c	2022-07-27 01:32:19.065034575 +0500
+++ win_ops.c	2022-07-27 01:32:24.537034698 +0500
@@ -18,6 +18,7 @@
 #include "win_iconify.h"
 #include "win_ops.h"
 #include "win_utils.h"
+#include "win_ring.h"
 
 
 /*
@@ -103,6 +104,11 @@
 		if(tmp_win->iconmanagerlist) {
 			NotActiveIconManager(tmp_win->iconmanagerlist);
 		}
+
+        UnlinkWindowFromRing(tmp_win);
+        AddWindowToRingUnchecked(tmp_win, Scr->StackLeader->ring.prev);
+        Scr->RingLeader = tmp_win;
+        Scr->StackLeader = NULL;
 	}
 	if(Scr->use3Dtitles && Scr->SunkFocusWindowTitle && tmp_win->title_height) {
 		ButtonState bs;