mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 22:31:30 +11:00
Split get_inner_size
Closes https://github.com/tomaka/glutin/issues/542 * Splits `get_inner_size` into `get_inner_size_points` and `get_inner_size_pixels` This is a breaking change.
This commit is contained in:
parent
50c2637703
commit
05175c1d80
|
@ -301,10 +301,25 @@ impl Window {
|
||||||
///
|
///
|
||||||
/// Returns `None` if the window no longer exists.
|
/// Returns `None` if the window no longer exists.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_inner_size(&self) -> Option<(u32, u32)> {
|
pub fn get_inner_size_points(&self) -> Option<(u32, u32)> {
|
||||||
self.window.get_inner_size()
|
self.window.get_inner_size()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the size in pixels of the client area of the window.
|
||||||
|
///
|
||||||
|
/// The client area is the content of the window, excluding the title bar and borders.
|
||||||
|
/// These are the dimensions of the frame buffer, and the dimensions that you should use
|
||||||
|
/// when you call `glViewport`.
|
||||||
|
///
|
||||||
|
/// Returns `None` if the window no longer exists.
|
||||||
|
#[inline]
|
||||||
|
pub fn get_inner_size_pixels(&self) -> Option<(u32, u32)> {
|
||||||
|
self.window.get_inner_size().map(|(x, y)| {
|
||||||
|
let hidpi = self.hidpi_factor();
|
||||||
|
((x as f32 * hidpi) as u32, (y as f32 * hidpi) as u32)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the size in pixels of the window.
|
/// Returns the size in pixels of the window.
|
||||||
///
|
///
|
||||||
/// These dimensions include title bar and borders. If you don't want these, you should use
|
/// These dimensions include title bar and borders. If you don't want these, you should use
|
||||||
|
|
Loading…
Reference in a new issue