aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2022-01-11 23:41:57 +0300
committerGitHub <noreply@github.com>2022-01-11 20:41:57 +0000
commit01c1cc1278268e1447cf979fe71225f6cd4f27b3 (patch)
tree90c26d569a7213d44b50f1bbaebbce60da8bc79e
parenta8c8c57907ebad136f9344b2ca5853ba49fa4584 (diff)
downloadalacritty-01c1cc1278268e1447cf979fe71225f6cd4f27b3.tar.gz
alacritty-01c1cc1278268e1447cf979fe71225f6cd4f27b3.zip
Use `with_position` instead of `set_outer_position`
This uses `with_position` method on a `WindowBuilder` instead of setting window position on the created window later on.
-rw-r--r--alacritty/src/display/mod.rs10
-rw-r--r--alacritty/src/display/window.rs11
2 files changed, 7 insertions, 14 deletions
diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs
index cb5e2a42..f2bf2ad7 100644
--- a/alacritty/src/display/mod.rs
+++ b/alacritty/src/display/mod.rs
@@ -9,7 +9,7 @@ use std::sync::atomic::Ordering;
use std::time::Instant;
use std::{f64, mem};
-use glutin::dpi::{PhysicalPosition, PhysicalSize};
+use glutin::dpi::PhysicalSize;
use glutin::event::ModifiersState;
use glutin::event_loop::EventLoopWindowTarget;
#[cfg(not(any(target_os = "macos", windows)))]
@@ -308,14 +308,6 @@ impl Display {
window.set_visible(true);
- // Set window position.
- //
- // TODO: replace `set_position` with `with_position` once available.
- // Upstream issue: https://github.com/rust-windowing/winit/issues/806.
- if let Some(position) = config.window.position {
- window.set_outer_position(PhysicalPosition::from((position.x, position.y)));
- }
-
#[allow(clippy::single_match)]
#[cfg(not(windows))]
match config.window.startup_mode {
diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs
index ee2e74fc..493e5ef9 100644
--- a/alacritty/src/display/window.rs
+++ b/alacritty/src/display/window.rs
@@ -175,7 +175,12 @@ impl Window {
wayland_event_queue: Option<&EventQueue>,
) -> Result<Window> {
let identity = identity.clone();
- let window_builder = Window::get_platform_window(&identity, &config.window);
+ let mut window_builder = Window::get_platform_window(&identity, &config.window);
+
+ if let Some(position) = config.window.position {
+ window_builder = window_builder
+ .with_position(PhysicalPosition::<i32>::from((position.x, position.y)));
+ }
// Check if we're running Wayland to disable vsync.
#[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
@@ -360,10 +365,6 @@ impl Window {
self.window().request_user_attention(attention);
}
- pub fn set_outer_position(&self, pos: PhysicalPosition<i32>) {
- self.window().set_outer_position(pos);
- }
-
#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
pub fn x11_window_id(&self) -> Option<usize> {
self.window().xlib_window().map(|xlib_window| xlib_window as usize)