At Tue, 12 Nov 2024 15:20:25 -0800, "Greg A. Woods" <[email protected]> wrote: Subject: titlebar and map window color should be reset when title changes > > In fact I haven't figured out any way to interactively convince CTWM to > change the titlebar color after the title changes.
So, I found some commented out code in win_utils.c:apply_window_name()
that seemed to try to reload the color pairs for window titles.
It was marked "/* Experimental, not yet working. */", so I enabled it
anyway to see what would happen.
Initially nothing seemed to happen so I did some more fiddling around to
move the SetupWindow() call below the ColorPair fetching:
diff --git a/win_utils.c b/win_utils.c
index a6c262a7..fb5c2a81 100644
--- a/win_utils.c
+++ b/win_utils.c
@@ -1210,17 +1210,7 @@ apply_window_name(TwmWindow *win)
OtpRecomputePrefs(win);
}
- SetupWindow(win, win->frame_x, win->frame_y,
- win->frame_width, win->frame_height, -1);
-
- if(win->title_w) {
- XClearArea(dpy, win->title_w, 0, 0, 0, 0, True);
- }
- if(Scr->AutoOccupy) {
- WmgrRedoOccupation(win);
- }
-
-#if 0
+#if 1
/* Experimental, not yet working. */
{
ColorPair cp;
@@ -1260,6 +1250,16 @@ apply_window_name(TwmWindow *win)
}
#endif
+ SetupWindow(win, win->frame_x, win->frame_y,
+ win->frame_width, win->frame_height, -1);
+
+ if(win->title_w) {
+ XClearArea(dpy, win->title_w, 0, 0, 0, 0, True);
+ }
+ if(Scr->AutoOccupy) {
+ WmgrRedoOccupation(win);
+ }
+
/*
* If we haven't set a separate icon name, we use the window name, so
* we need to update it.
Now it _is_ working! Yay!
Perhaps the same updating of color pairs for the map windows in the
workstation widget (and icon labels) would also now work? Let's try:
diff --git a/workspace_manager.c b/workspace_manager.c
index 5c07c3d3..d95cce4f 100644
--- a/workspace_manager.c
+++ b/workspace_manager.c
@@ -1996,11 +1996,28 @@ WMapUpdateIconName(TwmWindow *win)
void
WMapRedrawName(VirtualScreen *vs, WinList *wl)
{
- ColorPair cp = wl->cp;
+ ColorPair cp;
+
+ /* Reset coloring for the window [xxx code shared with
WMapAddWindowToWorkspace()] */
+ cp.back = wl->twm_win->title.back;
+ cp.fore = wl->twm_win->title.fore;
+ if(Scr->workSpaceMgr.windowcpgiven) {
+ cp.back = Scr->workSpaceMgr.windowcp.back;
+ GetColorFromList(Scr->workSpaceMgr.windowBackgroundL,
+ wl->twm_win->name, &wl->twm_win->class,
&cp.back);
+ cp.fore = Scr->workSpaceMgr.windowcp.fore;
+ GetColorFromList(Scr->workSpaceMgr.windowForegroundL,
+ wl->twm_win->name, &wl->twm_win->class,
&cp.fore);
+ }
+ if(Scr->use3Dwmap && !Scr->BeNiceToColormap) {
+ GetShadeColors(&cp);
+ }
if(Scr->ReverseCurrentWorkspace && wl->wlist == vs->wsw->currentwspc) {
InvertColorPair(&cp);
}
+
+ /* xxx note the colors above are looked up by window name, but the icon
name is drawn */
WMapRedrawWindow(wl->w, wl->width, wl->height, cp,
wl->twm_win->icon_name);
}
Yay! That works too!
Oddly some other colors are not being set now, and which were working
before, most importantly "MenuTitleBackground", but only on some
displays, such as my main macos system running full-screen Xquartz! On
another macbook with the same software it fails as well, but in an Xnest
test environment, nested on the same main display but running on a
NetBSD server, and on a third mac with older macos but up-to-date
Xquartz, it does still work!
It's all very confusing.
Perhaps this confusion has something to do with the dump of errors
related to colors that I see on startup. Hundreds like these (only a
few, including the first two, are X_FreeColors -- all the rest are
X_StoreColors, with a jump in serial numbers somewhere in the middle of
the mess near another X_FreeColors related message):
X Error of failed request: BadAccess (attempt to access private resource
denied)
Major opcode of failed request: 88 (X_FreeColors)
Serial number of failed request: 5356
Current serial number in output stream: 5494
X Error of failed request: BadAccess (attempt to access private resource
denied)
Major opcode of failed request: 88 (X_FreeColors)
Serial number of failed request: 5357
Current serial number in output stream: 5494
X Error of failed request: BadAccess (attempt to access private resource
denied)
Major opcode of failed request: 89 (X_StoreColors)
Serial number of failed request: 5358
Current serial number in output stream: 5494
--
Greg A. Woods <[email protected]>
Kelowna, BC +1 250 762-7675 RoboHack <[email protected]>
Planix, Inc. <[email protected]> Avoncote Farms <[email protected]>
pgpYI7Uh1PO2H.pgp
Description: OpenPGP Digital Signature
