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
[BUG][Wayland] Dropdown menu moves when navigated #613
Comments
The video does not work. |
😕 works for me in chromium.. Let me see if I can fix it |
This should work |
Yes, the new video works now. Thanks. That's the way FLTK menus behave under Wayland. Ultimately, the cause of this behaviour is that Wayland prohibits to know where a window is inside a display. Thus, an app cannot know what part of a popup menu window is in and what part is out of the display. The app considers its window delimits the area where menus are visible and thus moves menus around to keep the currently selected menu item inside the app's window. This won't be changed unless information about how to know, under Wayland, what part of a popup window is visible is revealed to me. |
Maybe @emersion can help with advice 🙏 |
copying IRC conversation with @kennylevinsen that happened in
|
This commit uses Wayland popup positionning methods to handle common menu windows and prevents them from expanding below display bottom or above top. The previous algorithm remains in place for menu windows higher than the display height. Further changes for these big menus may come later.
The above-mentionned commit should fix this issue. |
@ManoloFLTK The fix in 694df9d is a great achievement, thanks. However, it has a side effect that sometimes submenus are not "opened".
Note that the "File" menu is not scrolled when the mouse leaves the window area (which may be the root cause of the issue?) whereas the "Huge" menu is scrolled. This behavior is a regression of commit 694df9d. The previous behavior was that the "File" menu was scrolled when the mouse left the window borders and the submenus were opened correctly. FWIW, I made a video: menubar.mp4The video demonstrates that the submenus are not opened (step 4) and how resizing the underlying window changes the behavior as soon as the respective menu item is inside the window. |
This menu positioning is quite difficult. I believe the cause of the problem you report is: |
@kennylevinsen in
|
Menu windows containing sub-menus are now processed differently.
Commit e73b2da should fix the issue with submenus. |
Thanks, this is much better but there's still some strange behavior in
The following video demonstrates this behavior. menubar_e73b2da5e.mp4Further observation: when resizing the main window height some pixels smaller the first submenu "jumps" already if and only if the "submenu" item of the first submenu is (at least partially) outside the main window area. This doesn't seem intended, particularly because the second level submenu works as expected. Or maybe there's a reason I don't see... |
@Albrecht-S That's the way it is. Please read the source file comment "Implementation note" of commit e73b2da. This is a working implementation, not a perfect implementation which would require, I believe, to completely rework the handling of menu windows by FLTK, because FLTK and Wayland approaches to popup window positioning are extremely different. |
The original issue is fixed, should we close this issue? |
On my side, I would agree to see this issue closed. Let's see what's @Albrecht-S 's view. |
@ManoloFLTK I read the "implementation note" mentioned by you, and I understand what you wrote (I missed the "submenus exception" previously). Given that note, I see that the behavior is as described. If this is the best we can get w/o reworking the entire FLTK menu handling, then I agree that the issue is fixed and can be closed. But I have one remaining question: why exactly do we need to exclude menus with submenus from the "Wayland way" of positioning menus? @ngortheone wrote above (citing someone else): "the issue is likely that the second popup is attempted created from the top level (and thus out of bounds) when it should be a child of the first popup", and you (@ManoloFLTK) wrote before "These positioner-created rules are constrained by the requirement that a child surface must intersect with or be at least partially adjacent to its parent surface". If I take these two statements together I would think that we can open each submenu as a "child of" the previous (sub)menu, which would always be "adjacent to its parent surface". I tried hard to understand what the current code does and tried to modify it (by educated guessing and trial and error) but I don't understand what exactly is going on - and I would need too much time to try to understand the Wayland stuff that's involved. I assume that the answer to my question is that the current logic of opening menu windows doesn't allow to use the previous menu window as the "parent" of the next submenu window. Is this correct? What I see (in the debugger) is that each menu is opened relatively to the main window (if I understand this correctly). I would guess that the previous (i.e. current) menu window is always Can you shed some light on the question why we can't open the "next" menu window relatively to the "current" menu window? Please don't understand me wrong, I don't insist on a "perfect" menu system if this is all we can get. I'd only like to understand why this is so. Thanks. |
@Albrecht-S All what you wrote is correct. It would be enough to make a submenu the wayland child of the previous menu for wayland rules to work. There are complications with the left display border and menu popups, though. You've also correctly seen that presently, all menus are made children of the main window. The difficulty is to change the code in |
@ManoloFLTK Thank you very much for these clarifications, and thank you for working further on this problem in the background. Looking forward to your results. |
OS: FreeBSD 14
Wayland: Sway 1.7
Dropdown menu changes it's position on the screen, after it was opened and while being navigated with the mouse.
Attached video demonstrates the issue with
chart-simple
example:recording.mp4
The text was updated successfully, but these errors were encountered: