Fix 104816: Ensure Win32 visible title bar #104848

Merged
Harley Acheson merged 1 commits from Harley/blender:HiddenTitlebar into main 2023-02-17 20:11:55 +01:00
Member

When creating Win32 windows, ensure that the caption bar is visible.


Since #104438 I am wanting to allow blender windows to span multiple monitors, like this:

SpanMonitors.png

This patch fixes a bug with that implementation. When starting Blender without a "startup.blend", the initial window is maximized and is requested to be at 0,0 and at maximum size of the monitor. This displays correctly at first (since it is maximized), but if you then press the "restore down" button the caption bar will be above the monitor top edge.

This is because the requested rectangle must be adjusted by the OS (using either fpAdjustWindowRectExForDpi or AdjustWindowRectEx). If the requested top is zero that adjustment makes it about -38. This is so that the top of our client area is where we requested it to be. But this is not what we actually want.

This patch restores a check to ensure that the caption is not above the top of the applicable monitor. The only complication is that we have to use the monitor that is at the original requested top value. If we use the value after adjustment it might be on the monitor above if the user has a stacked orientation of multiple monitors.

This patch also makes another very small correction. When adjusting for the DPI of the monitor, do so for the monitor that is at the middle of the requested area. This is required because Windows uses exactly this for the DPI of the window for its calculations. Current code would have used the monitor at the bottom-right corner of the window by mistake. This is only an issue when when you have multiple monitors that differ in resolution. The error here could result in the possible misplacement of a window by the difference in caption height, so maybe 5-20 pixels.

When creating Win32 windows, ensure that the caption bar is visible. --- Since https://projects.blender.org/blender/blender/pulls/104438 I am wanting to allow blender windows to span multiple monitors, like this: ![SpanMonitors.png](/attachments/95b0b0e7-5c5f-4ecc-a4a2-0c879f5435ba) This patch fixes a bug with that implementation. When starting Blender *without* a "startup.blend", the initial window is maximized and is requested to be at 0,0 and at maximum size of the monitor. This displays correctly at first (since it is maximized), but if you then press the "restore down" button the caption bar will be above the monitor top edge. This is because the requested rectangle must be adjusted by the OS (using either fpAdjustWindowRectExForDpi or AdjustWindowRectEx). If the requested top is zero that adjustment makes it about -38. This is so that the top of our client area is where we requested it to be. But this is not what we actually want. This patch restores a check to ensure that the caption is not above the top of the applicable monitor. The only complication is that we have to use the monitor that is at the original requested top value. If we use the value after adjustment it might be on the monitor above if the user has a stacked orientation of multiple monitors. This patch also makes another very small correction. When adjusting for the DPI of the monitor, do so for the monitor that is at the middle of the requested area. This is required because Windows uses exactly this for the DPI of the window for its calculations. Current code would have used the monitor at the bottom-right corner of the window by mistake. This is only an issue when when you have multiple monitors that differ in resolution. The error here could result in the possible misplacement of a window by the difference in caption height, so maybe 5-20 pixels.
Harley Acheson requested review from Ray molenkamp 2023-02-17 02:34:36 +01:00

Note, this should go into the 3.5 branch, we're in Bcon3. https://wiki.blender.org/wiki/Process/Using_Stabilizing_Branch

Note, this should go into the 3.5 branch, we're in Bcon3. https://wiki.blender.org/wiki/Process/Using_Stabilizing_Branch
Author
Member

Note, this should go into the 3.5 branch, we're in Bcon3. https://wiki.blender.org/wiki/Process/Using_Stabilizing_Branch

No, this is fixing a bug that is only in 3.6.

> Note, this should go into the 3.5 branch, we're in Bcon3. https://wiki.blender.org/wiki/Process/Using_Stabilizing_Branch No, this is fixing a bug that is only in 3.6.
Ray molenkamp approved these changes 2023-02-17 17:26:10 +01:00
Harley Acheson force-pushed HiddenTitlebar from dd4341e2b2 to 3df9483ab6 2023-02-17 19:23:40 +01:00 Compare
Author
Member

@blender-bot build windows

@blender-bot build windows
Harley Acheson force-pushed HiddenTitlebar from 3df9483ab6 to 5ed7c49ff3 2023-02-17 20:09:27 +01:00 Compare
Harley Acheson merged commit dd2ab55507 into main 2023-02-17 20:11:55 +01:00
Harley Acheson deleted branch HiddenTitlebar 2023-02-17 20:11:55 +01:00
Sign in to join this conversation.
No reviewers
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#104848
No description provided.