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

Unable to use OS.set_current_screen while in true fullscreen #14620

Closed
TheSHEEEP opened this issue Dec 13, 2017 · 5 comments
Closed

Unable to use OS.set_current_screen while in true fullscreen #14620

TheSHEEEP opened this issue Dec 13, 2017 · 5 comments

Comments

@TheSHEEEP
Copy link

Operating system or device, Godot version, GPU Model and driver (if graphics related):
Windows 64bit & NVIDIA GeForce GTX 970
Linux 64bit & NVIDIA GeForce GTX 1060
Godot 2.1.4

Issue description:
When the application is in true fullscreen mode (via OS.set_window_fullscreen), using OS.set_current_screen does not do anything.
You'd expect it would switch to the passed monitor.

As a workaround, you have to switch the window to another mode (like windowed or borderless fullscreen), before calling OS.set_current_screen. Then, you can apply true fullscreen again.
It isn't too much work, but still shouldn't be required.

Steps to reproduce:
Try above description in the window management demo.

@sturnclaw
Copy link
Contributor

Can you confirm this still occurs on Godot 3.0.3 / master?

@johnzantey
Copy link

FYI: Used your suggested workaround for Linux on GD 3.2.1 - TY

@akien-mga
Copy link
Member

At least on Linux OS.set_current_screen seems to have dedicated code to handle the fullscreen mode:

godot/platform/x11/os_x11.cpp

Lines 1184 to 1194 in 2d57df6

if (current_videomode.fullscreen) {
Point2i position = get_screen_position(p_screen);
Size2i size = get_screen_size(p_screen);
XMoveResizeWindow(x11_display, x11_window, position.x, position.y, size.x, size.y);
} else {
if (p_screen != get_current_screen()) {
Point2i position = get_screen_position(p_screen);
XMoveWindow(x11_display, x11_window, position.x, position.y);
}
}

But it could be that it doesn't work. (CC @bruvzg @pouleyKetchoupp)

@acgc99
Copy link

acgc99 commented Mar 6, 2022

Same issue in Godot Engine v3.4.stable.official.206ba70f4

If fullscreen is enabled from Project>Settings:

print(OS.get_screen_count() )
if OS.get_screen_count() > 1:
	print(OS.get_current_screen())
	OS.set_current_screen(1)
	print(OS.get_current_screen())

Prints

2
0
0

And the game screen is 0.

But if I disable fullscreen and do:

print(OS.get_screen_count() )
if OS.get_screen_count() > 1:
	print(OS.get_current_screen())
	OS.set_current_screen(1)
	print(OS.get_current_screen())
	OS.window_fullscreen = !OS.window_fullscreen

I get:

2
0
1

And it works as expected.

@akien-mga
Copy link
Member

Fixed by #63192.

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

No branches or pull requests

7 participants