Borderless + maximized window makes it behave like fullscreen
Asked Answered
O

11

0

Hello, I'm experiencing problems with window sizing options. I would really like to have custom window title bar but that leads to problems when window is maximized via OS.window_maximized = true or OS.window_size = OS.get_screen_size().

^ Section of application with custom title bar ^

Application start to behave like application would in fullscreen mod(aka blacking out screens when switching apps, poor alt+tab and not all video capture tools can recognize it right away and snipping tools capture stuff behind app).

Is there a way around it or at least way to modify windows titlebar colour? Will it do the same thing with 4.0?

I'm on windows 10 with Godot 3.4.4

Otoplasty answered 22/4, 2022 at 12:0 Comment(0)
A
0

This may be OS dependent. I think Godot 4.0 is better, because it is borderless by default.

Affected answered 22/4, 2022 at 13:59 Comment(0)
T
0

Godot 4.0 uses borderless fullscreen by default, but exclusive fullscreen can also be chosen.

Godot 3.x automatically uses exclusive fullscreen if the window size matches the screen size. You can work this around by making the window size one pixel smaller on either axis (or both).

Note that this only affects Windows, as macOS/Linux don't have a concept of exclusive fullscreen.

Then answered 22/4, 2022 at 23:4 Comment(0)
B
0

@Calinou said: Godot 3.x automatically uses exclusive fullscreen if the window size matches the screen size.

Why is that though, for performance reasons?

Bostic answered 23/4, 2022 at 5:7 Comment(0)
A
0

I do believe there used to be performance benefits from exclusive fullscreen but, AFAIK, this is far in the past. There is little, if any, difference now. And exclusive just makes it more difficult, black screens, slow alt + tab, worse support for odd resolutions, etc. It's just not worth it, even if there was some small 5 fps gain.

Affected answered 23/4, 2022 at 5:48 Comment(0)
T
0

@cybereality said: I do believe there used to be performance benefits from exclusive fullscreen but, AFAIK, this is far in the past. There is little, if any, difference now. And exclusive just makes it more difficult, black screens, slow alt + tab, worse support for odd resolutions, etc. It's just not worth it, even if there was some small 5 fps gain.

Exclusive fullscreen performs a bit better, but most importantly, it has much lower input lag since it can bypass compositing. Unlike some Linux window managers, Windows no longer allows disabling compositing, so exclusive fullscreen is now the only way to attain this.

Note that on Windows 11, you can enable windowed gaming optimizations which do the same thing. However, this is disabled by default and only works on DirectX 10, 11 and 12 games, not OpenGL, Vulkan or DirectX <= 9 games.

Then answered 23/4, 2022 at 14:11 Comment(0)
A
0

Ah, I see. Yeah, I read an article on the Microsoft docs page, but I guess that was for DX12.

Affected answered 23/4, 2022 at 14:12 Comment(0)
O
0

@Calinou said: Godot 3.x automatically uses exclusive fullscreen if the window size matches the screen size. You can work this around by making the window size one pixel smaller on either axis (or both).

I actually tried that option. but that makes it somewhat difficult cos of taskbar. Some users(including me) prefer it hiding in pc mode but others leave default non hiding bar. That leaves me only option of making window being "always on top" and then it leads it into problems related to those. Well I guess Ill ditch idea of custom title bar in favour of ease of use :/

Otoplasty answered 23/4, 2022 at 17:24 Comment(0)
A
0

Godot 3.x supports borderless in the window options. However, custom title bars are difficult. Drawing them is easy, but dragging the window can be choppy, since it doesn't go through the OS (unless I missed something).

Affected answered 23/4, 2022 at 17:31 Comment(0)
O
0

@cybereality said: Godot 3.x supports borderless in the window options. However, custom title bars are difficult. Drawing them is easy, but dragging the window can be choppy, since it doesn't go through the OS (unless I missed something).

Oh that actually is very easy and it runs smooth starting even on low end PCs. Optimization wise Im building an app for creating json files and it will not drop frames as much if any.

code is just this:

extends Control

var fixed = bool(false)
var dragging = bool(false)
var mouse_pos = Vector2()

func _process(_delta):
	if !fixed and dragging:
		OS.window_position = OS.window_position + get_global_mouse_position() - mouse_pos

func mouse_input(event) -> void:
	if event is InputEventMouseButton:
		if event.get_button_index() == 1 and event.is_pressed():
			fixed = get_tree().get_current_scene().fixed
			mouse_pos = get_local_mouse_position()
			dragging = true
		elif event.get_button_index() == 1 and !event.is_pressed():
			dragging = false

It works fine for me and has no "jitter" to it! showcase

Otoplasty answered 23/4, 2022 at 18:32 Comment(0)
O
0

Also on the side note I failed miserably trying to understand how new window system works in godot 4. I get that it is really cool when you have multi window application. And i think it is future of games to utilize 2 screens. Especially cus steam's research showed that most gamers use 2 1920x1080 screens. :D

Otoplasty answered 23/4, 2022 at 19:1 Comment(0)
C
0

Otoplasty In my case, with this code don't work well. When I slide the screen, this is moved with jitter. How can I solve this?

Caseate answered 24/1 at 7:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.