Re: FvwmScript - WriteToFile seems not working
2013/12/14 Dominique Michel dominique.mic...@vtxnet.ch: Le Sat, 14 Dec 2013 00:34:38 +0100, Thomas Funk t.f...@web.de a écrit : Dan Espen wrote: Thomas Funk t.f...@web.de writes: Hi! I'm working on a composite configurator with FvwmScript and getting an issue with WriteToFile command. It only writes '#end' into the file. First I thought I've done something wrong but I do the same as in FvwmScript-BaseConfig. So I started a test with FvwmScript-BaseConfig and the same happens. Used FVWM is 2.6.5. This happens under Fedora 19, too. My next thought was something has changed in WriteToFile source since creation of FvwmScript-BaseConfig - 2007-08-07. So I compared the code from 2.5.22 and CVS but nothing has changed. So, what could be the problem? We'd probably have to see the script but you could always resort to adding printfs in Instructions.c. Start with determining if it gets NbArg right. Just seeing #end is an indication that it doesn't see the args after the filename. I have checked different VMs with different FVWM versions with FvwmScript-BaseConfig: Debian 4.x (2007) with FVWM 2.5.22 - ok, creates full config Debian 6.x (2011) with FVWM 2.6.0 - ok, creates full config Debian 7.1 (2013) with FVWM 2.6.6 - ok, creates full config Debian 7.1 (2013) with FVWM 2.6.5 - ok, creates full config Debian 8 (testing, 2013) with FVWM 2.6.5 - nok, creates '#end' Fedora 19 (2013) with FVWM 2.6.5 - nok, creates '#end' Dominique Michel wrote: I get the same issue yesterday. This is with fvwm-2.6.6 from cvs and gentoo. So, it seems it's not a script problem. Therefore I've starting your suggestion with 'printfs' in instructions.c under my Fedora VM. I used this FvwmScript with one WriteToFile: #WindowTitle {Test WriteToFile} #WindowSize 470 415# Taille # #Init #Begin #Set $userDir = (GetOutput {echo $FVWM_USERDIR} 1 -1) #Set $configPath = $userDir{/bla} # #WriteToFile $configPath {This is a test} #Quit #End As I didn't knew what you meant with 'printfs' I used printf first and hoped that output went into .xsession-errors. No output appeared but WriteToFile worked. So I removed printf and compiled code suddenly worked! Same code, different behaviors... Therefore I did the same on my Debian 8 system and the compiled version of FvwmScript works also. Under Debian 8 and Fedora 19 I have distribution packages installed. All others are self compiled. Could it be a problem of code optimization? Because the FvwmScript executables has huge different sizes: package: 380K compiled: 1,5M The only thing that not fit in this to theory is Dominiques issue because his code is self compiled, too ... My ebuild is the same than the one in gentoo. I modified it to use the cvs and to be able some patches, but I don't apply them, so the code is the one from the cvs. The cflags are a little bit extensive, that was to be able to cross compile in my tower and be sure to get a consistent result, but the tower is dead now. The only ones that doesn't are for the processor are -O2 -pipe and they should be sure: CFLAGS=-march=amdfam10 -mcx16 -msahf -mpopcnt -mabm --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=amdfam10 -O2 -pipe CFLAGS_amd64=-m64 CXXFLAGS=-march=amdfam10 -mcx16 -msahf -mpopcnt -mabm --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=amdfam10 -O2 -pipe LDFLAGS=-Wl,-O1 -Wl,--as-needed LDFLAGS_amd64=-m elf_x86_64 The ebuild append -fno-strict-aliasing to the cflags. The result with my configure USE flags is: fvwm --version fvwm 2.6.6 (from cvs) compiled on Oct 27 2013 at 16:48:42 with support for: ReadLine, RPlay, Stroke, XPM, PNG, SVG, Shape, XShm, SM, Bidi text, XRender, XCursor, XFT, NLS The size of FvwmScript executable is around 400.6k here. Is it possible, that you compile FVWM normally with configure make, copy the FvwmScript executable to /usr/lib/fvwm/2.6.6/ and test it with the script snippet above or yours? Please deactivate the debugging while configure: ./configure --cflags=-O2 (or --CFLAGS? I don't know cause I am at work ...) @Dan: As '-g' is part of the default cflags this is the reason why my executable has 1,5M. Without it has around 450k. with '-O3' the size has increased and no change of the behaviour - works as with '-O2'. So, it's not the optimize parameter ... - Thomas -
To remove a key binding fail with -
Hi, In fvwm man page: 31.6.5. Key Key [(window)] Keyname Context Modifiers Function Binds a keyboard key to a specified fvwm command, or removes the binding if Function is '-'. If I have ardour running, its class is Ardour, I get the following into the fvwm console: Key (Ardour) B W M ToggleFail [fvwm][__execute_function]: ERROR No such command 'ToggleFail' # The ToggleFail function doesn't exist Key (Ardour) B W M - [fvwm][__execute_function]: ERROR No such command 'ToggleFail' # To remove the binding fail, but the following work: Key (Ardour) B W M More strange is the following sequence: Key (Ardour) B W M ToggleFail [fvwm][__execute_function]: ERROR No such command 'ToggleFail' Key (Ardour) B W M ToggleWork [fvwm][__execute_function]: ERROR No such command 'ToggleWork' Key (Ardour) B W M - [fvwm][__execute_function]: ERROR No such command 'ToggleFail' Key (Ardour) B W M - [fvwm][__execute_function]: ERROR No such command 'ToggleFail' Key (Ardour) B W M # work Cheers, Dominique
Re: To remove a key binding fail with -
Le Wed, 18 Dec 2013 12:52:59 +0100, Dominique Michel dominique.mic...@vtxnet.ch a écrit : Hi, In fvwm man page: 31.6.5. Key Key [(window)] Keyname Context Modifiers Function Binds a keyboard key to a specified fvwm command, or removes the binding if Function is '-'. If I have ardour running, its class is Ardour, I get the following into the fvwm console: Key (Ardour) B W M ToggleFail Maybe I was not clear enough. When ardour have the focus and I press Alt+B, I get the following: [fvwm][__execute_function]: ERROR No such command 'ToggleFail' That imply the binding work fine. # The ToggleFail function doesn't exist Key (Ardour) B W M - Idem, that imply the binding was not removed: [fvwm][__execute_function]: ERROR No such command 'ToggleFail' # To remove the binding fail, but the following work: Key (Ardour) B W M More strange is the following sequence: Key (Ardour) B W M ToggleFail The binding work: [fvwm][__execute_function]: ERROR No such command 'ToggleFail' Key (Ardour) B W M ToggleWork The new binding work: [fvwm][__execute_function]: ERROR No such command 'ToggleWork' Key (Ardour) B W M - The binding was not removed, but put back to its preceding state: [fvwm][__execute_function]: ERROR No such command 'ToggleFail' The way to remove a binding as stated into the man page doesn't work: Key (Ardour) B W M - [fvwm][__execute_function]: ERROR No such command 'ToggleFail' The only way to remove a binding: Key (Ardour) B W M # work Cheers, Dominique
Re: To remove a key binding fail with -
Le Wed, 18 Dec 2013 23:05:23 +0100, Dominik Vogt dominik.v...@gmx.de a écrit : On Wed, Dec 18, 2013 at 10:47:59PM +0100, Dominique Michel wrote: Le Wed, 18 Dec 2013 12:52:59 +0100, Dominique Michel dominique.mic...@vtxnet.ch a écrit : 31.6.5. Key Key [(window)] Keyname Context Modifiers Function Binds a keyboard key to a specified fvwm command, or removes the binding if Function is '-'. If I have ardour running, its class is Ardour, I get the following into the fvwm console: Key (Ardour) B W M ToggleFail Maybe I was not clear enough. When ardour have the focus and I press Alt+B, I get the following: [fvwm][__execute_function]: ERROR No such command 'ToggleFail' ... I can see that soething is amiss with the binding removal code, but I cannot reproduce your specific problem. Could you please make a minimal config file that shows this behaviour? That will be hard, my minimal config is fvwm-crystal. I will think about what I can do to simplify it. Binding removal was working it was a few years ago inside fvwm-crystal, so maybe I can find a clue about which commit changed it. But it will take a lot of time, and I don't have much time these days. Ciao, Dominique Ciao Dominik ^_^ ^_^
Re: To remove a key binding fail with -
On Wed, Dec 18, 2013 at 04:39:42PM -0500, Dan Espen wrote: Key (Ardour) B W M - Idem, that imply the binding was not removed: [fvwm][__execute_function]: ERROR No such command 'ToggleFail' It's pretty clear to me Fvwm doesn't work as expected when you try to remove a binding with '-'. During the removal process it should NOT be validating the command in the binding. The algorithm when adding a binding is: * Parse the binding and collect info about it in local variables * Collect all bindings that are made obsolete by the new binding in a list. * Ungrab the keys and buttons for the bindings in the remove list. * Delete the remove list. * If the action is just - that's all that is to do. * Otherwise append the new binding to the list of all bindings. However, something is going wrong. With key (w1) q w m echo w1 key (w2) q w m echo w2 both bindings work as expected, but after key (w2) q w m - the w1 binding does not work either. It turns out that removing the second binding removes the grab for meta-q on all windows although it is still needed. That does not explain the bug described earlier, though. The only way to remove a binding: Key (Ardour) B W M # work I don't think that actually works (haven't looked yet). It might be setting the binding to an empty command. Empty commands are skipped so they appear not to be there. Looking at the code in ParseBinding, I think fvwm would crash with a NULL pointer access if the action is omitted. Ciao Dominik ^_^ ^_^ -- Dominik Vogt
Re: To remove a key binding fail with -
The attached patch should fix the problems. For some reason my CVS connection hangs forever, so I cannot apply the patch myself. :-/ Ciao Dominik ^_^ ^_^ -- Dominik Vogt From d36cc99975d99dae7305ae49b8d1d19aab82028d Mon Sep 17 00:00:00 2001 From: Dominik Vogt dominik.v...@gmx.de Date: Thu, 19 Dec 2013 01:23:41 +0100 Subject: [PATCH] * Fix removal of bindings. --- ChangeLog | 16 + NEWS|3 ++ fvwm/bindings.c | 38 + fvwm/menubindings.c |3 +- libs/Bindings.c | 93 +-- libs/Bindings.h | 10 +++--- 6 files changed, 102 insertions(+), 61 deletions(-) diff --git a/ChangeLog b/ChangeLog index 03c3c9d..f82f854 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2013-12-19 Dominik Vogt dominik(dot)vogt(at)gmx(dot)de + + * fvwm/menubindings.c (menu_binding): + Use new signature of CollectBindingList + * fvwm/bindings.c (ParseBinding): + Cleaned up some code + Do not remove window specific bindings that are still needed for other + windows. + * libs/Bindings.h (CollectBindingList): + Added ret_are_similar_bindings_left + * libs/Bindings.c (CollectBindingList): + indicates whether similar bindings are left, i.e. bindings that differ + in window name only + (replacesBinding, compare_bindings): + Renamed function, returns 2 if bindings only differ in window name + 2013-11-09 Dan Espen despen(at)1verizon.net * fvwm/events.c (HandlePropertyNotify): Disable prior fix suspected of causing diff --git a/NEWS b/NEWS index 8e36864..7a7500c 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,9 @@ Changes in release 2.6.6 (not released yet) - Windows no longer jump from one position to the other which could happen in some cases with SnapAttraction. Windows now snap to the closest window (or screen edge). + - Removing bindings had several strange side effects that are +fixed now (removing too many bindings; old bindings showing up +again after another is removed; possibly other effects). --- Changes in release 2.6.5 (20-Apr-2012) diff --git a/fvwm/bindings.c b/fvwm/bindings.c index 4cde680..c1aa6af 100644 --- a/fvwm/bindings.c +++ b/fvwm/bindings.c @@ -262,7 +262,7 @@ static int ParseBinding( KeySym keysym = NoSymbol; Bool is_unbind_request = False; Bool is_pass_through = False; - Bool is_binding_removed = False; + Bool are_similar_bindings_left; Binding *b; Binding *rmlist = NULL; STROKE_CODE(char stroke[STROKE_MAX_SEQUENCE + 1] = ); @@ -477,15 +477,17 @@ static int ParseBinding( } } - /* - ** strip leading whitespace from action if necessary - */ - while (*action (*action == ' ' || *action == '\t')) + if (action != NULL) { - action++; + action = SkipSpaces(action, NULL, 0); } - - if (action) + if ( + action == NULL || *action == 0 || + (action[0] == '-' !is_pass_through)) + { + is_unbind_request = True; + } + else { is_pass_through = is_pass_through_action(action); if (is_pass_through) @@ -508,11 +510,6 @@ static int ParseBinding( } } } - /* see if it is an unbind request */ - if (!action || (action[0] == '-' !is_pass_through)) - { - is_unbind_request = True; - } /* short circuit menu bindings for now. */ if ((context C_MENU) == C_MENU) @@ -540,17 +537,17 @@ static int ParseBinding( */ /* BEGIN remove */ CollectBindingList( - dpy, pblist, rmlist, type, STROKE_ARG((void *)stroke) + dpy, pblist, rmlist, are_similar_bindings_left, type, + STROKE_ARG((void *)stroke) button, keysym, modifier, context, window_name); if (rmlist != NULL) { - is_binding_removed = True; - if (is_unbind_request) + int bcontext; + + if (is_unbind_request are_similar_bindings_left == False) { int rc = 0; - /* remove the grabs for the key for unbind - * requests */ for (b = rmlist; b != NULL; b = b-NextBinding) { /* release the grab */ @@ -563,11 +560,6 @@ static int ParseBinding( } } FreeBindingList(rmlist); - } - if (is_binding_removed) - { - int bcontext; - bcontext = bind_get_bound_button_contexts( pblist, buttons_grabbed); update_nr_buttons( diff --git a/fvwm/menubindings.c b/fvwm/menubindings.c index c45c449..3b422c2 100644 --- a/fvwm/menubindings.c +++ b/fvwm/menubindings.c @@ -402,6 +402,7 @@ int menu_binding( { Binding *rmlist; int rc; + Bool dummy; if (menu_bindings == NULL) { @@ -430,7 +431,7 @@ int menu_binding( */ /* BEGIN remove */ CollectBindingList( - dpy, menu_bindings, rmlist, type, STROKE_ARG(NULL) + dpy, menu_bindings, rmlist, dummy, type, STROKE_ARG(NULL) button, keysym, modifier, context, menu_style); if (rmlist != NULL) { diff --git a/libs/Bindings.c b/libs/Bindings.c index d7f76e6..ab2fb08 100644 --- a/libs/Bindings.c +++ b/libs/Bindings.c @@ -269,27 +269,28 @@ int AddBinding( return count; } -/* - * replacesBinding() - does the new binding, b1,
Re: To remove a key binding fail with -
Dominik Vogt dominik.v...@gmx.de writes: The attached patch should fix the problems. For some reason my CVS connection hangs forever, so I cannot apply the patch myself. :-/ Works from here. Not sure why you would have a problem. -- Dan Espen