godotengine / godot

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

Enabling borderless results in Godot games showing on both monitors #71282

Open knivspark opened 1 year ago

knivspark commented 1 year ago

Godot version

3.5.1 Mono

System information

Windows 10, 1920x1080 resolution, x2 monitors, NVIDIA GeForce RTX 3060

Issue description

Whenever I enable borderless in a Godot game the game is shown on both of my monitors.

In addition, when this occurs the application behaves in a suboptimal manner where it is only ever functional on one screen at a time, an alternating between which one is functional as you try to interact with the application.

This occurs with e.g. DOME KEEPER (Steam) and the game I am developing in Godot with my buddies @TheOrioli and crew at Kikimora Games.

See attachments below for reference.

Additional Information: I use GeForce shadowplay for screen capture, and until recently screenshots I would take while playing DOME KEEPER (or our own game) would be placed in a folder named after the title, e.g. Dome Keeper. However, NOW screen captures are put in a folder called 'Base Profile'. Not sure if this is relevant to the issue, but thought it was worth mentioning.

image

DOME KEEPER

NEZUMI - KIKIMORA GAMES

Steps to reproduce

Display Settings - Screenshot 3

Display Settings - Screenshot 4

Prerequisites:

1) Boot DOME KEEPER on Steam 2) Go into the settings menu 3) Set Graphics Mode to 'Borderless Window' 4) Set Stretch Mode to 'Scaled' (Although issue seems to occur regardless of what this is set to) 4) Press OK

Result: Observe that the game now shows on both monitors, and that it behaves in a suboptimal manner when trying to interact with it.

image

Minimal reproduction project

N/A

bruvzg commented 1 year ago

Boot DOME KEEPER on Steam Go into the settings menu Enable borderless

MRP? What exactly borderless option is doing in a dome keeper? Setting window_borderless or some combination of it and window size/position?

knivspark commented 1 year ago

I have updated the repro steps to be a bit more informative + added a screenshot of the menu settings.

knivspark commented 1 year ago

Additional Information: I use GeForce shadowplay for screen capture, and recently screenshots I would take while playing DOME KEEPER (or our own game) would be placed in a folder named after the title, e.g. Dome Keeper. However, NOW screen captures are put in a folder called 'Base Profile'. Not sure if this is relevant to the issue, but thought it was worth mentioning.

image

bruvzg commented 1 year ago

I have updated the repro steps to be a bit more informative + added a screenshot of the menu settings.

This is pretty much completely useless information, like do you expect us to download dome keeper and decompile project and all mono scripts to see what's going on, or what? What would be useful is source code of the methods attached to these buttons, (ideally cleared up from everything unrelated to the issue), or at least an outline of what it is doing.

I use GeForce shadowplay for screen capture

Is it doing it only when screen capturing?

TheOrioli commented 1 year ago

@bruvzg Please be kind, not everyone is a programmer or an experienced open source contributor. Everyone has a first bug report.

The fact that Dome Keeper, a released Godot Engine game has the same issue as a game currently being developed proves at the very minimum that the issue is reproducible across multiple projects, and potentially provides an easy test for contributors as it's a popular game that they might already have. Not to mention that the developers of the game might see the issue and chime in.

On the code side, I can confirm that the only thing our game does is OS.WindowBorderless = true, as we're using C#.

bruvzg commented 1 year ago

On the code side, I can confirm that the only thing our game does is OS.WindowBorderless = true, as we're using C#.

So it's not changing window size/position? What was the window size/position/state before setting it to borderless (it looks like a full-screen on the screenshots)?

bruvzg commented 1 year ago

Also, what's the exact configuration of displays (primary display and alignment), a screenshot of windows "System → Display" control panel would be helpful.

bruvzg commented 1 year ago

I suspect that the window had the same size as the screen before the change. And when borderless is applied, it's somehow confusing compositor/driver to enter full screen mode on the wrong display, since window origin is on it (due to window decoration or screen misalignment). Something like this:

Screenshot 2023-01-13 at 13 46 26

Normally it's only entering full-screen when borderless window have exactly the same rect as screen, so I'm not entry sure if it is the case.

But so for I was not able to reproduce it.

Calinou commented 1 year ago

Related to https://github.com/godotengine/godot/issues/70962 and https://github.com/godotengine/godot/issues/62869 (though that issue is about Resizable).

knivspark commented 1 year ago

Also, what's the exact configuration of displays (primary display and alignment), a screenshot of windows "System → Display" control panel would be helpful.

Display Settings - Screenshot 1

Display Settings - Screenshot 2

Note: Monitor 1 is the main display and both monitors have 1920x1080 resolution.

knivspark commented 1 year ago

I use GeForce shadowplay for screen capture

Is it doing it only when screen capturing?

The issue occurs regardless, with or without screen capturing.

knivspark commented 1 year ago

On the code side, I can confirm that the only thing our game does is OS.WindowBorderless = true, as we're using C#.

So it's not changing window size/position? What was the window size/position/state before setting it to borderless (it looks like a full-screen on the screenshots)?

In both scenarios/games I am changing from full-screen to bordless.

knivspark commented 1 year ago

I suspect that the window had the same size as the screen before the change. And when borderless is applied, it's somehow confusing compositor/driver to enter full screen mode on the wrong display, since window origin is on it (due to window decoration or screen misalignment). Something like this: Screenshot 2023-01-13 at 13 46 26 Normally it's only entering full-screen when borderless window have exactly the same rect as screen, so I'm not entry sure if it is the case.

But so for I was not able to reproduce it.

Can confirm that the issue ONLY occurs for me when the monitors are not perfectly aligned vertically. If they are perfectly aligned the issue does not occur.

Updating the repro steps to include this step.

Display Settings - Screenshot 3

Display Settings - Screenshot 4