Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second Monitor/Desk FvwmPager displays incorrect state at startup #1077

Closed
Athanasius opened this issue Oct 20, 2024 · 26 comments
Closed

Second Monitor/Desk FvwmPager displays incorrect state at startup #1077

Athanasius opened this issue Oct 20, 2024 · 26 comments
Labels
skip:changelog Issue/PR should skip CHANGELOG type:bug Something's broken!

Comments

@Athanasius
Copy link

Athanasius commented Oct 20, 2024

Upfront Information

Please provide the following information by running the command and providing
the output.

  • Fvwm3 version: fvwm3 1.1.1 (1.1.0-89-ged4bb8503) - but note this was happening with stock 1.1.0 as well. I compile locally from a git clone, and either simply make install that into /usr/local/, or build a Debian package (based off the Debian fvwm3 package files for that, with any necessary tweaks given changes since) and install that.

  • Linux distribution or BSD name/version: Debian 12/bookworm (plus some limited backports and third-party repo packages)

  • Platform (run: uname -sp): Linux unknown

Expected Behaviour

With at least one additional monitor, with a configuration where it gets its own Desk, the FvwmPager on that additional desk should show the current windows, in the correct pages, and the correct "currently active" page highlighted.

For my configuration it should look like:
fvwm3-2nd-monitor-and-desk-correct-pager
NB: This is after I've used my Ctrl+Down Arrow keybind to move vertically down one page to 1,1, hence it being highlighted:

# WinKey+<arrow> to move item around Pages
Key Left A 4 MoveToPage -1p -0p
Key Right A 4 MoveToPage +1p -0p
Key Up A 4 MoveToPage +0p -1p
Key Down A 4 MoveToPage +0p +1p

Actual Behaviour

On startup it looks like all the second monitor windows are in the top-left (so, 0, 0) page of the second desk, but it's just a visual artefact. As soon as I change page within that second desk everything starts displaying correctly again. Specifically my second desk windows are a pair of XTerms that should be in middle-top, and when I use a keybind to go to middle-bottom (this is 3x2 pages), it displays correctly.

fvwm3-2nd-monitor-and-desk-incorrect-pager

As you can see:

  1. The XTerms are shown as in page 0,0 rather than 1,0
  2. It looks like Desk 0, Page 0,0 is currently viewed, when it's actually Desk 1, Page 1,0.

Enabling logging

I don't see anything relevant in this:
fvwm3-output.log

Steps to Reproduce

How can the problem be reproduced? For this, the following is helpful:

  • I'll work up a minimum configuration to show the problem and ping with a follow-up comment when I edit it in. A cut-down configuration, which shouldn't have any particular dependencies (i.e. additional programs or availability of hosts), that shows the issue:
    issue-1077-min-config.d.tar.gz

  • Does the problem also happen with Fvwm2? - Nothing like this did, but then with fvwm2 I was running each display as it's own distinct Xorg Screen, so a completely different configuration.

Include your configuration with this issue.

Does Fvwm3 crash?

No.

Extra Information

  • Anything else we should know?

  • Feel free to take a screen capture or video and upload to this issue if you
    feel it would help.

  • Attach $HOME/.fvwm/fvwm3-output.log from the step above.

@somiaj
Copy link
Collaborator

somiaj commented Oct 20, 2024

Are you starting the pager in your StartFunction, or from your configuration directly? If this is at startup, how are you putting xterms on a different desk/page, using a style, when are these being launched?

@Athanasius
Copy link
Author

I've added a tar file of a cut-down configuration that still shows the issue. I'll see what else I can cull out of it.

It's started via:

AddToFunc "InitFunction"
+       "I" Module FvwmButtons LeftPanelDP2

LeftPanelDP2 is a custom FvwmButtons as you can see, and its configuration contains:

*LeftPanelDP2: (204x200, Swallow FvwmPagerDP2 'FvwmPager FvwmPagerDP2 0 1', Frame 0)

There's also specific configuration for FvwmPagerDP2 in the provided files.

You might want to hold off until I've boiled this down to the bare minimum.

@somiaj
Copy link
Collaborator

somiaj commented Oct 20, 2024

We need your full configuration file (or a simple way to recreate the issue with the default configuration), anyways you shouldn't be using InitFunction for modules (so they get restarted with a restart), you should be using StartFunction. In general there is no reason to use InitFunction, use + I Test (Init) for things you want to only start once (modules need to be restarted each restart).

@somiaj
Copy link
Collaborator

somiaj commented Oct 20, 2024

Note if using the default-config file (just mv ~/.fvwm/config ~/.fvwm/config-back to use it, and you can move your config back into place when done), you can put things in ~/.fvwm/local.config, so create a minimum ~/.fvwm/local.config to reproduce the issue so we have something to test with.

@Athanasius
Copy link
Author

Note if using the default-config file (just mv ~/.fvwm/config ~/.fvwm/config-back to use it, and you can move your config back into place when done), you can put things in ~/.fvwm/local.config, so create a minimum ~/.fvwm/local.config to reproduce the issue so we have something to test with.

I'm just editing my X startup file to specify the configuration file, it's no hassle.

@Athanasius
Copy link
Author

I've now boiled the configuration down, keeping what seems relevant (i.e. remove extraneous styling and menus) to:

# We wish to page single monitors, not all at once
DesktopConfiguration shared
DeskTopSize 3x2

Style "*" TileManualPlacement
Style "XClock" PositionPlacement

IgnoreModifiers L25

Style * SloppyFocus
Style "FvwmPager" !Title, Sticky
Style LeftPanel* !Title, !Borders, !Handles, Sticky, !WindowListSkip, NeverFocus
Style "xclock" !Title, NoHandles, Sticky

###########################################################################
# Menus
###########################################################################
#################################################################
# Root Window Menus
#################################################################
DestroyMenu RootMainMenu
AddToMenu RootMainMenu "Main Menu" Title
+ "XTerms" Popup XTerms 
+ "Logins" Popup Logins
+ "" Nop 
+ "Applications" Popup Applications
+ "" Nop
+ "Exit Fvwm" Popup Quit-Verify
+ "" Nop
+ "$[gt.Re&fresh]%icons/refresh.png%" Refresh

#######################################################
# Local Terminals
#######################################################
DestroyMenu XTerms
AddToMenu XTerms "Xterm" Title
+ "&XTerm%icons/terminal.png%" Exec exec xterm
+ "Xterm (&ut)%icons/terminal.png%" Exec exec xterm +ut
+ "&Rxvt%icons/terminal.png%" Exec exec rxvt -ls
+ "R&oot Xterm%icons/terminal.png%" Exec exec xterm -fs 10 -geometry 80x24 -title root -e su -
## End: Local Terminals ###############################

#######################################################
# Logins
#######################################################
DestroyMenu Logins
AddToMenu Logins "Logins" Title
+ "&Tuesday%icons/terminal.png%" Exec exec xterm +vb -fs 12 -geometry 80x25 -T tuesday -n tuesday -e ssh tuesday
## End: Logins ########################################

#######################################################
# Top-Level Applications menu, and its children
#######################################################
# Load the file generated by 'XDG Generate' entry
Read .XDGMenu
AddToFunc "RestartFunction" "I" Read .XDGMenu

DestroyMenu Applications
AddToMenu Applications "Applications" Title
+ "WWW" Popup "www"
+ "XDG Menu" Popup "XDGMenu"

DestroyMenu www
AddToMenu www "WWW" Title
+ "Firefox" Exec exec firefox
+ "Firefox(profile)" Exec exec firefox -ProfileManager
+ "Google Chrome" Exec exec google-chrome -enable-accelerated-compositing -ssl-version-min=tls1 --force-dark-mode

# This menu is invoked as a sub-menu - it allows you to quit,
# restart, or switch to another WM.
DestroyMenu Quit-Verify
AddToMenu Quit-Verify "Really Quit Fvwm?" Title
+ "No, Don't Quit" Nop
+ "$[gt.&Restart]%icons/restart.png%" Restart
+ "" Nop 
+ "Yes, Really Quit" Quit
## End: Root Window Menus #######################################

###########################################################################
# Keyboard Input
###########################################################################
# Arrow Keys
# press arrow + control anywhere, and scroll by 1 page
Key Left A C Scroll -100 0
Key Right A C Scroll +100 +0
Key Up A C Scroll +0 -100
Key Down A C Scroll +0 +100
## End: Keyboard Input ####################################################

###########################################################################
# Mouse Input
###########################################################################
# Window Buttons: [1 3 5 7 9 TTTTT 0 8 6 4 2]
# 1 - Open the WindowOps menu.
# 2 - Close on single click, Destory on double click.
# 4 - Maximize (right/middle button will only maximize vertical/horizontal)
# 6 - Iconify (minimize)
Mouse 1 1 A Menu MenuWindowOps Delete
Mouse 1 2 A Close
Mouse 1 4 A Maximize 100 100
Mouse 2 4 A Maximize 0 100
Mouse 3 4 A Maximize 100 0
Mouse 1 6 A Iconify

# Root Window
Mouse 1 R A Menu RootMainMenu
Mouse 2 R A Menu MenuWindowOpsLong
Mouse 3 R A WindowList

# Windows
# Mouse right-cick on window title to raise lower
Mouse 3 TSIF A RaiseLower

# Iconify'd windows
Mouse 1 I A RaiseMoveX Move "Iconify off"
## End: Mouse Input #######################################################

## Init stuff per screen
#############################################################################
# Configure an FvwmPager alias for this monitor
# This will use Desk 0 0
# GotoDesk 0 0
DestroyModuleConfig FvwmPagerDP4:*
*FvwmPagerDP4: Monitor DP-4
*FvwmPagerDP4: Geometry 240x200+0+0
## These are *desktop*, not *page within desktop*
*FvwmPagerDP4: Rows 2
*FvwmPagerDP4: Columns 1

# Stuff to do at start-up
AddToFunc "InitFunction"
+       "I" Module FvwmButtons LeftPanelDP4
## Bottom Left
+       "I" GotoDeskAndPage screen DP-4 0 0 1
+       "I" Exec exec xterm -fs 12 -geometry 141x24+0+281@0 -T 'desk0-page0-1' -n 'desk0-page0-1'
+       "I" Wait desk0-page0-1
+       "I" Exec exec xterm -fs 12 -geometry 80x24+0-0@0 -T 'desk0-page0-1_2' -n 'desk0-page0-1_2'
+       "I" Wait desk0-page0-1_2
## Top Left
+       "I" GotoDeskAndPage screen DP-4 0 0 0
+       "I" Exec exec xterm -fs 12 +vb -geometry 80x25+0+281@0 -T desk-page0-0_1 -n tuesday # -e ssh tuesday
+       "I" Wait desk-page0-0_1
+       "I" Exec exec xterm -fs 12 +vb -geometry 80x25+0-0@0 -T desk-page0-0_2 -n tuesday  # -e ssh tuesday
+       "I" Wait desk-page0-0_2
+       "I" Exec exec xterm -fs 10 +vb -geometry 118x71-0-0@0 -T desk-page0-0_3 -n tuesday # -e ssh tuesday
+       "I" Wait desk-page0-0_3
+       "I" Exec exec xterm -fs 10 -geometry 80x24+760+136@0 -T 'desk0-page0-0_rootsticky_1' -n 'desk0-page0-0_rootsticky_1' -e su -
+       "I" Exec exec xterm -fs 10 -geometry 80x24+760+600@0 -T 'desk0-page0-0_rootsticky_2' -n 'desk0-page0-0_rootsticky_2' # -e ssh root@tuesday
# KEEP THIS LAST SO WE CAN WAIT ON IT
# The idea is to ensure everything *here* has started up before we start
# on any other monitor to avoid "wrong monitor/desk" issues.
+       "I" Exec exec xterm -geometry 80x24+680-0@0 -T desk0_page0-0_4
+       "I" Wait desk0_page0-0_4
############################################################################

###########################################################################
# LeftPanelDP4
###########################################################################
Style LeftPanelDP4 !Title, !Borders, !Handles, Sticky
DestroyModuleConfig LeftPanelDP4:*
*LeftPanelDP4: Geometry 240x270+0+0@0
*LeftPanelDP4: BoxSize smart
*LeftPanelDP4: Columns 1
*LeftPanelDP4: Rows 270
*LeftPanelDP4: Frame 0
#    Frame 0)
*LeftPanelDP4: (240x30, Swallow xclock "Exec xclock -digital -padding 8 -update 1 -strftime '%a %b %d %H:%M:%S %Z %Y' -render", Frame 0)
*LeftPanelDP4: (240x200, Swallow FvwmPagerDP4 'FvwmPager FvwmPagerDP4 0 1', Frame 0)

AddToFunc "RestartFunction" "I" Module FvwmButtons LeftPanelDP4
## End: LeftPanelDP4 #########################################################

# Second monitor
GotoDesk 0 1

DestroyModuleConfig FvwmPagerDP2:*
*FvwmPagerDP2: Monitor DP-2
*FvwmPagerDP2: Geometry 200x200+0+0@DP-2
*FvwmPagerDP2: Rows 2
*FvwmPagerDP2: Columns 1
*FvwmPagerDP2: Scale 48

# Stuff to do at start-up
AddToFunc "InitFunction"
+       "I" Module FvwmButtons LeftPanelDP2
# Top Middle
+       "I" GotoDeskAndPage screen DP-2 1 1 0
+       "I" Exec exec xterm -fs 13 -geometry 80x24+204-0@1 -T 'desk1_page1-0_1' -n 'river2' # -e ssh -C river.fysh.org
+       "I" Wait desk1_page1-0_1
+       "I" Exec exec xterm -fs 15 -geometry 120x25+204+135@1 -T 'desk1_page1-0_2' -n 'river' # -e ssh -C river.fysh.org
+       "I" Wait desk1_page1-0_2
############################################################################

###########################################################################
# LeftPanelDP2
###########################################################################
Style LeftPanelDP2 !Title, !Borders, !Handles, Sticky
DestroyModuleConfig LeftPanelDP2:*
*LeftPanelDP2: Geometry 204x200+0+0@1
*LeftPanelDP2: Colorset 10
*LeftPanelDP2: BoxSize smart
*LeftPanelDP2: Columns 1
*LeftPanelDP2: Rows 200
*LeftPanelDP2: Frame 0
*LeftPanelDP2: (204x200, Swallow FvwmPagerDP2 'FvwmPager FvwmPagerDP2 0 1', Frame 0)

AddToFunc "RestartFunction" "I" Module FvwmButtons LeftPanelDP2
## End: LeftPanelDP2 #########################################################

@Athanasius
Copy link
Author

We need your full configuration file (or a simple way to recreate the issue with the default configuration), anyways you shouldn't be using InitFunction for modules (so they get restarted with a restart), you should be using StartFunction. In general there is no reason to use InitFunction, use + I Test (Init) for things you want to only start once (modules need to be restarted each restart).

I'll see if migrating the start of these things to StartFunction helps. For reference, this is in effect my years old fvwm/fvwm2 configuration migrated as best I could to fvwm3 paradigms. However I'll only have changed a method if the old one was causing me visible issues.

@Athanasius
Copy link
Author

Changing over to StartFunction does indeed seem to have solved this. My cut-down configuration now being:

# We wish to page single monitors, not all at once
DesktopConfiguration shared
DeskTopSize 3x2

Style "*" TileManualPlacement
Style "XClock" PositionPlacement

IgnoreModifiers L25

Style * SloppyFocus
Style "FvwmPager" !Title, Sticky
Style LeftPanel* !Title, !Borders, !Handles, Sticky, !WindowListSkip, NeverFocus
Style "xclock" !Title, NoHandles, Sticky

###########################################################################
# Menus
###########################################################################
#################################################################
# Root Window Menus
#################################################################
DestroyMenu RootMainMenu
AddToMenu RootMainMenu "Main Menu" Title
+ "XTerms" Popup XTerms 
+ "Logins" Popup Logins
+ "" Nop 
+ "Applications" Popup Applications
+ "" Nop
+ "Exit Fvwm" Popup Quit-Verify
+ "" Nop
+ "$[gt.Re&fresh]%icons/refresh.png%" Refresh

#######################################################
# Local Terminals
#######################################################
DestroyMenu XTerms
AddToMenu XTerms "Xterm" Title
+ "&XTerm%icons/terminal.png%" Exec exec xterm
+ "Xterm (&ut)%icons/terminal.png%" Exec exec xterm +ut
+ "&Rxvt%icons/terminal.png%" Exec exec rxvt -ls
+ "R&oot Xterm%icons/terminal.png%" Exec exec xterm -fs 10 -geometry 80x24 -title root -e su -
## End: Local Terminals ###############################

#######################################################
# Logins
#######################################################
DestroyMenu Logins
AddToMenu Logins "Logins" Title
+ "&Tuesday%icons/terminal.png%" Exec exec xterm +vb -fs 12 -geometry 80x25 -T tuesday -n tuesday -e ssh tuesday
## End: Logins ########################################

#######################################################
# Top-Level Applications menu, and its children
#######################################################
# Load the file generated by 'XDG Generate' entry
Read .XDGMenu
AddToFunc "RestartFunction" "I" Read .XDGMenu

DestroyMenu Applications
AddToMenu Applications "Applications" Title
+ "WWW" Popup "www"
+ "XDG Menu" Popup "XDGMenu"

DestroyMenu www
AddToMenu www "WWW" Title
+ "Firefox" Exec exec firefox
+ "Firefox(profile)" Exec exec firefox -ProfileManager
+ "Google Chrome" Exec exec google-chrome -enable-accelerated-compositing -ssl-version-min=tls1 --force-dark-mode

# This menu is invoked as a sub-menu - it allows you to quit,
# restart, or switch to another WM.
DestroyMenu Quit-Verify
AddToMenu Quit-Verify "Really Quit Fvwm?" Title
+ "No, Don't Quit" Nop
+ "$[gt.&Restart]%icons/restart.png%" Restart
+ "" Nop 
+ "Yes, Really Quit" Quit
## End: Root Window Menus #######################################

###########################################################################
# Keyboard Input
###########################################################################
# Arrow Keys
# press arrow + control anywhere, and scroll by 1 page
Key Left A C Scroll -100 0
Key Right A C Scroll +100 +0
Key Up A C Scroll +0 -100
Key Down A C Scroll +0 +100
## End: Keyboard Input ####################################################

###########################################################################
# Mouse Input
###########################################################################
# Window Buttons: [1 3 5 7 9 TTTTT 0 8 6 4 2]
# 1 - Open the WindowOps menu.
# 2 - Close on single click, Destory on double click.
# 4 - Maximize (right/middle button will only maximize vertical/horizontal)
# 6 - Iconify (minimize)
Mouse 1 1 A Menu MenuWindowOps Delete
Mouse 1 2 A Close
Mouse 1 4 A Maximize 100 100
Mouse 2 4 A Maximize 0 100
Mouse 3 4 A Maximize 100 0
Mouse 1 6 A Iconify

# Root Window
Mouse 1 R A Menu RootMainMenu
Mouse 2 R A Menu MenuWindowOpsLong
Mouse 3 R A WindowList

# Windows
# Mouse right-cick on window title to raise lower
Mouse 3 TSIF A RaiseLower

# Iconify'd windows
Mouse 1 I A RaiseMoveX Move "Iconify off"
## End: Mouse Input #######################################################

## Init stuff per screen
#############################################################################
# Configure an FvwmPager alias for this monitor
# This will use Desk 0 0
# GotoDesk 0 0
DestroyModuleConfig FvwmPagerDP4:*
*FvwmPagerDP4: Monitor DP-4
*FvwmPagerDP4: Geometry 240x200+0+0
## These are *desktop*, not *page within desktop*
*FvwmPagerDP4: Rows 2
*FvwmPagerDP4: Columns 1

# StartFunction
DestroyFunc StartFunction
AddToFunc StartFunction
+       "I" Module FvwmButtons LeftPanelDP4
+       "I" Module FvwmButtons LeftPanelDP2

# Stuff to do at start-up
AddToFunc "InitFunction"
## Bottom Left
+       "I" GotoDeskAndPage screen DP-4 0 0 1
+       "I" Exec exec xterm -fs 12 -geometry 141x24+0+281@0 -T 'desk0-page0-1' -n 'desk0-page0-1'
+       "I" Wait desk0-page0-1
+       "I" Exec exec xterm -fs 12 -geometry 80x24+0-0@0 -T 'desk0-page0-1_2' -n 'desk0-page0-1_2'
+       "I" Wait desk0-page0-1_2
## Top Left
+       "I" GotoDeskAndPage screen DP-4 0 0 0
+       "I" Exec exec xterm -fs 12 +vb -geometry 80x25+0+281@0 -T desk-page0-0_1 -n tuesday # -e ssh tuesday
+       "I" Wait desk-page0-0_1
+       "I" Exec exec xterm -fs 12 +vb -geometry 80x25+0-0@0 -T desk-page0-0_2 -n tuesday  # -e ssh tuesday
+       "I" Wait desk-page0-0_2
+       "I" Exec exec xterm -fs 10 +vb -geometry 118x71-0-0@0 -T desk-page0-0_3 -n tuesday # -e ssh tuesday
+       "I" Wait desk-page0-0_3
+       "I" Exec exec xterm -fs 10 -geometry 80x24+760+136@0 -T 'desk0-page0-0_rootsticky_1' -n 'desk0-page0-0_rootsticky_1' -e su -
+       "I" Exec exec xterm -fs 10 -geometry 80x24+760+600@0 -T 'desk0-page0-0_rootsticky_2' -n 'desk0-page0-0_rootsticky_2' # -e ssh root@tuesday
# KEEP THIS LAST SO WE CAN WAIT ON IT
# The idea is to ensure everything *here* has started up before we start
# on any other monitor to avoid "wrong monitor/desk" issues.
+       "I" Exec exec xterm -geometry 80x24+680-0@0 -T desk0_page0-0_4
+       "I" Wait desk0_page0-0_4
############################################################################

###########################################################################
# LeftPanelDP4
###########################################################################
Style LeftPanelDP4 !Title, !Borders, !Handles, Sticky
DestroyModuleConfig LeftPanelDP4:*
*LeftPanelDP4: Geometry 240x270+0+0@0
*LeftPanelDP4: BoxSize smart
*LeftPanelDP4: Columns 1
*LeftPanelDP4: Rows 270
*LeftPanelDP4: Frame 0
#    Frame 0)
*LeftPanelDP4: (240x30, Swallow xclock "Exec xclock -digital -padding 8 -update 1 -strftime '%a %b %d %H:%M:%S %Z %Y' -render", Frame 0)
*LeftPanelDP4: (240x200, Swallow FvwmPagerDP4 'FvwmPager FvwmPagerDP4 0 1', Frame 0)

#AddToFunc "RestartFunction" "I" Module FvwmButtons LeftPanelDP4
## End: LeftPanelDP4 #########################################################

# Second monitor
GotoDesk 0 1

DestroyModuleConfig FvwmPagerDP2:*
*FvwmPagerDP2: Monitor DP-2
*FvwmPagerDP2: Geometry 200x200+0+0@DP-2
*FvwmPagerDP2: Rows 2
*FvwmPagerDP2: Columns 1
*FvwmPagerDP2: Scale 48

# Stuff to do at start-up
AddToFunc "InitFunction"
# Top Middle
+       "I" GotoDeskAndPage screen DP-2 1 1 0
+       "I" Exec exec xterm -fs 13 -geometry 80x24+204-0@1 -T 'desk1_page1-0_1' -n 'river2' # -e ssh -C river.fysh.org
+       "I" Wait desk1_page1-0_1
+       "I" Exec exec xterm -fs 15 -geometry 120x25+204+135@1 -T 'desk1_page1-0_2' -n 'river' # -e ssh -C river.fysh.org
+       "I" Wait desk1_page1-0_2
############################################################################

###########################################################################
# LeftPanelDP2
###########################################################################
Style LeftPanelDP2 !Title, !Borders, !Handles, Sticky
DestroyModuleConfig LeftPanelDP2:*
*LeftPanelDP2: Geometry 204x200+0+0@1
*LeftPanelDP2: Colorset 10
*LeftPanelDP2: BoxSize smart
*LeftPanelDP2: Columns 1
*LeftPanelDP2: Rows 200
*LeftPanelDP2: Frame 0
*LeftPanelDP2: (204x200, Swallow FvwmPagerDP2 'FvwmPager FvwmPagerDP2 0 1', Frame 0)

#AddToFunc "RestartFunction" "I" Module FvwmButtons LeftPanelDP2
## End: LeftPanelDP2 #########################################################

I'll just go test that change in my normal configuration to confirm then close this. At least I'll have documented the gotcha for others :) .

@somiaj
Copy link
Collaborator

somiaj commented Oct 20, 2024

Yea, StartFunction runs every start, InitFunction and RestartFunction aren't really needed any more, just use Test (Init) or Test (Restart). Note you are running tons of things the the InitFunction, so maybe keep that in your setup, but I would just move the module stuff to StartFunction so you don't need it in multiple locations.

I think the issue is some interaction with DesktopConfiguration shared. I might be able to reproduce this with that. Note, you may want to checkout the *FvwmPager: IsShared configuration, you can actually show both monitors on a single desktop, and if you turn on labels, you can see which monitor is currently viewing which desktop. *FvwmPager: MonitorLabels. More info is in the manual page.

Note your approach of having one pager per monitor is fine too, I was just pointing out we have tried to make the pager a bit more understandable of the shared desktop configuration.

@somiaj
Copy link
Collaborator

somiaj commented Oct 20, 2024

Maybe have some MyInitFunction that does all your terms and stuff at start, and then run + I Test (Init) MyInitFunction from your StartFunction to not have to populate it with tons of Test (Init) lines, as an alternative to using the InitFunction.

@Athanasius
Copy link
Author

Well, what's working is using InitFunction for the various xterms, but StartFunction for the panels/pagers.

Confirmed working correctly with my full configuration, so closing this.

Is InitFunction actually deprecated ? i.e. should I be looking to move away from it fully ?

@somiaj
Copy link
Collaborator

somiaj commented Oct 20, 2024

To me what was happening is the Pager was run before everything got setup (some sort of race condition), so the Pager was initializing before everything was moved into place and didn't know what pages everything was on. Once the pager is running it then takes some event for fvwm to resend info to the pager, which is why after you moved pages/desks, those events fired updating the pager on the actual location of things.

Being someone who uses the shared mode, test out *FvwmPager: IsShared and *FvwmPager: MonitorLabels a bit, let me know what you think, note you don't want to set any monitor for this, as it should be able to show a single desktop with both monitors at once and let you know which monitor is viewing which desk.

@Athanasius
Copy link
Author

Athanasius commented Oct 20, 2024

To me what was happening is the Pager was run before everything got setup (some sort of race condition), so the Pager was initializing before everything was moved into place and didn't know what pages everything was on. Once the pager is running it then takes some event for fvwm to resend info to the pager, which is why after you moved pages/desks, those events fired updating the pager on the actual location of things.

Yes, I always thought it felt like some sort of race condition.

Being someone who uses the shared mode, test out *FvwmPager: IsShared and *FvwmPager: MonitorLabels a bit, let me know what you think, note you don't want to set any monitor for this, as it should be able to show a single desktop with both monitors at once and let you know which monitor is viewing which desk.

Ah, so possibly even more improved functionality for dual monitors ? Atm I'm putting up with using the two desks and moving items between them as needed. It's at least better than my old fvwm2 config with the separate X Screens where I simply could not move anything between the two.

I'd also been pondering a setup with a set of 3x2 Desks, each with only a single Page, and moving between them, rather than between pages. Although I've seen some issues with changing which monitor is viewing which desk as well. I should investigate that more and open a separate issue if I can't find a reconfiguration to prevent it.

Anyway, thanks for the hint. I'll make a note to look into those additional options.

@somiaj
Copy link
Collaborator

somiaj commented Oct 20, 2024

InitFunction is suggested to not be used, but won't be removed. My guess is InitFunction runs first, and StartFunction second, moving the launch of FvwmButtons to the end would have probably also done the same thing, but not having to maintain multiple functions is the main advantage.

https://www.fvwm.org/Wiki/Config/Functions/StartFunction/

@somiaj
Copy link
Collaborator

somiaj commented Oct 20, 2024

Hmm, seems I might be incorrect, StartFunction is run before InitFunction during startup. Still I think it might have been some race condition. There might be some bug here, but race conditions can be hard to track down. I would have probably just launched FvwmButtons last after all the windows have been mapped.

@Athanasius
Copy link
Author

Maybe have some MyInitFunction that does all your terms and stuff at start, and then run + I Test (Init) MyInitFunction from your StartFunction to not have to populate it with tons of Test (Init) lines, as an alternative to using the InitFunction.

This actually brings the bug back:

  1. Changed my InitFunction declaration over to AthanInitFunctionDP4 (and DP2).
  2. Run those in the single StartFunction:
DestroyFunc StartFunction
AddToFunc StartFunction
+       "I" Module FvwmButtons LeftPanelDP4
+       "I" Test (Init) AthanInitFunctionDP4
+       "I" Test (Init) AthanInitFunctionDP2
+       "I" Module FvwmButtons LeftPanelDP2

The order looks a little funky there because I've tried both starting the LefPanelDP[42] before the AthanInitFunctionDP[42] calls, and after. In both cases the FvwmPager display bug at startup is back. So it seems I really do need to keep the stuff I had in InitFunction in there.

@Athanasius
Copy link
Author

Hmm, seems I might be incorrect, StartFunction is run before InitFunction during startup. Still I think it might have been some race condition. There might be some bug here, but race conditions can be hard to track down. I would have probably just launched FvwmButtons last after all the windows have been mapped.

Which is in effect what I'm now doing, with everything coming from InitFuction, but the panels/pagers now in StartFunction, which enforces a barrier for the ordering.

As I understand it, unless you put Wait commands in, everything in InitFunction is started as fast as possible, with subsequent items quite easily starting before a prior one has finished starting up, including actually displaying anything.

@ThomasAdam ThomasAdam added the skip:changelog Issue/PR should skip CHANGELOG label Oct 20, 2024
@Athanasius
Copy link
Author

Being someone who uses the shared mode, test out *FvwmPager: IsShared and *FvwmPager: MonitorLabels a bit, let me know what you think, note you don't want to set any monitor for this, as it should be able to show a single desktop with both monitors at once and let you know which monitor is viewing which desk.

As a first change to my configuration I now have this for my primary monitor:

DestroyModuleConfig FvwmPagerDP4:*
#*FvwmPagerDP4: Monitor DP-4
*FvwmPagerDP4: IsShared
*FvwmPagerDP4: NoDeskLabels
*FvwmPagerDP4: MonitorLabels
*FvwmPagerDP4: Geometry 240x200+0+0
## These are *desktop*, not *page within desktop*
*FvwmPagerDP4: Rows 2
*FvwmPagerDP4: Columns 1

and similarly for FvwmPagerDP2 on my second monitor. I turned off the DeskLabels because I only have the two and know which is which, so it saves the space.

What I initially tried was only having the one desk, but that didn't seem to work, with windows seeming to be randomly placed between the two monitors. I'll have another look at that now this change is satisfactory.

@Athanasius
Copy link
Author

Right, so even with the IsShared thing I still need to have a desktop per monitor, else only one of them can actually properly show anything, correct ?

What I'd really like is a single desktop, and each monitor to show a single page from it without interfering with the other. Obviously there'd have to be some restriction or swapping of view if you try to go e.g. page 0,0 to page 0,1 on one monitor when the other was already showing it. Either that would have to be blocked, with some feedback, or the other monitor get swapped over to page 0,0.

My use case would be something like a browser window and needing it now on the 'other' monitor without moving it between desks.

Still, the MonitorLabels seem to be a better method of switching which desk which monitor is displaying.

I'm still seeing some issues with fvwm3 restarts and it being confused about which desk (at least, maybe also page) some windows should be on. I'll look more closely at that and open a new issue for it though.

@somiaj
Copy link
Collaborator

somiaj commented Oct 21, 2024

The whole point of IsShared is you can show all desktops/monitors on a single pager, and no longer need to have one pager per monitor.

@Athanasius
Copy link
Author

The whole point of IsShared is you can show all desktops/monitors on a single pager, and no longer need to have one pager per monitor.

Sure, although in my case I still have one per monitor because sometimes one of them has something fullscreen (like the YouTube video I'm watching right now). Using IsShared definitely helps with this scenario because now the other-monitor pager is also showing me the full state of the fullscreen-app monitor.

So, thanks again for the nudge towards using that :) .

@Athanasius
Copy link
Author

Whilst the configuration change has fixed this for startup ... it's exhibiting the same buggy behaviour on a restart.

The only two things in my RestartFunction should be:

AddToFunc "RestartFunction" "I" Read .XDGMenu
AddToFunc "RestartFunction" "I" Exec exec fehbg

The old FvwmPager-related lines relating to RestartFunction are commented out.

The only place FvwmPager is now invoked is in the Swallow stanzas in my LeftPanel<monitor configuration, and those are now only invoked in StartFunction.

In this case I have Firefox also now running, with Desk 1 windows on Page 1,1 - but everything is showing piled up in Desk 1 / Page 0,0 until I change pages on that desk. Then everything moves back to where it should be (both the Firefox windows, and the XTerms on Page 1,0).

@Athanasius Athanasius reopened this Oct 23, 2024
@ThomasAdam
Copy link
Member

@Athanasius

Open up a new issue for this, would you? A short video demonstrating this behaviour, along with a minimal fvwm2rc file, would really help.

@somiaj
Copy link
Collaborator

somiaj commented Oct 23, 2024

Two questions before you open another issue. Did this issue come from modifying your configuration, and it didn't happen before? I was also wondering if it is maybe an edge case the last patch I made for the issue of placing windows on different desks/monitors caused, if you revert that patch does the issue go away? Creating a minimal configuration using ~/.fvwm/local.config with the default-config would give us something we can test too.

@Athanasius
Copy link
Author

I can only state with confidence that I've seen some general issues with Restart, with some windows shifting between desks, but that might have been related to not utilising StartFunction for the FvwmPagers, instead I had them starting in InitFunction and restarting in RestartFunction.

I'll look into a minimal reproduction and video tomorrow.

@Athanasius
Copy link
Author

I've now opened #1082 with details, some videos, and example configuration (as default-config/ isn't complex enough in terms of pages and desks to fully show the issue in that configuration).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip:changelog Issue/PR should skip CHANGELOG type:bug Something's broken!
Projects
None yet
Development

No branches or pull requests

3 participants