Skip to content

Commit

Permalink
Fix multi monitor support
Browse files Browse the repository at this point in the history
  • Loading branch information
fxdave committed Sep 3, 2023
1 parent 923f6a2 commit cc258bf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/vonal_daemon/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,20 @@ impl App {
let monitor_width = monitor.size().width;
let width = self.config.window_width.get_points(monitor_width as f64) as u32;
let height = self.config.window_height.get_points(monitor_height as f64) as u32;

let old_position = gl_window.window().outer_position().unwrap_or_default();
let new_position = PhysicalPosition::new(
if self.config.center_window_horizontally {
monitor_width / 2 - width / 2
monitor.position().x as u32 + monitor_width / 2 - width / 2
} else {
0
monitor.position().x as u32
} as i32,
if self.config.center_window_vertically {
monitor_height / 2 - height / 2
monitor.position().y as u32 + monitor_height / 2 - height / 2
} else {
0
monitor.position().y as u32
} as i32,
);

if old_position != new_position {
gl_window.window().set_outer_position(new_position);
}
Expand Down

0 comments on commit cc258bf

Please sign in to comment.