Package: fvwm
Version: 1:2.5.26-1
Severity: normal
Tags: patch

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.

Note: I sent the patch to the fvwm-workers mailing list a month ago, but
nobody bothered to reply.
(http://www.mail-archive.com/[email protected]/msg01872.html)

norbi


-- System Information:
Debian Release: 5.0.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26 (PREEMPT)
Locale: LANG=C, LC_CTYPE=hu_HU (charmap=ISO-8859-2)
Shell: /bin/sh linked to /bin/bash

Versions of packages fvwm depends on:
ii  libc6                  2.7-18            GNU C Library: Shared libraries
ii  libcairo2              1.6.4-7           The Cairo 2D vector graphics libra
ii  libfontconfig1         2.6.0-3           generic font configuration library
ii  libfreetype6           2.3.7-2+lenny1    FreeType 2 font engine, shared lib
ii  libfribidi0            0.10.9-1          Free Implementation of the Unicode
ii  libglib1.2ldbl         1.2.10-19         The GLib library of C routines
ii  libglib2.0-0           2.16.6-1+lenny1   The GLib library of C routines
ii  libgtk1.2              1.2.10-18.1       The GIMP Toolkit set of widgets fo
ii  libgtk2.0-0            2.12.12-1~lenny1  The GTK+ graphical user interface 
ii  libice6                2:1.0.4-1         X11 Inter-Client Exchange library
ii  libncurses5            5.7+20081213-1    shared libraries for terminal hand
ii  libpng12-0             1.2.27-2+lenny2   PNG library - runtime
ii  libreadline5           5.2-3.1           GNU readline and history libraries
ii  librplay3              3.3.2-11.1        Shared libraries for the rplay net
ii  librsvg2-2             2.22.2-2lenny1    SAX-based renderer library for SVG
ii  libsm6                 2:1.0.3-2         X11 Session Management library
ii  libstroke0             0.5.1-6           mouse strokes library -- runtime f
ii  libx11-6               2:1.1.5-2         X11 client-side library
ii  libxcursor1            1:1.1.9-1         X cursor management library
ii  libxext6               2:1.0.4-1         X11 miscellaneous extension librar
ii  libxft2                2.1.12-3          FreeType-based font drawing librar
ii  libxi6                 2:1.1.4-1         X11 Input extension library
ii  libxinerama1           2:1.0.3-2         X11 Xinerama extension library
ii  libxpm4                1:3.5.7-1         X11 pixmap library
ii  libxrender1            1:0.9.4-2         X Rendering Extension client libra
ii  zlib1g                 1:1.2.3.3.dfsg-12 compression library - runtime

Versions of packages fvwm recommends:
ii  fvwm-icons                  2001.08.13-6 XPMs icons from fvwm development s

Versions of packages fvwm suggests:
ii  cpp                       4:4.3.2-2      The GNU C preprocessor (cpp)
pn  fvwm-themes               <none>         (no description available)
ii  libx11-protocol-perl      0.56-2         Perl module for the X Window Syste
ii  m4                        1.4.11-1       a macro processing language
ii  menu                      2.1.41         generates programs menu for all me
ii  perl-tk                   1:804.028-1+b1 Perl module providing the Tk graph
ii  wm-icons                  0.4.0-3        Themed icon set that is Window Man

-- debconf information:
  fvwm/upgrade/pre_2.5.8: false
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