From e1f12ad4182e63197494b46499eb709ea0536c13 Mon Sep 17 00:00:00 2001 From: Jaimos Skriletz Date: Sun, 10 Nov 2024 11:32:40 -0700 Subject: [PATCH] FvwmPager: Use ULONG_MAX to identify a non configured Pixel. The black pixel is 0, so if a user configures the window foreground or focus foreground to be black, when testing if the pixel has been configured, the test fails and the pager falls back to using the pixel provided by fvwm. Instead use ULONG_MAX to identify if the window foreground and focus foreground pixel has been defined by the user or not. This fixes #1105. --- modules/FvwmPager/init_pager.c | 4 ++-- modules/FvwmPager/x_pager.c | 2 +- modules/FvwmPager/x_update.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/FvwmPager/init_pager.c b/modules/FvwmPager/init_pager.c index ae7b38ce2..17d002fa1 100644 --- a/modules/FvwmPager/init_pager.c +++ b/modules/FvwmPager/init_pager.c @@ -183,9 +183,9 @@ void initialize_desks_and_monitors(void) default_style->bg = GetSimpleColor("white"); default_style->hi_fg = GetSimpleColor("black"); default_style->hi_bg = GetSimpleColor("grey"); - default_style->win_fg = None; /* Use fvwm pixel unless defined. */ + default_style->win_fg = ULONG_MAX; /* Use fvwm pixel unless defined. */ default_style->win_bg = None; - default_style->focus_fg = None; + default_style->focus_fg = ULONG_MAX; default_style->focus_bg = None; default_style->balloon_fg = None; default_style->balloon_bg = None; diff --git a/modules/FvwmPager/x_pager.c b/modules/FvwmPager/x_pager.c index f6cbff283..704a7c323 100644 --- a/modules/FvwmPager/x_pager.c +++ b/modules/FvwmPager/x_pager.c @@ -2055,7 +2055,7 @@ void setup_balloon_window(PagerWindow *t) Balloon.cs = style->balloon_cs; fg = (style->balloon_fg) ? style->balloon_fg : - (style->win_fg) ? style->win_fg : t->text; + (style->win_fg < ULONG_MAX) ? style->win_fg : t->text; XSetForeground(dpy, Balloon.gc, fg); XUnmapWindow(dpy, Scr.balloon_w); diff --git a/modules/FvwmPager/x_update.c b/modules/FvwmPager/x_update.c index 4932e70a9..3b7375dc5 100644 --- a/modules/FvwmPager/x_update.c +++ b/modules/FvwmPager/x_update.c @@ -294,10 +294,10 @@ void do_label_window(PagerWindow *t, Window w, rectangle r) DeskStyle *style = FindDeskStyle(t->desk); if (t == FocusWin) { - pix = (style->focus_fg) ? style->focus_fg : Scr.focus_win_fg; + pix = (style->focus_fg < ULONG_MAX) ? style->focus_fg : Scr.focus_win_fg; cs = style->focus_cs; } else { - pix = (style->win_fg) ? style->win_fg : t->text; + pix = (style->win_fg < ULONG_MAX) ? style->win_fg : t->text; cs = style->win_cs; } XSetForeground(dpy, Scr.NormalGC, pix); @@ -453,7 +453,7 @@ void do_border_window(PagerWindow *t, Window w, rectangle r) } if (t == FocusWin) { - if (style->focus_fg) + if (style->focus_fg < ULONG_MAX) XSetForeground(dpy, style->focus_hi_gc, style->focus_fg); else @@ -464,7 +464,7 @@ void do_border_window(PagerWindow *t, Window w, rectangle r) style->focus_hi_gc, style->focus_hi_gc, WindowBorderWidth); } else { - if (style->win_fg) + if (style->win_fg < ULONG_MAX) XSetForeground(dpy, style->win_hi_gc, style->win_fg); else