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

Improve popup window/menu handling. #58490

Merged
merged 1 commit into from
Feb 25, 2022

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Feb 24, 2022

Adds a dedicated window FLAG_POPUP and a platform specific routines to control popup menus.

Previews:

macOS:

macos.mov

Windows:

2022-02-24.12-56-08.mov

TODO:

  • macOS implementation.
  • Windows implementation.
  • Linux/X11 implementation.
  • Documentation update.
  • Test Popups other than menu and OptionButton dropdowns are functioning correctly.

Fixes #53187, supersede #58461

Add window FLAG_POPUP and a platform specific routines to control popup auto-hiding and event forwarding.
@bruvzg bruvzg changed the title [WIP] Improve popup window/menu handling. Improve popup window/menu handling. Feb 25, 2022
@bruvzg bruvzg marked this pull request as ready for review February 25, 2022 08:11
@bruvzg bruvzg requested review from a team as code owners February 25, 2022 08:11
@akien-mga
Copy link
Member

Tested on Linux X11 with Plasma/KWin, seems to work fine.
Would be good to have it tested on Wayland and maybe on a tiled WM (@groud maybe?).

@Geometror
Copy link
Member

Geometror commented Feb 25, 2022

Tested on Windows 10 (since bruvzg's screenshot was taken in W11) and it seems to work fine. It also fixes a regression where all context menus wouldn't show up anymore after a tooltip is displayed (not mentioned in #58515).

@akien-mga akien-mga merged commit 0393057 into godotengine:master Feb 25, 2022
@akien-mga
Copy link
Member

Thanks!

@bruvzg bruvzg deleted the imporve_popup_menu_handling branch February 25, 2022 22:03
XGetWindowAttributes(x11_display, wd.x11_window, &xwa);

ERR_FAIL_COND_MSG(p_window == MAIN_WINDOW_ID, "Main window can't be popup.");
ERR_FAIL_COND_MSG((xwa.map_state == IsViewable) && (wd.is_popup != p_enabled), "Pupup flag can't changed while window is opened.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo here in "Pupup" (and other 2 implementations).

if (wd_window.menu_type && !wd_window.no_focus && wd_window.focused) {
if (!wd_parent.no_focus) {
if (!wd_window.no_focus && !wd_window.is_popup && wd_window.focused) {
if (!wd_parent.no_focus && !wd_window.is_popup) {
Copy link
Contributor

@Rindbee Rindbee Mar 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!wd_window.is_popup appears twice. The second one is likely to be !wd_parent.is_popup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants