Hi there, I wrote a small and very very straight forward patch for FvwmScript module so that a previously (or higher) given colorset is not overwritten by a color definition. Take a look at the attached script and both screenshots.
I know the patch is not very nice and leads to unnecessary memory consumtion. Maybe someone can make better ;-) I see it as a prov-of-concept. Cheers, Uwe -- ,_, For personal reply/mail put "fvwm" (O,O) in the subject. ( ) Otherwise your mail is discarded by a filter. =-"-"-= http://www.tu-chemnitz.de/~uwp
? patch.FvwmScript Index: FvwmScript.c =================================================================== RCS file: /home/cvs/fvwm/fvwm/modules/FvwmScript/FvwmScript.c,v retrieving revision 1.71 diff -u -r1.71 FvwmScript.c --- FvwmScript.c 7 Jun 2004 13:53:50 -0000 1.71 +++ FvwmScript.c 5 Feb 2005 12:35:20 -0000 @@ -529,12 +529,31 @@ } } +char* CreateColorString(Pixel pixel) { + char tmp[128]; + XColor color; + color.pixel=pixel; + color.red=0; + color.green=0; + color.blue=0; + XQueryColor(dpy, Pcmap, &color); + sprintf(tmp, "#%02x%02x%02x", (color.red>>8)&0xff, (color.green>>8)&0xff, (color.blue>>8)&0xff); + return safestrdup(tmp); +} /* Construction de l'interface graphique */ void BuildGUI(int IsFather) { int i; + /* Inherit color values from colorset */ + if (scriptprop->colorset != -1) { + x11base->backcolor=CreateColorString(Colorset[scriptprop->colorset].bg); + x11base->forecolor=CreateColorString(Colorset[scriptprop->colorset].fg); + x11base->hilicolor=CreateColorString(Colorset[scriptprop->colorset].hilite); + x11base->shadcolor=CreateColorString(Colorset[scriptprop->colorset].shadow); + } + if (scriptprop->font != NULL) { /* leak! */
#-*-shell-script-*- #--------------------------------------------------------------------- #- File : cable_modem.FvwmScript #- Date : Mon May 3 20:52:04 2004 #- Author : Uwe Pross #--------------------------------------------------------------------- WindowTitle {CableModemFvwmScript} # This option sets the window title. WindowSize 60 40 # This option sets window size. width and height are numerical value. # WindowPosition x y # This option sets window position. x and y are numerical value. # ForeColor {color} # This option sets the default foreground color for all widgets. # BackColor $[bg.cs1] # This option sets the default background color for all widgets. # HilightColor {color} # This option sets the default hilight color for all widgets. # ShadowColor {color} # This option sets the default shadow color for all widgets. Colorset 10 # This option sets the default colorset for all widgets. Font -*-fixed-medium-*-*-*-10-*-*-*-*-*-*-* # Font $[DEFAULT_FONT] # This option sets the default font color for all widgets. # UseGettext [locale_path] # Enable the use of the gettext mechanism which is used by the # WindowLocaleTitle, LocaleTitle, ChangeLocaleTitle instructions and the # Gettext function. If no argument is given, the default FvwmScript # locale catalog is used. This catalog is under the locale fvwm # installation direc- tory and the text domain is FvwmScript # (install_prefix/share/locale/*/LC_MESSAGES/FvwmScript.mo). You can # reset this catalog or add some catalogs exactly in the same way than # with the LocalePath fvwm command (see the fvwm manual page). This # instruction should be placed before the WindowLocaleTitle instruction. # WindowLocaleTitle string # This option sets the window title, but use the locale catalog(s) defined with UseGettext. #--------------------------------------------------------------------- # INITIALISATION # This part contains instructions which will be executed at the startup. Init Begin Set $interval = 1 End #--------------------------------------------------------------------- # PERIODIC TASKS # This part of the script contains instructions that are periodicly. PeriodicTasks Begin If (RemainderOfDiv (GetTime) $interval)==0 Then Begin # show that we are dooing something ChangeValue 3 1 If $interval < 1000 Then Begin Set $interval = (Mult $interval 2) End Set $ip = (GetOutput {/sbin/ifconfig eth0 | grep 'inet addr:' | sed 's/.*inet addr:\([0-9\.][0-9\.]*\).*/\1/'} 1 -1) ChangeTitle 5 $ip If $ip=={} Then Begin # cable modem is not connected ChangeValue 2 0 ChangeValue 3 0 ChangeValue 4 1 End Else Begin # cable modem is connected ChangeValue 2 1 ChangeValue 3 0 ChangeValue 4 0 End End End #--------------------------------------------------------------------- # Widgets #--------------------------------------------------------------------- # Title string Widget 1 Property Size 60 10 Type ItemDraw Title {Internet} Position 0 0 Flags NoReliefString Center Main Case message of SingleClic : Begin End End Widget 2 Property Type RadioButton # Title {On} ForeColor {green1} Position 5 15 Flags NoReliefString Left Main Case message of SingleClic : Begin Do {Exec /usr/bin/sudo /etc/init.d/cable_modem restart} Set $interval=2 ChangeValue 2 0 ChangeValue 3 1 ChangeValue 4 0 End End Widget 3 Property Type RadioButton Position 20 15 # Title {processing} ForeColor {yellow} Flags NoReliefString Left Main Case message of SingleClic : Begin Set $interval=2 ChangeValue 2 0 ChangeValue 3 1 ChangeValue 4 0 End End Widget 4 Property Type RadioButton Position 35 15 # Title {Off} ForeColor {red} Flags NoReliefString Left Main Case message of SingleClic : Begin Do {Exec /usr/bin/sudo /etc/init.d/cable_modem stop} Set $interval=2 ChangeValue 2 0 ChangeValue 3 1 ChangeValue 4 0 End End Widget 5 Property Type ItemDraw Title {---.---.---.---} Position 0 30 Font -*-fixed-medium-*-*-*-6-*-*-*-*-*-*-* Flags NoReliefString Center Main Case message of SingleClic : Begin Do { Exec printf } $ip {| xclip -i} # Set $interval=1 End End #--------------------------------------------------------------------- # end of file
with_patch.gif
Description: GIF image
without_patch.gif
Description: GIF image