godotengine / godot

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

Selecting windows taskbar menu application item starts new duplicate process instead of activating application #94344

Open lostminds opened 1 month ago

lostminds commented 1 month ago

Tested versions

4.3b3

System information

WIndows 10

Issue description

In the windows task bar you can right-click to bring up a menu with options (like open windows, closing etc). This top item in this menu shows the application name and selecting this item usually activates and brings the application to the front if it's running.

Screenshot 2024-07-14 115752

However, for Godot exported application (including the Godot editor) selecting this top item instead starts a new duplicate process, which I think is both unintentional and unexpected. It also effectively allows you to run multiple instances of all exported Godot windows applications, which they're likely not designed to allow.

Steps to reproduce

Minimal reproduction project (MRP)

Just the editor is required, or any exported windows project.

lostminds commented 1 month ago

There's also the same / similar issue if you try to open a file with a running Godot application. Instead of activating the running application as expected and in some way sending the dropped file to the process (not supported yet?) a new duplicate process is started instead.

As if in both these cases the existing running Godot game process the event should be directed to is disregarded and instead a new duplicate game process is started. This second case (opening an associated file) also duplicates the process on macOS.

The same issue exists with the Godot editor. Just try double-clicking a .godot project file on macOS while the editor is running and it'll start a new separate Godot editor process so you now have two Godot editors running editing the same project if it was already open.

Calinou commented 1 month ago

I believe this is what all apps on Windows do if they don't enforce having a single instance active. Try it with other apps that allow having multiple instances open.

lostminds commented 1 month ago

I believe this is what all apps on Windows do if they don't enforce having a single instance active. Try it with other apps that allow having multiple instances open.

I see, I didn't see it in any other windows applications I tried it with, but that might be since all the application I tried were single-instance ones. On macOS it is however very unusual and unexpected to have multiple copies of the same application running (for processes visible to the user in the dock). Perhaps the issue then is that the exported Godot applications do not enforce having a single instance? Or at least should have an option to do so?

lostminds commented 1 month ago

If this is then by design, it might not be a bug even if it was unexpected to me.

I've opened a proposal for allowing exported games to be restricted to a single process instance, so unless you wish to keep this issue open for discussion feel free to close it.

bruvzg commented 1 month ago

There's also the same / similar issue if you try to open a file with a running Godot application. Instead of activating the running application as expected and in some way sending the dropped file to the process (https://github.com/godotengine/godot-proposals/issues/10195) a new duplicate process is started instead.

That's pretty much macOS exclusive behavior, the normal way to open files on Windows is running a new instance with the file name as command line argument. Dropping files is a completely unrelated process.

KoBeWi commented 1 month ago

btw the behavior is different depending if the app is pinned or not, at least on Windows 10.