mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 21:31:29 +11:00
Fix macOS window sizes to follow convention with changelog entry (#435)
* Fix macOS window sizes to follow convention * Add changelog entry
This commit is contained in:
parent
580321b56f
commit
591e0d9b8e
|
@ -5,6 +5,7 @@
|
||||||
- On X11, input method creation first tries to use the value from the user's `XMODIFIERS` environment variable, so application developers should no longer need to manually call `XSetLocaleModifiers`. If that fails, fallbacks are tried, which should prevent input method initialization from ever outright failing.
|
- On X11, input method creation first tries to use the value from the user's `XMODIFIERS` environment variable, so application developers should no longer need to manually call `XSetLocaleModifiers`. If that fails, fallbacks are tried, which should prevent input method initialization from ever outright failing.
|
||||||
- Fixed thread safety issues with input methods on X11.
|
- Fixed thread safety issues with input methods on X11.
|
||||||
- Add support for `Touch` for win32 backend.
|
- Add support for `Touch` for win32 backend.
|
||||||
|
- Fixed `Window::get_inner_size` and friends to return the size in pixels instead of points when using HIDPI displays on OSX.
|
||||||
|
|
||||||
# Version 0.11.3 (2018-03-28)
|
# Version 0.11.3 (2018-03-28)
|
||||||
|
|
||||||
|
|
|
@ -560,22 +560,25 @@ impl Window2 {
|
||||||
pub fn get_inner_size(&self) -> Option<(u32, u32)> {
|
pub fn get_inner_size(&self) -> Option<(u32, u32)> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let view_frame = NSView::frame(*self.view);
|
let view_frame = NSView::frame(*self.view);
|
||||||
Some((view_frame.size.width as u32, view_frame.size.height as u32))
|
let factor = self.hidpi_factor() as f64; // API convention is that size is in physical pixels
|
||||||
|
Some(((view_frame.size.width*factor) as u32, (view_frame.size.height*factor) as u32))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_outer_size(&self) -> Option<(u32, u32)> {
|
pub fn get_outer_size(&self) -> Option<(u32, u32)> {
|
||||||
|
let factor = self.hidpi_factor() as f64; // API convention is that size is in physical pixels
|
||||||
unsafe {
|
unsafe {
|
||||||
let window_frame = NSWindow::frame(*self.window);
|
let window_frame = NSWindow::frame(*self.window);
|
||||||
Some((window_frame.size.width as u32, window_frame.size.height as u32))
|
Some(((window_frame.size.width*factor) as u32, (window_frame.size.height*factor) as u32))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_inner_size(&self, width: u32, height: u32) {
|
pub fn set_inner_size(&self, width: u32, height: u32) {
|
||||||
|
let factor = self.hidpi_factor() as f64; // API convention is that size is in physical pixels
|
||||||
unsafe {
|
unsafe {
|
||||||
NSWindow::setContentSize_(*self.window, NSSize::new(width as f64, height as f64));
|
NSWindow::setContentSize_(*self.window, NSSize::new((width as f64)/factor, (height as f64)/factor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue