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

windows: Fix incorrect titlebar behavior with a scale factor greater than 1.0 #9438

Closed
wants to merge 5 commits into from

Conversation

JunkuiZhang
Copy link
Contributor

Fixed the issue where the titlebar functionality was not working correctly when the scale factor was greater than 1.0.

As I mentioned in #8809 , support for scale factors greater than 1.0 will require more efforts on the blade side.

Titlebar incorrect behaviour (with scale factor 1.5):

8.mp4

Release Notes:

  • N/A

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 16, 2024
@kazatsuyu kazatsuyu mentioned this pull request Mar 16, 2024
1 task
@@ -1593,3 +1596,4 @@ fn oemkey_vkcode_to_string(code: u16) -> Option<String> {

// https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-dragqueryfilew
const DRAGDROP_GET_FILES_COUNT: u32 = 0xFFFFFFFF;
const DEFAULT_DPI_VALUE: u32 = 96;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use USER_DEFAULT_SCREEN_DPI

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

let frame_y = unsafe { GetSystemMetricsForDpi(SM_CYFRAME, dpi) };
let padding = unsafe { GetSystemMetricsForDpi(SM_CXPADDEDBORDER, dpi) };
// let dpi = unsafe { GetDpiForWindow(self.hwnd) };
let frame_x = unsafe { GetSystemMetricsForDpi(SM_CXFRAME, USER_DEFAULT_SCREEN_DPI) };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to go to using USER_DEFAULT_SCREEN_API here and instead use these values in the platform titlebar which are existing TODOs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done here. #9449
@JunkuiZhang give it a try!

@JunkuiZhang
Copy link
Contributor Author

Should be addressed by #9456

@JunkuiZhang JunkuiZhang marked this pull request as draft March 17, 2024 11:03
@maxdeviant maxdeviant changed the title Windows: Fix incorrect titlebar behaviour with a salcer factor greater than 1.0 windows: Fix incorrect titlebar behavior with a scale factor greater than 1.0 Mar 18, 2024
mikayla-maki pushed a commit that referenced this pull request Mar 20, 2024
screenshots and description incoming

## title bar when window is maximized
| before | after |
| ---    | ---   |
|
![image](https://github.com/zed-industries/zed/assets/1284289/075a943d-54db-4b71-9fa0-15f823255182)
|
![image](https://github.com/zed-industries/zed/assets/1284289/39a1d381-fcfd-4651-aab4-231a8ec3bd99)
|

## ~~caption buttons at 200%~~
~~buttons are now properly responsive at different scales~~
~~closes #9438~~
~~proper scale factor handling in follow up PR (possibly #9440)~~

<details>
  <summary>out of date image</summary>


![scale-factor](https://github.com/zed-industries/zed/assets/1284289/299d37b8-0d2e-4f2e-81db-2fff6fc59a62)
</details>

should be fixed by #9456


Release Notes:

- N/A
pjlast pushed a commit to pjlast/zed that referenced this pull request Mar 26, 2024
screenshots and description incoming

## title bar when window is maximized
| before | after |
| ---    | ---   |
|
![image](https://github.com/zed-industries/zed/assets/1284289/075a943d-54db-4b71-9fa0-15f823255182)
|
![image](https://github.com/zed-industries/zed/assets/1284289/39a1d381-fcfd-4651-aab4-231a8ec3bd99)
|

## ~~caption buttons at 200%~~
~~buttons are now properly responsive at different scales~~
~~closes zed-industries#9438~~
~~proper scale factor handling in follow up PR (possibly zed-industries#9440)~~

<details>
  <summary>out of date image</summary>


![scale-factor](https://github.com/zed-industries/zed/assets/1284289/299d37b8-0d2e-4f2e-81db-2fff6fc59a62)
</details>

should be fixed by zed-industries#9456


Release Notes:

- N/A
@JunkuiZhang JunkuiZhang deleted the titlebar-fix branch April 10, 2024 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants