Thank you very much, that is super helpful. I didn't realize I needed to invoke pulldown().
I'm currently only running on Linux, so I could use Fl_Menu_Bar, but I thought it might
be better in the long run to use Fl_Sys_Menu_Bar.
I have 2 monitors and when I use my hotkey (ALT+M) to cause the menu to open, thepopup menu is displayed on the monitor where my mouse cursor is, which might notbe the same monitor the app is running on. It's possible I've done something wrongsince I've sub-classed FL_Window and am using handle() to catch keydown and mouseevents.
I pulled the latest changes from git including 0a6610c. That change didn't help my case, butthe nice thing is that it showed me where to look in the code. I don't know the FLTK sourcecode at all, but after a fair bit of trial and error I found something that works, at least for me.I think the previous issue (even before your change) is thatFl_Window_Driver::driver(this)->menu_window_area() is based on the mouse position, whichis exactly what we *don't* want. I changed that to use Fl::screen_xywh() passing in the menuX, Y instead of mouse x, y.
Le jeudi 23 mai 2024 à 18:44:57 UTC+2, Brian Larsen a écrit :
I pulled the latest changes from git including 0a6610c. That change didn't help my case, ...
We agree that what needs to be done is to prevent function menu_window_area()from choosing a display based on the mouse position. That's exactly whatcommit 0a6610c does because function menu_window_area() works basedon the mouse position only if its last argument is -1, and that's what the commit changes(see the code of Fl_Window_Driver::menu_window_area() in file src/Fl_Window_Driver.cxx).
Thus, what we have to do is clarify why commit 0a6610c doesn't work for you.
In my hands it does.
On 5/24/24 10:22, Brian Larsen wrote:
Similar to the menu problem. Using a hotkey (like Ctrl+O) to open the File Chooser causes it to open on whatever monitor the mouse is hovering over, which might not be the monitor the app is open on.
Hmm, while I don't work with multiple monitor setups much, that behavior doesn't sound bad to me for the Fl_Native_File_Chooser dialog window, as dialogs don't have to be "attached" to the application the way a menu positing does.
This positioning seems consistent with single window situations where posting dialogs like (fl_message) tries to open under the mouse is, so the dialog can be easily navigated without having to swing the mouse around just to enter it. At least that's the behavior on window managers that support window positioning hints from the app. I take it wayland window managers perhaps do not support this, as they seem to like to control where windows are positioned, and may ignore the "hints" from the app.
I would think it maybe even confusing if it opened dialogs in a window that the mouse wasn't in.