GtkPopover deactivates main window on macOS
Steps to reproduce
- uncomment 'popover' in
testsuite/gtk/meson.build
- build gtk4 and run
testsuite/gtk/popover
- you will notice the main window loses focus when the popover is shown
Current behavior
The popover deactivates main window.
Expected outcome
The popover shouldn't deactivate the main window. Currently I'm developing an input method for GTK, the IME candidate panel is a GtkPopover, I show it in im_focus_in() and hide it in im_focus_out(), but unfortunately gtk_popover_popup() will make the main window loses focus, so im_focus_out() is called and gtk_popover_popdown(), my IME candiate panel is hidden, then main window gains focus, and then im_focus_in() is called and gtk_popover_popup() again, this leads to an endless loop
NSWindow is used in gdk/macos/gdkmacospopupsurface.c
, maybe we should use NSPanel or NSPopover? https://developer.apple.com/documentation/appkit/windows_panels_and_screens
Version information
macOS 12.4, GTK >=4.6.5 installed by Homebrew, probably old GTK also has this issue. I built GTK 4.7.0 myself, the issue still exists.