godot icon indicating copy to clipboard operation
godot copied to clipboard

Editor ignores Ctrl + Shortcuts after saving with Ctrl + S

Open Poobslag opened this issue 2 years ago • 4 comments

Godot version

v4.0.2.stable.official [7a0977ce2]

System information

Win 64

Issue description

After saving in the code editor using Ctrl + S, no shortcut keys using the Ctrl key work until the Ctrl key is released.

Steps to reproduce

  1. Open a GDScript file in the GDScript editor -- any file which is large enough to scroll around.
  2. Press Ctrl + S, keeping Ctrl held down. The 'Saving Scene' window appears briefly, and disappears before returning focus to the GDScript editor.
  3. With Ctrl still held down, press Ctrl + Down. This should scroll the window, but instead it moves the cursor.
  4. With Ctrl still held down, press Ctrl + Shift + D. This should duplicate the current line, but instead has no effect.
  5. With Ctrl still held down, press Ctrl + Shift + O. This should launch the "Quick Open Script..." window, but instead has no effect.
  6. Release Ctrl and try the shortcuts again. All shortcuts work properly.

Minimal reproduction project

N/A

Poobslag avatar Apr 13 '23 15:04 Poobslag

v4.3.dev.custom_build [fe01776f0]

I can reproduce this in my "game" (custom world editor) that uses MenuBar as well.

It seems to be triggered when a popup is opened by a shortcut (e.g. save progress popups). The problem doesn't happen in "single window mode".

I'm also currently testing on Windows, so it might be exclusive to the Windows DisplayServer.

dkaste avatar Mar 30 '24 05:03 dkaste

v4.3.dev.custom_build[4a0160241]

When trying to reproduce the problem on macOS I could not recreate it. However when switching to Windows 10, I was able to reproduce the problem.

I agree with @dkaste that it must be due to a pop-up window when saving. However, when there is only a script file in the project, this bug isn't reproduced. I was only able to recreate it after also making a Scene in the same project as well as a script file. So it seems when Ctrl+S is pressed to save the project as a whole, the scene save pop-up window causes the Ctrl button press to no longer be marked as hit/activated.

Liv4Music avatar Apr 20 '24 20:04 Liv4Music

v4.3.dev.custom_build[4a01602]

I believe that I have identified the root cause of the issue, which seems to pertain to the implementation of popups in accordance with the Windows API. Specifically, the popups that are created when executing the saving operation via shortcut commands that seem to be diverting focus away from the primary editor window. This behavior is observed within the else statement in the file display_server_windows.cpp, accessible at the following location: Link.

My familiarity with the intricacies of the Windows API utilized in this context is somewhat limited. Despite this, I attempted to mitigate the issue by experimenting with various methods to alter the focus behavior, including the exclusion of the SetFocus() command from execution. However, these attempts did not yield the desired outcome when recompiling the program.

These adjustments appeared to have adverse effects on the functionality of other window generation processes, notably during instances such as file selection prompts within the "Save as..." feature. Consequently, If there is any advice anyone has about the utilization of the Windows API in this context, it would be greatly appreciated!

Liv4Music avatar Apr 26 '24 03:04 Liv4Music

CC @bruvzg @RandomShaper

akien-mga avatar Apr 26 '24 07:04 akien-mga