Function other result calling from Menu or from ButtonMenu

Hi Guys!

I have a very strange behavior here…

From Fvwm-Nightshade i took some Functions for my Konfiguration. There is a Function, which writes the changed Value from an variable in Infostore to an file in the FVWM_USERDIR.

I wrote this Menu-Entry for the Submenu:

DestroyMenu recreate DECOSET_popup
AddToMenu DECOSET_popup "Position der Titelleiste" Title
+ DynamicPopupAction Function FuncDeco

##############################################
## Menü-Titelposition
##############################################
DestroyFunc FuncDeco
AddToFunc FuncDeco
+ I DestroyMenu recreate DECOSET_popup
+ I AddToMenu DECOSET_popup "$[infostore.used_theme]" Title
+ I Piperead '\
 echo AddToMenu DECOSET_popup \\"Oben - $[infostore.used_theme]\\" FuncChangeDecor \\"$[infostore.used_theme]\\" \\"Top\\"; \
 echo AddToMenu DECOSET_popup \\"Links - $[infostore.used_theme]\\" FuncChangeDecor \\"$[infostore.used_theme]\\" \\"Left\\"; \
 echo AddToMenu DECOSET_popup \\"Rechts - $[infostore.used_theme]\\" FuncChangeDecor \\"$[infostore.used_theme]\\" \\"Right\\"; \
 echo AddToMenu DECOSET_popup \\"Unten - $[infostore.used_theme]\\" FuncChangeDecor \\"$[infostore.used_theme]\\" \\"Bottom\\"; '

And i call the submenu “DECOSET_popup” in two different Menus.

One is in the Workmenu, the other is in a window-ops bound on Button 2 in the title.

The call is

+ "Titelleiste - Position"              Popup DECOSET_popup

The call is exact the same in both menus.

The function which is called from FuncChangeDecor, and which writes to the file and InfoStore is this:

DestroyFunc FuncWriteInfoStoreToFileAndSet
AddToFunc   FuncWriteInfoStoreToFileAndSet
+ I PipeRead 'new=`echo "$1" | xargs`; \
                        if [ `grep -c $0 $2` -gt 0 ] ; then \
                                sed -i --follow-symlinks "s#^InfoStoreAdd $0.*#InfoStoreAdd $0 \\"$new\\"#" $2; \
                        else \
                                sed -i --follow-symlinks "$ a\InfoStoreAdd $0 \\"$new\\"" $2; \
                        fi; \
                        echo InfoStoreAdd $0 "$new"; '

The Arguments $0, $1 and $2 are
$0 … Variablename for Infostore
$1 … Value
$2 … Settingsfile

A Debugcode gives me, that this 3 Variables are correct filled, when the function is called.

But the strage thing now…
The InfoStoreAdd does not work here either. This is set in the calling Function FuncChangeDecor

DestroyFunc FuncChangeDecor
AddToFunc   FuncChangeDecor
+ I PipeRead 'echo InfoStoreAdd used_theme $0'
+ I PipeRead 'echo InfoStoreAdd tpos $1'
+ I FuncSetThemeDir $[infostore.used_theme]
+ I FuncRemoveAllButtons
+ I Load $[FV_THEMEDIR]/config
+ I FuncWriteInfoStoreToFileAndSet used_theme $0 $[FVWM_USERDIR]/.settings
+ I FuncWriteInfoStoreToFileAndSet tpos $1 $[FVWM_USERDIR]/.settings
+ I ReloadLayoutParts $[infostore.used_layout]

Calling FuncChangeDecor from the WORK_MENU, changes the value in the .settings-File ($2 in FuncWriteInfoStoreToFileAndSet).
Calling FuncChangeDecor from the Mousbinding-Menu Window-Ops, noch Change in the .settings-File, but the rest ist working…

The Errormessages are also different:

Calling FuncChangeDecor from WORK_MENU gives:

X Error of failed request:  BadDrawable (invalid Pixmap or Window parameter)
  Major opcode of failed request:  62 (X_CopyArea)
  Resource id in failed request:  0x3000002
  Serial number of failed request:  55193
  Current serial number in output stream:  55238
FvwmShelf: Button too tall. Giving up
Button=1122 num_rows=62 bheight=12 h=51
l 20074380 ("BadWindow (invalid Window parameter)")
[  8905.50 ] error 3 (BadWindow) request 2 minor 0 serial 20084521 ("BadWindow (invalid Window parameter)")
[  8922.88 ] error 3 (BadWindow) request 2 minor 0 serial 20145948 ("BadWindow (invalid Window parameter)")
[  8926.07 ] error 3 (BadWindow) request 2 minor 0 serial 20166362 ("BadWindow (invalid Window parameter)")
[  8926.57 ] error 3 (BadWindow) request 2 minor 0 serial 20170962 ("BadWindow (invalid Window parameter)")
[  8985.90 ] error 3 (BadWindow) request 2 minor 0 serial 20328077 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 15 minor 0 serial 20345877 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 20 minor 0 serial 20345878 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 15 minor 0 serial 20345879 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 20 minor 0 serial 20345880 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 15 minor 0 serial 20345881 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 20 minor 0 serial 20345882 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 15 minor 0 serial 20345883 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 20 minor 0 serial 20345884 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 15 minor 0 serial 20345885 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 20 minor 0 serial 20345886 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 15 minor 0 serial 20345887 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 2 minor 0 serial 20345888 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 20 minor 0 serial 20345890 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 20 minor 0 serial 20345892 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 20 minor 0 serial 20345893 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 20 minor 0 serial 20345894 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 20 minor 0 serial 20345895 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 20 minor 0 serial 20345896 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 141 minor 5 serial 20345897 ("BadWindow (invalid Window parameter)")
[  8987.52 ] error 3 (BadWindow) request 20 minor 0 serial 20345899 ("BadWindow (invalid Window parameter)")
[  9088.51 ] error 9 (BadDrawable) request 152 minor 4 serial 20536289 ("BadDrawable (invalid Pixmap or Window parameter)")
[  9088.51 ] error 174 (BadPicture) request 152 minor 8 serial 20536290 ("RenderBadPicture (invalid Picture parameter)")
[  9088.51 ] error 9 (BadDrawable) request 14 minor 0 serial 20536300 ("BadDrawable (invalid Pixmap or Window parameter)")
[  9088.53 ] error 174 (BadPicture) request 152 minor 7 serial 20536301 ("RenderBadPicture (invalid Picture parameter)")
[  9088.53 ] error 4 (BadPixmap) request 54 minor 0 serial 20536302 ("BadPixmap (invalid Pixmap parameter)")
[  9248.71 ] error 9 (BadDrawable) request 152 minor 4 serial 20747493 ("BadDrawable (invalid Pixmap or Window parameter)")
[  9248.71 ] error 174 (BadPicture) request 152 minor 8 serial 20747494 ("RenderBadPicture (invalid Picture parameter)")
[  9248.71 ] error 9 (BadDrawable) request 14 minor 0 serial 20747501 ("BadDrawable (invalid Pixmap or Window parameter)")
[  9248.71 ] error 174 (BadPicture) request 152 minor 7 serial 20747502 ("RenderBadPicture (invalid Picture parameter)")
[  9248.71 ] error 4 (BadPixmap) request 54 minor 0 serial 20747503 ("BadPixmap (invalid Pixmap parameter)")
[  9267.89 ] error 3 (BadWindow) request 2 minor 0 serial 20812226 ("BadWindow (invalid Window parameter)")
[  9269.67 ] error 3

It stops at this half line…

Calling the same function from an other Menu gives:

[fvwm][expand_vars]: <<DEPRECATED>> 
Use $[w.name] instead of $n

[fvwm][expand_vars]: <<DEPRECATED>> 
Use $[w.name] instead of $n

[fvwm][expand_vars]: <<DEPRECATED>> 
Use $[w.name] instead of $n

sh: 1: Syntax error: Unterminated quoted string
[fvwm][expand_vars]: <<DEPRECATED>> 
Use $[w.name] instead of $n

[fvwm][expand_vars]: <<DEPRECATED>> 
Use $[w.name] instead of $n

[fvwm][expand_vars]: <<DEPRECATED>> 
Use $[w.name] instead of $n

sh: 1: Syntax error: Unterminated quoted string
X Error of failed request:  BadDrawable (invalid Pixmap or Window parameter)
  Major opcode of failed request:  62 (X_CopyArea)
  Resource id in failed request:  0x1c00002
  Serial number of failed request:  15479
  Current serial number in output stream:  15554
FvwmShelf: Button too tall. Giving up
Button=1122 num_rows=62 bheight=12 h=51

I can’t find, where unterminated String should be, where the $n is and so on… the Button is too tall, i know… change this later.

Thats really astonishing for me. Calling the SAME Function the SAME Way from a Popup from two different Menus gives this differens behave… WHY???

Further more phorensic:

gives:

[Fvwm-Verve][tpos]: Left /home/jakob/.fvwm-verve/.settings
[Fvwm-Verve][TEST2]: 
[Fvwm-Verve][TEST3]: 
[fvwm][CMD_InfoStore]: <<ERROR>> 
Bad arguments given.

Looks like the variables $0-$2 are not in the shell…

Whith this debug-Code, no writing to .settings-file at all… :-/

scientific

Hmmm… looked at Fvwm-Nightshades Page for new Code… It’s almost the same. But now it works…

#-----------------------------------------------------------------------
# Update/Create an InfoStore variable in a file
# FuncWriteInfoStoreToFile <var_name> <var_value> <file>
#-----------------------------------------------------------------------
DestroyFunc FuncWriteInfoStoreToFileAndSet
AddToFunc   FuncWriteInfoStoreToFileAndSet
+ I PipeRead 'Val=`echo "$1" | sed "s/[[:blank:]]*$//"`; \
            if [ `grep -c $0 $2` -gt 0 ] ; then \
                sed -i --follow-symlinks "s#^InfoStoreAdd $0.*#InfoStoreAdd $0 \\"$Val\\"#" $2; \
            else \
                sed -i --follow-symlinks "$ a\InfoStoreAdd $0 \\"$Val\\"" $2; \
            fi; \
            echo InfoStoreAdd $0 "$Val"'

No, it’s not the same - the $new variable has changed into $Val

The problem was that internal data was written into $new. After changing the name to $Val it was fixed. Don’t ask me why. It is too long ago …
I only know that parts of values from other variables appears in $new.

  • Thomas -

:slight_smile: now i know, what your Nickname means… :smiley: