-
-
Notifications
You must be signed in to change notification settings - Fork 202
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
fix(windows): calculate accurate window insets for undecorated shadows #1052
Conversation
Package Changes Through d9ee4a7There are 1 changes which include tao with minor Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
@Legend-Master can you check if this fixes the Windows 10 borders? I mean this one tauri-apps/tauri#11654 |
Seems like the title bar is still there with the change? The resize handle is at the bottom of the title bar and you can't click that title bar (will click through) Tested on Windows 10 using the decorations example with let window = WindowBuilder::new()
.with_title("Hit space to toggle decorations.")
.with_inner_size(LogicalSize::new(400.0, 200.0))
.with_decorations(false)
.build(&event_loop)
.unwrap(); |
src/platform_impl/windows/util.rs
Outdated
let frame_thickness = get_frame_thickness(dpi); | ||
|
||
let top_inset = match WIN_VERSION.build { | ||
v if v >= 2200 => (dpi as f32 / USER_DEFAULT_SCREEN_DPI as f32).round() as i32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v if v >= 2200 => (dpi as f32 / USER_DEFAULT_SCREEN_DPI as f32).round() as i32, | |
v if v >= 22000 => (dpi as f32 / USER_DEFAULT_SCREEN_DPI as f32).round() as i32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, the window looks like this, the top border is missing and also not resizable from that edge
I have read about an article https://kubyshkin.name/posts/win32-window-custom-title-bar-caption/ talking about this before, and the idea is that you need to draw your own top border to fake it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, the window looks like this, the top border is missing and also not resizable from that edge
I have read about an article https://kubyshkin.name/posts/win32-window-custom-title-bar-caption/ talking about this before, and the idea is that you need to draw your own top border to fake it...
I did read that one before but I don't want to add any custom drawing inside taol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR is good enough for aesthetics, don't you think?
As for, functionality maybe we bring back custom hittesting for only top border only on Windows 10?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did read that one before but I don't want to add any custom drawing inside taol.
Yeah, same thoughts here
I think this PR is good enough for aesthetics, don't you think?
Yeah, it's good enough to me, at least it's much better than what we had before ;)
Also I have tested WindowsAppSdk sometime ago, and their ExtendsContentIntoTitleBar
also had this problem (and they draw control buttons themselves as you tell can from the icons)
As for, functionality maybe we bring back custom hittesting for only top border only on Windows 10?
I think we'll need this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Legend-Master does top-left and top-right resizing edge work and only top doesn't or all 3 don't work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually looks like the issues exists in Windows 11 too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be good to go now
Co-authored-by: Tony <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great, tested maximized and normal window on Windows 10, the position and size seems to be right as well, awesome work!
ref: https://github.com/zed-industries/zed/blob/7bddb390cabefb177d9996dc580749d64e6ca3b6/crates/gpui/src/platform/windows/events.rs#L1418-L1454
closes #905