Making window fullscreen from maximized doesn't cover the taskbar on Windows #86859

Closed
opened 2021-03-23 20:23:50 +01:00 by Vincent Blankfield · 8 comments

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce RTX 3060 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.89

Blender Version
Broken: version: 2.93.0 Alpha, branch: master, commit date: 2021-03-23 18:34, hash: 3ea1779365
Worked: unknown

Short description of error
After invoking Window -> Toggle Window Fullscreen on a maximized window, it doesn't cover the Windows taskbar.

Video example:
0001-0574.avi

This appears to fix the issue:

lines=10
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 70901954df2..8c003edd9ce 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -534,6 +534,9 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
       wp.ptMaxPosition.x = 0;
       wp.ptMaxPosition.y = 0;
       style &= ~WS_CAPTION;
+      /* SetWindowPlacement may be unable to maximize a maximized window, so make it not maximized
+       * in the SetWindowLongPtr call. */
+      style &= ~WS_MAXIMIZE;
       break;
     case GHOST_kWindowStateNormal:
     default:
@@ -541,8 +544,6 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
       break;
   }
   ::SetWindowLongPtr(m_hWnd, GWL_STYLE, style);
-  /* SetWindowLongPtr Docs: frame changes not visible until SetWindowPos with SWP_FRAMECHANGED. */
-  ::SetWindowPos(m_hWnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
   return ::SetWindowPlacement(m_hWnd, &wp) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
 }
 

Though I didn't investigate the issue properly, and the comment is an uneducated guess.

Exact steps for others to reproduce the error

  1. Ensure Blender window is maximized and there is a visible Windows taskbar.
  2. Invoke Window -> Toggle Window Fullscreen.
  3. Observe that the "fullscreen" window doesn't cover the taskbar.

Going fullscreen from non-maximized window works as expected.

**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: GeForce RTX 3060 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.89 **Blender Version** Broken: version: 2.93.0 Alpha, branch: master, commit date: 2021-03-23 18:34, hash: `3ea1779365` Worked: unknown **Short description of error** After invoking `Window -> Toggle Window Fullscreen` on a maximized window, it doesn't cover the Windows taskbar. Video example: [0001-0574.avi](https://archive.blender.org/developer/F9905912/0001-0574.avi) This appears to fix the issue: ``` lines=10 diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 70901954df2..8c003edd9ce 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -534,6 +534,9 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state) wp.ptMaxPosition.x = 0; wp.ptMaxPosition.y = 0; style &= ~WS_CAPTION; + /* SetWindowPlacement may be unable to maximize a maximized window, so make it not maximized + * in the SetWindowLongPtr call. */ + style &= ~WS_MAXIMIZE; break; case GHOST_kWindowStateNormal: default: @@ -541,8 +544,6 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state) break; } ::SetWindowLongPtr(m_hWnd, GWL_STYLE, style); - /* SetWindowLongPtr Docs: frame changes not visible until SetWindowPos with SWP_FRAMECHANGED. */ - ::SetWindowPos(m_hWnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); return ::SetWindowPlacement(m_hWnd, &wp) == TRUE ? GHOST_kSuccess : GHOST_kFailure; } ``` Though I didn't investigate the issue properly, and the comment is an uneducated guess. **Exact steps for others to reproduce the error** 1. Ensure Blender window is maximized and there is a visible Windows taskbar. 2. Invoke `Window -> Toggle Window Fullscreen`. 3. Observe that the "fullscreen" window doesn't cover the taskbar. Going fullscreen from non-maximized window works as expected.

Added subscriber: @VincentBlankfield

Added subscriber: @VincentBlankfield

Added subscriber: @Harley

Added subscriber: @Harley
Member

Thanks @VincentBlankfield ! Will test ASAP. I swear that we needed that thing -- WS_MAXIMIZE -- for full-screen, but now seeing that might not be the case. Interesting...

Thanks @VincentBlankfield ! Will test ASAP. I swear that we needed that thing -- WS_MAXIMIZE -- for full-screen, but now seeing that might not be the case. Interesting...
Member

@VincentBlankfield - As far as I can see, this is all that needs to change. Do you mind giving it a try?

diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 70901954df2..7496874b4b9 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -533,7 +533,7 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
       wp.showCmd = SW_SHOWMAXIMIZED;
       wp.ptMaxPosition.x = 0;
       wp.ptMaxPosition.y = 0;
-      style &= ~WS_CAPTION;
+      style &= ~(WS_CAPTION | WS_MAXIMIZE);
       break;
     case GHOST_kWindowStateNormal:
     default:
@VincentBlankfield - As far as I can see, this is all that needs to change. Do you mind giving it a try? ``` diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 70901954df2..7496874b4b9 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -533,7 +533,7 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state) wp.showCmd = SW_SHOWMAXIMIZED; wp.ptMaxPosition.x = 0; wp.ptMaxPosition.y = 0; - style &= ~WS_CAPTION; + style &= ~(WS_CAPTION | WS_MAXIMIZE); break; case GHOST_kWindowStateNormal: default: ```

Yes, the only change that is necessary is removing the WS_MAXIMIZE style. The reason I removed the SetWindowPos call after SetWindowLongPtr is because I'm not sure it is needed. My bet is that SetWindowPlacement should flush whatever "certain window data is cached" there. That if it isn't skipped at all, which seems to happen when it is called with certain params that are equal to the currently set ones (like WS_MAXIMIZE and SW_SHOWMAXIMIZED). Also everything works fine without the SetWindowPos. As I can't find any proofs one way or another, I'm ok with it being left there or removed. Still while the ~WS_MAXIMIZE trick does seem to work without any issues, I think it is a bit of a hack. I've tried to find some explanation of the current behaviour and learned nothing. Win32 API docs are quite vague on this topic, to put it lightly.

Also, after playing with this part for a bit, I've found two more minor issues:

  1. It is possible to restore the fullscreen window using the system menu. That results in the window without a title. It can be done like this: while Blender is fullscreen, get to the taskbar (alt+tab or win key), hover over the blender icon, right-click the preview, restore.
  2. After toggling fullscreen on a maximized window twice, the window is no longer maximized.

Not sure if I need to create separate bug reports for them, the issues may not deserve such attention. Anyhow, here are the patches for the issues in order:

  1. Current issue. I left SetWindowPos there. Not sure if the ~WS_MAXIMIZE hack needs to be commented. I've moved it to the top, because it will be needed for the next patch. https://developer.blender.org/D10811
  2. Restoring the titleless window. Requires previous patch. https://developer.blender.org/D10812
  3. Maximized -> Toggle Fullscreen -> Toggle Fullscreen. https://developer.blender.org/D10813

Feel free to do with the patches whatever you like. I don't want to stall the development going trough the review with them myself.

Yes, the only change that is necessary is removing the `WS_MAXIMIZE` style. The reason I removed the `SetWindowPos` call after `SetWindowLongPtr` is because I'm not sure it is needed. My bet is that `SetWindowPlacement` should flush whatever "certain window data is cached" there. That if it isn't skipped at all, which seems to happen when it is called with certain params that are equal to the currently set ones (like WS_MAXIMIZE and SW_SHOWMAXIMIZED). Also everything works fine without the `SetWindowPos`. As I can't find any proofs one way or another, I'm ok with it being left there or removed. Still while the `~WS_MAXIMIZE` trick does seem to work without any issues, I think it is a bit of a hack. I've tried to find some explanation of the current behaviour and learned nothing. Win32 API docs are quite vague on this topic, to put it lightly. Also, after playing with this part for a bit, I've found two more minor issues: 2. It is possible to restore the fullscreen window using the system menu. That results in the window without a title. It can be done like this: while Blender is fullscreen, get to the taskbar (alt+tab or win key), hover over the blender icon, right-click the preview, restore. 3. After toggling fullscreen on a maximized window twice, the window is no longer maximized. Not sure if I need to create separate bug reports for them, the issues may not deserve such attention. Anyhow, here are the patches for the issues in order: 1. Current issue. I left `SetWindowPos` there. Not sure if the `~WS_MAXIMIZE` hack needs to be commented. I've moved it to the top, because it will be needed for the next patch. https://developer.blender.org/D10811 2. Restoring the titleless window. Requires previous patch. https://developer.blender.org/D10812 3. Maximized -> Toggle Fullscreen -> Toggle Fullscreen. https://developer.blender.org/D10813 Feel free to do with the patches whatever you like. I don't want to stall the development going trough the review with them myself.
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

This issue was referenced by 12193035ed

This issue was referenced by 12193035ed126ba5eeba7961cce0bcd13cc60ec1
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Harley Acheson self-assigned this 2021-03-26 18:20:19 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#86859
No description provided.