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

Editor window title is flickering when using popups/menu with single window mode off (DisplayServer regression) #53187

Closed
jmb462 opened this issue Sep 28, 2021 · 6 comments · Fixed by #58490

Comments

@jmb462
Copy link
Contributor

jmb462 commented Sep 28, 2021

Godot version

Master branch (84b11fb)

System information

Windows10 , Linux Ubuntu 21.04

Issue description

The main editor window loose focus when using menus or popup in multi window mode.
That cause the title flickering between faded state and normal state which is particulary visible using the main editor menu.

focus

menu_focus_linux
May be related to #44997

Steps to reproduce

Use main editor menu when single window mode is disabled in editor properties as in the gif below.

Minimal reproduction project

Not needed.

@Calinou Calinou added this to the 4.0 milestone Sep 28, 2021
@Calinou Calinou changed the title Editor window title is flickering when using popups/menu with single window mode off Editor window title is flickering when using popups/menu with single window mode off (DisplayServer regression) Sep 28, 2021
@akien-mga
Copy link
Member

Is this still reproducible in the current master branch?

@Chaosus
Copy link
Member

Chaosus commented Feb 8, 2022

Is this still reproducible in the current master branch?

Yes, unfortunately

@bruvzg
Copy link
Member

bruvzg commented Feb 8, 2022

Popup windows are set to grab focus, since focus change is used to auto hide it when parent is refocused.

There's a window flag to prevent popups from taking focus, but auto hide behavior should be completely redesigned to make it work.

I guess we probably should use any mouse press event from the parent to trigger auto hide instead.

@bruvzg
Copy link
Member

bruvzg commented Feb 8, 2022

Seems like this will be pretty hard to fix, non-focusable windows behave differently on different platforms.

  • On Linux FLAG_NO_FOCUS seems to be broken.
  • On Windows, FLAG_NO_FOCUS windows are ignoring all input.
  • On macOS, FLAG_NO_FOCUS windows are handling input and keyboard focus like any other window.

It might require some sort of global input event handling for the popups to work and be non-focusable.

@Zylann
Copy link
Contributor

Zylann commented Feb 19, 2022

This still happens in 3b3916f.

On Windows, it's not only the title flickering, but the menu also spawns a taskbar window:
image
So the taskbar wiggles around each time one of these opens, which is quite disturbing

@bruvzg
Copy link
Member

bruvzg commented Feb 23, 2022

I have been working on this, and as I suspected it won't be easy to fix, but I think I have an outline for a solution.

  1. Set FLAG_NO_FOCUS for the window (working on macOS, on Linux flag setter/getter is missing, when added it's working fine, on Windows it's also missing some code to properly work, both fixed by [Windows, X11] Fix NO_FOCUS flag, after showing/hidding window or on mouse click. #58461).
  2. A non-focusable window will not receive keyboard input, so we'll need to track "active" menu window and redirect keyboard input from the parent window.
  3. It's non-focusable, so the parent window will retain focus, and we won't receive any event when the user clicks outside a menu. Looks like the only way is it to set up global mouse event hook, to get all mouse event from all windows (other projects, e.g. Firefox seems to use this approach), this can be done on Windows and macOS, but I have no idea if it's possible with X11.
  4. On Windows, a non-focusable window also is not receiving MouseMotion events, so these will need to be redirected from the global mouse input hook.

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

Successfully merging a pull request may close this issue.

6 participants