aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2015-07-25 14:09:17 +0200
committertomaka <pierre.krieger1708@gmail.com>2015-07-25 14:09:17 +0200
commitf6b7088011254b37a11111a5a19c896b7db0d7bd (patch)
tree650cf3b0c592e2969ea9594d9c56e324eaeabc25
parent50c263770367d322992b615930508b0996f83ef4 (diff)
parent79b8cf2cc87ccf013254afb44d287a47eea6fe44 (diff)
downloadglutin-f6b7088011254b37a11111a5a19c896b7db0d7bd.tar.gz
glutin-f6b7088011254b37a11111a5a19c896b7db0d7bd.zip
Merge pull request #545 from bvssvni/inner-split
Split `get_inner_size`
-rw-r--r--src/window.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/window.rs b/src/window.rs
index ac52ed7..00174d3 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -300,10 +300,39 @@ impl Window {
/// To get the dimensions of the frame buffer when calling `glViewport`, multiply with hidpi factor.
///
/// Returns `None` if the window no longer exists.
+ ///
+ /// DEPRECATED
#[inline]
pub fn get_inner_size(&self) -> Option<(u32, u32)> {
self.window.get_inner_size()
}
+
+ /// Returns the size in points of the client area of the window.
+ ///
+ /// The client area is the content of the window, excluding the title bar and borders.
+ /// To get the dimensions of the frame buffer when calling `glViewport`, multiply with hidpi factor.
+ ///
+ /// Returns `None` if the window no longer exists.
+ #[inline]
+ pub fn get_inner_size_points(&self) -> Option<(u32, u32)> {
+ 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.
///