RightPanel Buttons Display Incorrect Desk After FVWM Restart

After restarting FVWM, the buttons in RightPanel show the incorrect desk. When I am on a desk other than 0 and restart FVWM, the pager displays the correct desk, but the wrong button appears to be higligted.

Using “ChangeDesk $[desk.n]” in fvwm-console seems to fix the issue, but I haven’t managed to make it work from the start function. Currently, I include this command in the shortcut I use to pop up the panel. However, this is not an elegant solution. Ideally, I would like the buttons to retain their visible status from before the restart. Does anyone have any ideas on how to resolve this?

There was a similar issue with the Desk/Page number, but it was fixed. Which Fvwm3 version/update do you have?

Thankyou for anwering.
“ptr@sagemcom:~> fvwm3 --version
fvwm3 1.1.1 (1.1.0-68-gd26bed64)
with support for: ReadLine, XPM, PNG, SVG, Shape, XShm, SM, Bidi text, XRandR, XRender, XCursor, XFT, NLS”

Some test I did .

Silent Key Space A C ChangeDesk $[desk.n]

Fail!
.
.

DestroyFunc UpdateDesk
AddToFunc UpdateDesk
+ I ChangeDesk $[desk.n]

Silent Key Space A C UpdateDesk

Success, butons updated.
.
.

AddToFunc StartFunction
+ I UpdateDesk

Fail

Did a few tests on different versions including 2.7. All show incorrect desk after Restart. The page number is correct.

Example: Desk 1 Page 1-1
desk1-page1-1

After Restart:
desk0-page1-1

I hope this can be corrected, Right Panel “remembers” the page number.

As I mentioned, we can trigger it to correct. Please test my second example, which uses a key binding to a function call. I am puzzled as to why it needs to be triggered from a key binding to a function call, and not directly from a key binding or the start function. In StartFunction, I have been testing with very long schedules (schedule 50000), so it’s probably not a timing issue.

Doesn’t seem to have any good solution. Usually, Schedule does it but not for ChangeDesk $[desk.n]. Annoying, the Right Panel gets stuck until updated. A mouse click at another desk does it but not ok.

File a bug report or I can do it.

@dante65, This is most likely a bug in how RightPanel is launched from the StartFunction. In this case it is configured to always show Desk 0 as highlighted, and the event to change this doesn’t happen until a desk change is triggered.

As mentioned the Schedule method can work, but really is more a work around and is subject to race conditions. Another option might be to add some Test to the RightPanel configuration to highlight the correct desk. I will think about this a bit, but I know what is going on, just unsure the best way to fix the issue.

I see. I am still puzzled, though, why the following does not work:

Silent Key Space A C ChangeDesk $[desk.n]

While this updates the buttons:

DestroyFunc UpdateDesk
AddToFunc UpdateDesk
+ I ChangeDesk $[desk.n]

Silent Key Space A C UpdateDesk

The reason is how variable expansion works, when you just make a key binding, $[desk.n] gets expanded to the desk at the time the key binding is made, not the time it is pressed.

When you wrap the update into a function, the expansion of $[desk.n] happens when the function is run, so it will always get the current desk.

Actually seems my previous idea was incorrect, I think the issue is during the restart, the current desk isn’t set until after $[desk.n] expands, I’m looking into this more, as my fix didn’t work in this case.

Currently when restarting fvwm, the previous saved session (such as what desktop you are currently own) isn’t restored until after the configuration file is read and StartFunction is run, so that is why something like schedule is needed, or function/keybinding after fvwm has started works. This means the value of $[desk.n] will be 0 until after fvwm starts.

The only solution I can think of that won’t require a race condition is to use an environment variable to save the current desk, and use something like FvwmEvent to update this environment variable each time the desk is changed. So there are solutions, but currently no easy solution.