Skip to content

Commit c46bf9c

Browse files
committed
Fix resolution change
1 parent ed065a1 commit c46bf9c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/vonal_daemon/app.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,11 @@ impl App {
118118

119119
// render window
120120
egui::CentralPanel::default().frame(frame).show(ctx, |ui| {
121-
if let Some(monitor) = gl_window.window().current_monitor() {
121+
let focused_monitor = gl_window.get_focused_monitor();
122+
123+
if let Some(monitor) = focused_monitor.as_ref() {
122124
let monitor_height = monitor.size().height;
123125
let monitor_width = monitor.size().width;
124-
125126
let width = self.config.window_width.get_points(monitor_width as f64) as u32;
126127
let height = self.config.window_height.get_points(monitor_height as f64) as u32;
127128
ui.set_max_size(vec2(
@@ -133,13 +134,14 @@ impl App {
133134
height as f32 / ctx.pixels_per_point(),
134135
));
135136
}
137+
136138
if let Some(error) = self.error.as_ref() {
137139
self.render_error_screen(ui, error);
138140
} else {
139141
self.render_search_screen(ui, ctx, preparation, gl_window);
140142
}
141143

142-
if let Some(monitor) = gl_window.get_focused_monitor() {
144+
if let Some(monitor) = focused_monitor.as_ref() {
143145
let real_height = ui.cursor().min.y * ctx.pixels_per_point();
144146
let monitor_height = monitor.size().height;
145147
let monitor_width = monitor.size().width;
@@ -173,6 +175,8 @@ impl App {
173175
gl_window.resize(size);
174176
gl_window.window().set_inner_size(size);
175177
gl_window.window().set_max_inner_size(Some(size));
178+
} else {
179+
println!("VONAL: no monitor found")
176180
}
177181
});
178182
}

0 commit comments

Comments
 (0)