aboutsummaryrefslogtreecommitdiff
path: root/src/window.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.rs')
-rw-r--r--src/window.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/window.rs b/src/window.rs
index cceffcab..54f0b887 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -24,7 +24,7 @@ use glutin::{
self, ContextBuilder, ControlFlow, Event, EventsLoop,
MouseCursor as GlutinMouseCursor, WindowBuilder,
};
-use glutin::dpi::{LogicalPosition, LogicalSize, PhysicalSize};
+use glutin::dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize};
use crate::cli::Options;
use crate::config::{Decorations, WindowConfig};
@@ -182,6 +182,13 @@ impl Window {
self.window.set_inner_size(size);
}
+ // TODO: use `with_position` once available
+ // Upstream issue: https://github.com/tomaka/winit/issues/806
+ pub fn set_position(&mut self, x: i32, y: i32) {
+ let logical = PhysicalPosition::from((x, y)).to_logical(self.window.get_hidpi_factor());
+ self.window.set_position(logical);
+ }
+
#[inline]
pub fn hidpi_factor(&self) -> f64 {
self.window.get_hidpi_factor()