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

Fix Embedded Game over expanded bottom panel #102921

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Hilderin
Copy link
Contributor

The issue came from the fact that when the bottom panel is expanded, the embedded game must be started hidden. That was not supported by Godot and the DisplayServer. I had to add a new HIDDEN flag and a new --hidden command line argument to start the game hidden. The new --hidden argument is passed to the game on startup when the embedded control is hidden (aka the bottom panel is fully expanded).

@Hilderin Hilderin requested review from a team as code owners February 16, 2025 16:45
@Hilderin Hilderin added this to the 4.4 milestone Feb 16, 2025
@Hilderin Hilderin force-pushed the fix-embedded-game-over-expanded-bottom-panel branch from e211796 to 3cd0773 Compare February 16, 2025 17:28
@giokhmaladze
Copy link

giokhmaladze commented Feb 16, 2025

Gave it a try, don't know about code but original issue is resolved and everything else looks good 🎉🚀

There is one thing I noticed while I was testing it, not sure if this is concern of this PR but became noticeable now:

  • If mouse is captured in the game, Input.mouse_mode = Input.MOUSE_MODE_CAPTURED you can't move mouse in the editor, even when game is hidden (see the video)
mouse_captured.mp4
  • Also this case seems like separate issue (could reproduce it on master as well), but since we are here if you start project, and switch to different window before it starts, cursor teleports in the center of embedded game window, and you can't move it outside it's bounds (even though it's actually not visible), notice, mouse interactions are not blocked on new window it just seems to be position bound
mouse_cant_go_beyond_game_c.mp4

MRP:
mouse-capture-mrp.zip

@Hilderin
Copy link
Contributor Author

Thanks for testing. It seems that the capture mouse is enable even if the game window is hidden and not focused. This should probably not happen, I'll the see what I can do about it.

@Hilderin Hilderin force-pushed the fix-embedded-game-over-expanded-bottom-panel branch from 3cd0773 to e376c6d Compare February 17, 2025 01:28
@Hilderin Hilderin requested a review from a team as a code owner February 17, 2025 01:28
@Hilderin
Copy link
Contributor Author

I fixed the mouse captured which was still active when the game window did not have the focus or was hidden. Turns out that it could happen without in the embedded mode with the right timing if the Input.mouse_mode = Input.MOUSE_MODE_CAPTURED was called when the game did not have the focus.

There was an issue with the new --hidden because the game process was still focused/activated even if it was hidden.

@Hilderin Hilderin force-pushed the fix-embedded-game-over-expanded-bottom-panel branch from e376c6d to 01fea85 Compare February 17, 2025 01:36
Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

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

For the reference, #91262 (macOS changes can be salvaged for WINDOW_FLAG_HIDDEN support).

Also, some extra changes from aforementioned PR that probaly should be included (irrelevnat for embedding, but can cause issues since new flag is exposed):

  • Suppress IME activation for hiddeen windows and window_move_to_foreground on X11.
  • ShowWindow is called in other places, and these should check for flag as well.

I was not able to reproduce the issue, so have not tested it.

@giokhmaladze
Copy link

gave it another try, mouse pointer isn't locked in editor anymore (when bottom panel is expanded) 🎉

  • mouse pointer is still moved in the center of where game view would be
  • mouse pointer is still bound to game view borders when you switch outside godot before starting scene
    • this is more apparent when project is big and takes several seconds to load and if you use external code editor
      • you click start button
      • switch to external text editor
      • game is started in godot
        • mouse pointer is teleported in the center of game view
        • you cant move it outside of it unless you focus on godot and switch back

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

Successfully merging this pull request may close these issues.

Embedded game draws over expanded bottom panel
4 participants