-
Notifications
You must be signed in to change notification settings - Fork 903
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
Implement public API for high-DPI #319
Conversation
src/events.rs
Outdated
/// * A user changes the desktop scaling value (e.g. in Control Panel on Windows). | ||
/// * A user moves the application window to a display with a different DPI. This message is sent when a window’s | ||
/// position changes such that most of its area lies on a monitor with a DPI that is different from the DPI | ||
/// before the position change. |
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 this behavior will be platform dependent.
For example, on wayland, we don't have the information of how much the window covers a monitor. We just have the list of all monitors that display some part of the surface. Thus, the wayland backend will just return the highest dpi factor of all the monitors currently displaying some part of the window.
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 removed that part
src/window.rs
Outdated
/// | ||
/// Returns `None` if the window no longer exists. | ||
#[inline] | ||
pub fn get_inner_size_points(&self) -> Option<(u32, u32)> { |
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.
These two functions should be deprecated, not removed instantly.
@tomaka |
src/window.rs
Outdated
/// Returns `None` if the window no longer exists. | ||
/// | ||
/// DEPRECATED | ||
#[inline] |
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 didn't mention it, but it should have a #[deprecated]
attribute so that a compiler warning is shown when you use them.
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.
added
Err, sorry for the ping-pong, but the last thing that's missing is an entry in |
…eir implementation assuming get_inner_size() returns size in pixels
I updated changelog. Is there anything else that's need to be done? |
Thanks |
Since the following pull request rust-windowing/winit#319, `winit` has deprecated `get_inner_size_points()` and `get_inner_size_pixels()`. We replace the deprecated API by `get_inner_size()` and `hidpi_factor()`. The size in points in computed from the returned hidpi_factor.
Add OpenGL 4.3 support to the GL backend, enabling compute shader on non-Metal platforms
As discussed in #105. This pull request contains only changes to the winit API, no implementation in any of the backends yet.
MonitorId::get_hidpi_factor() -> f32
method. Currently returns 1 for all backends.WindowEvent::HiDPIFactorChanged(f32)
.Window::get_inner_size_points
andWindow::get_inner_size_pixels
.