Hi,

it seems that the bug report I made at
http://www.fvwm.org/cgi-bin/fvwm-bug went to the ether (at least I cannot
find my report among the tickets and I received no mails).

Here's the bug I wanted to report:

FVWM version: CVS main
Last CVS Update: 2009-04-13 14:23
OS you are using: Debian GNU/Linux 5.0, Linux 2.6.26
X Server: X.org 7.3

Currently only the focused and plain buttons can have different styles
and colors when selected, an iconified window's button always looks like
a plain window's button. I prefer to use different style and colors for
iconified windows even if they are selected.

The attached patch adds the 'IconAndSelectColorset' and
'IconAndSelectButton' configuration options.

PS: Please Cc me, I'm not on the fvwm-workers list.

norbi
Index: modules/FvwmIconMan/FvwmIconMan.1.in
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/FvwmIconMan.1.in,v
retrieving revision 1.9
diff -u -u -r1.9 FvwmIconMan.1.in
--- modules/FvwmIconMan/FvwmIconMan.1.in	7 Aug 2007 20:17:43 -0000	1.9
+++ modules/FvwmIconMan/FvwmIconMan.1.in	13 Apr 2009 12:36:22 -0000
@@ -102,7 +102,9 @@
 Foreground      default text color         white
 Format          describes button label     "%c: %i"
 IconName        manager icon name          FvwmIconMan
+IconAndSelectButton                        up black grey
 IconButton      style for icon buttons     up black grey
+IconAndSelectColorset
 IconColorset
 ManagerGeometry size of manager in buttons 0x1
 MaxButtonWidth  max width of a button
@@ -228,10 +230,18 @@
 may either be a single word, or a string enclosed in quotes. The default is
 "FvwmIconMan".
 
+.IP "*FvwmIconMan: [id] IconAndSelectButton \fIstyle\fP [\fIforecolor\fP \fIbackcolor\fP]"
+Same as the plainbutton option, but specifies the look of buttons whose
+windows are iconified and the button is selected.
+
 .IP "*FvwmIconMan: [id] IconButton \fIstyle\fP [\fIforecolor\fP \fIbackcolor\fP]"
 Same as the plainbutton option, but specifies the look of buttons whose
 windows are iconified.
 
+.IP "*FvwmIconMan: [id] IconAndSelectColorset \fIcolorset\fP"
+Works like IconAndSelectButton but uses colorsets instead.  The style setting
+can still only be applied with iconbutton.  See FvwmTheme.
+
 .IP "*FvwmIconMan: [id] IconColorset \fIcolorset\fP"
 Works like iconbutton but uses colorsets instead.  The style setting can still
 only be applied with iconbutton.  See FvwmTheme.
@@ -287,10 +297,10 @@
 \fInum\fP is an integer specifying the number of pixels thick
 that the relief at the edge of non-flat buttons should be.  Setting
 this to 0 will produce flat buttons, as if the values for
-\fIFocusAndSelectButton\fP, \fIFocusButton\fP, \fIIconButton\fP,
-\fIPlainButton\fP, \fISelectButton\fP, and \fITitleButton\fP were
-all set to \fIflat\fP.  If \fInum\fP is negative, the button
-will be inverted as if you had used \fIReverse\fP for all classes.
+\fIFocusAndSelectButton\fP, \fIFocusButton\fP, \fIIconAndSelectButton\fP,
+\fIIconButton\fP, \fIPlainButton\fP, \fISelectButton\fP, and \fITitleButton\fP
+were all set to \fIflat\fP.  If \fInum\fP is negative, the button will be
+inverted as if you had used \fIReverse\fP for all classes.
 
 .IP "*FvwmIconMan: [id] Resolution \fIresolution\fP"
 Specifies when the manager will display an entry for a certain
Index: modules/FvwmIconMan/FvwmIconMan.h
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/FvwmIconMan.h,v
retrieving revision 1.61
diff -u -u -r1.61 FvwmIconMan.h
--- modules/FvwmIconMan/FvwmIconMan.h	28 Jan 2007 15:29:26 -0000	1.61
+++ modules/FvwmIconMan/FvwmIconMan.h	13 Apr 2009 12:36:22 -0000
@@ -100,6 +100,7 @@
 	PLAIN_CONTEXT = 4,
 	TITLE_CONTEXT = 5,
 	ICON_CONTEXT = 6,
+	ICON_SELECT_CONTEXT = 7,
 	NUM_CONTEXTS
 } Contexts;
 
Index: modules/FvwmIconMan/fvwm.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/fvwm.c,v
retrieving revision 1.66
diff -u -u -r1.66 fvwm.c
--- modules/FvwmIconMan/fvwm.c	7 Aug 2007 20:17:43 -0000	1.66
+++ modules/FvwmIconMan/fvwm.c	13 Apr 2009 12:36:22 -0000
@@ -190,7 +190,17 @@
 	win->width = body->add_config_data.frame_width;
 	win->height = body->add_config_data.frame_height;
 	win->iconified =  IS_ICONIFIED(&(body->add_config_data));
-	win->state = (win == fvwm_focus_win) ? FOCUS_CONTEXT : PLAIN_CONTEXT;
+	if (win == fvwm_focus_win) {
+		win->state = FOCUS_CONTEXT;
+	}
+	else if (win->iconified)
+	{
+		win->state = ICON_CONTEXT;
+	}
+	else
+	{
+		win->state = PLAIN_CONTEXT;
+	}
 	win->geometry_set = 1;
 	memcpy(&(win->flags), &(body->add_config_data.flags),
 		sizeof(win->flags));
Index: modules/FvwmIconMan/readconfig.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/readconfig.c,v
retrieving revision 1.67
diff -u -u -r1.67 readconfig.c
--- modules/FvwmIconMan/readconfig.c	2 Jun 2007 22:27:55 -0000	1.67
+++ modules/FvwmIconMan/readconfig.c	13 Apr 2009 12:36:23 -0000
@@ -1890,6 +1890,9 @@
       else if (!strcasecmp(option1, "iconButton")) {
 	handle_button_config(manager, ICON_CONTEXT, option1);
       }
+      else if (!strcasecmp(option1, "iconandselectButton")) {
+	handle_button_config(manager, ICON_SELECT_CONTEXT, option1);
+      }
       else if (!strcasecmp(option1, "plainButton")) {
 	handle_button_config(manager, PLAIN_CONTEXT, option1);
       }
@@ -1989,6 +1992,20 @@
 	SET_MANAGER(manager, colorsets[ICON_CONTEXT], n);
 	AllocColorset(n);
       }
+      else if (!strcasecmp(option1, "iconandselectcolorset")) {
+	p = read_next_cmd(READ_ARG);
+	if (!p) {
+	  ConsoleMessage("Bad line: %s\n", current_line);
+	  continue;
+	}
+	if (extract_int(p, &n) == 0) {
+	  ConsoleMessage("This is not a number: %s\n", p);
+	  ConsoleMessage("Bad line: %s\n", current_line);
+	  continue;
+	}
+	SET_MANAGER(manager, colorsets[ICON_SELECT_CONTEXT], n);
+	AllocColorset(n);
+      }
       else if (!strcasecmp(option1, "usewinlist")) {
 	p = read_next_cmd(READ_ARG);
 	if (!p) {
Index: modules/FvwmIconMan/xmanager.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/xmanager.c,v
retrieving revision 1.95
diff -u -u -r1.95 xmanager.c
--- modules/FvwmIconMan/xmanager.c	28 Jan 2007 15:29:26 -0000	1.95
+++ modules/FvwmIconMan/xmanager.c	13 Apr 2009 12:36:25 -0000
@@ -744,6 +744,8 @@
 	WinData *man_data = NULL;
 	Bool do_animate = True;
 
+	int old_state = win->state;
+
 	if (win->button != NULL && (win->iconified != iconified) )
 	{
 		if (win->manager->flags.is_shaded)
@@ -835,7 +837,15 @@
 		win->button->drawn_state.dirty_flags |= ICON_STATE_CHANGED;
 	}
 	win->iconified = iconified;
-	if (!iconified)
+	if (iconified)
+	{
+		win->state = ICON_CONTEXT;
+		if (globals.select_win == win)
+		{
+			add_win_state(win, SELECT_CONTEXT);
+		}
+	}
+	else
 	{
 		win->state = PLAIN_CONTEXT;
 		if (globals.select_win == win)
@@ -847,6 +857,8 @@
 			add_win_state(win, FOCUS_CONTEXT);
 		}
 	}
+    ConsoleDebug(X11, "set_win_iconified: win->state: 0x%x -> 0x%x\n",
+    	old_state, win->state);
 }
 
 void set_win_state(WinData *win, int state)
@@ -880,6 +892,11 @@
 		{
 			win->state = FOCUS_SELECT_CONTEXT;
 		}
+		else if (win->state == ICON_CONTEXT ||
+			 win->state == ICON_SELECT_CONTEXT)
+		{
+			win->state = ICON_SELECT_CONTEXT;
+		}
 		else
 		{
 			win->state = SELECT_CONTEXT;
@@ -894,18 +911,26 @@
 	{
 		win->button->drawn_state.dirty_flags |= STATE_CHANGED;
 	}
-	ConsoleDebug(X11, "add_win_state: %s 0x%x\n", win->titlename, flag);
+	ConsoleDebug(X11, "add_win_state: %s 0x%x 0x%x -> 0x%x\n", win->titlename, flag, old_state, win->state);
 }
 
 /* this is "broken" */
 void del_win_state(WinData *win, int flag)
 {
+	int old_state = win->state;
 
 	if (flag == FOCUS_CONTEXT)
 	{
 		if (win->state == FOCUS_SELECT_CONTEXT)
 		{
-			win->state = SELECT_CONTEXT;
+			if (win->iconified)
+			{
+				win->state = ICON_SELECT_CONTEXT;
+			}
+			else
+			{
+				win->state = SELECT_CONTEXT;
+			}
 		}
 		else if (win->state == FOCUS_CONTEXT)
 		{
@@ -929,16 +954,13 @@
 		{
 			win->state = FOCUS_CONTEXT;
 		}
+		else if (win->state == ICON_SELECT_CONTEXT)
+		{
+			win->state = ICON_CONTEXT;
+		}
 		else if (win->state == SELECT_CONTEXT)
 		{
-			if (win->iconified)
-			{
-				win->state = ICON_CONTEXT;
-			}
-			else
-			{
-				win->state = PLAIN_CONTEXT;
-			}
+			win->state = PLAIN_CONTEXT;
 		}
 		else
 		{
@@ -954,7 +976,7 @@
 	{
 		win->button->drawn_state.dirty_flags |= STATE_CHANGED;
 	}
-	ConsoleDebug(X11, "del_win_state: %s 0x%x\n", win->titlename, flag);
+	ConsoleDebug(X11, "del_win_state: %s 0x%x 0x%x-> 0x%x\n", win->titlename, flag, old_state, win->state);
 }
 
 void set_win_displaystring(WinData *win)
@@ -1826,7 +1848,9 @@
 					man, button_state, &g, context1,
 					context2);
 			}
-			else if (button_state & SELECT_CONTEXT)
+			else if (button_state == SELECT_CONTEXT
+				 || button_state == FOCUS_SELECT_CONTEXT
+				 || button_state == ICON_SELECT_CONTEXT)
 			{
 				XDrawRectangle(
 					theDisplay, man->theWindow,
@@ -2319,6 +2343,7 @@
   int selected_index = -1;
   WinManager *man = (win->manager);
   ButtonArray *buttons;
+  int old_state = win->state;
 
   ConsoleDebug(X11, "delete_windows_button: %s\n", win->titlename);
 
@@ -2347,7 +2372,16 @@
 		  selected_index);
     move_highlight(man, man->buttons.buttons[selected_index]);
   }
-  win->state = PLAIN_CONTEXT;
+  if (win->iconified)
+  {
+    win->state = ICON_CONTEXT;
+  }
+  else
+  {
+    win->state = PLAIN_CONTEXT;
+  }
+  ConsoleDebug(X11, "delete_windows_button: win->state: 0x%x -> 0x%x\n",
+    old_state, win->state);
 }
 
 void resort_windows_button(WinData *win)

Reply via email to