Skip to content

winit-support: fix dpi handling in attach_window() when not in defaul… #608

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

Merged
merged 1 commit into from
Feb 21, 2022

Conversation

filnet
Copy link
Contributor

@filnet filnet commented Feb 1, 2022

…t mode

attach_window() was using the imgui scale factor when converting
winit physical size to logical size instead of the winit scale factor.

This would cause the imgui display size to be incorrect when not using the
HiDpiMode::Default mode (in default mode the imgui and winit scale factors
are the same and the issue goes unnoticed).

Note that handle_window_event() has similar (and correct) logic when handling WindowEvent::Resized events.
This also explain why the issue went mostly undiscovered as winit tends to
generate quite a bunch of resize events that would hide the miscalculation
done in attach_window().

A similar issue was also fixed in the WindowEvent::ScaleFactorChanged handling code.

should fix #441

…t mode

attach_window() was using the imgui scale factor when converting
winit physical size to logical size instead of the winit scale factor.

This would cause the imgui display size to be incorrect when not using the
HiDpiMode::Default mode (in default mode the imgui and winit scale factors
are the same and the issue goes unnoticed).

Note that handle_window_event() has similar (and correct) logic when handling WindowEvent::Resized events.
This also explain why the issue went mostly undiscovered as winit tends to
generate quite a bunch of resize events that would hide the miscalculation
done in attach_window().

A similar issue was also fixed in the WindowEvent::ScaleFactorChanged handling code.

should fix imgui-rs#441
@filnet
Copy link
Contributor Author

filnet commented Feb 21, 2022

Any chance to get this reviewed and merged ?

@sanbox-irl
Copy link
Member

hey @filnet sorry about that! I got this confused with my own winit related PR in my notifications.

thanks for the work!

@sanbox-irl sanbox-irl merged commit 169403c into imgui-rs:main Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display size is wrong at startup
2 participants