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

Can fullscreen and maximized work well at the same time? #1087

Open
owtotwo opened this issue Mar 5, 2025 · 0 comments
Open

Can fullscreen and maximized work well at the same time? #1087

owtotwo opened this issue Mar 5, 2025 · 0 comments

Comments

@owtotwo
Copy link

owtotwo commented Mar 5, 2025

Describe the bug
When using set_fullscreen() and set_maximized() together for window resizing, strange and counterintuitive behaviors will occur.

Steps To Reproduce
For now, let's only discuss the case where fullscreen is borderless fullscreen. (That is to say, Fullscreen::Borderless(None))

  1. set_fullscreen(false) and set_maximized(false), we have a normal window. (√)
  2. set_maximized(true), the window now enlarges and fills the monitor, except for the taskbar at the bottom. (√)
  3. set_fullscreen(true), the window fullscreen works just fine, the decorations part (title bar) disappears, the bottom taskbar is also covered(There is still a problem here, but we don't discuss it for now.[1]), and the window fills the monitor completely. (√)
  4. Here comes the point, we set_maximized(false), the window is restored to a normal size window, ignoring the fullscreen setting (we set it to true in step 3). At this time, is_fullscreen() returns true. (X)

Expected behavior
At this point, the behavior we expect should be to retain the borderless full screen (fill the monitor) and restore to a normal window when set_fullscreen(false) is called (because is_maximized() is already false at this time).

My thoughts
I think the error at this time is that the window size value of the borderless window is wrong.

The reason is that the Win32 window restores the window to a normal size window by setting SW_RESTORE through ShowWindow (it restores the normal window size value stored before the enlarged window). Because this single API does not consider that the borderless window is still full screen size at this time (even if it is borderless full screen).

We can observe that the window after step 4 has no decorations and cannot be resized. (Even if their value is true.) Therefore, we can assume that it is still a borderless fullscreen window, but there is a problem with the window size value.

Screenshots
Before step 1 (normal window):
Image
After step 4 (wrong fulllscreen)
Image

Platform and Versions (please complete the following information):
OS: Windows 11 Pro 24H2 (26100.3194)
Rustc: rustc 1.85.0 (4d91de4e4 2025-02-17)

Additional context
[1]: The config { decorations: false, fullscreen: true, maximized: true } will cause rendering errors in the taskbar below.

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

1 participant