godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.54k stars 21.26k forks source link

Dialogs in project manager don't consume Enter key, runs project instead of confirming input #17620

Closed Rubonnek closed 4 years ago

Rubonnek commented 6 years ago

Godot version: master branch commit 883afd1b4d6886676ceb2017caafae0c24df6c24

OS/device including version: Arch Linux

Issue description: Typing the path of a project to import it, and then pressing enter does not always yield the same behavior.

Steps to reproduce:

  1. Open Godot's project list.
  2. Click on a project to select it
  3. Click Import
  4. Type the path of a project to import it (the path doesn't need to exist)
  5. Press enter

Godot now runs the project that was first selected.

If the same steps as above are repeated, but step 2 gets omitted, pressing Enter after typing the path does nothing.

I expected Godot to import the project, or at least to have the same behavior on both cases.

reduz commented 6 years ago

This is likely in the FileDialog class (which is what project manager uses, not EditorFileDialog) https://github.com/godotengine/godot/blob/master/scene/gui/file_dialog.cpp

Rubonnek commented 6 years ago

I'll take a stab at this soon

Rubonnek commented 6 years ago

If there's someone out there who wants to tackle this, feel free.

A lot of work suddenly stacked on me and I haven't been able to work on this. I don't think I will be able to for a while either.

lupoDharkael commented 6 years ago

I think I understand what's happening here. When you open the Import dialog it gives focus to the "Import & Edit" button, the path is not correct so the button starts disabled. When you press Enter the button is disabled so it can't handle de input so it executes here: https://github.com/godotengine/godot/blob/006021236a97bdc300f842864579899ee7fc8497/editor/project_manager.cpp#L998

Should we modify how this popup dialog handles the input, or control that input case in the project_manager itself?

pedroalopes commented 6 years ago

I'll be handling this issue soon!

pedroalopes commented 5 years ago

Shouldn't the issue be renamed to identify that not only the enter key event is not consumed, but also other events such as the arrow keys? I verified, and the keys have the same kind of behaviour as the enter key since they interact with the main window when possible, not the dialog one only.

aaronfranke commented 5 years ago

Ideally, I think that all keypresses should be captured and sent to the dialog box when a dialog box is open, like @pedroalopes says. You shouldn't be able to touch the rest of the window while one is open.

KoBeWi commented 5 years ago

Somewhat related to #17580