Skip to content

Commit 0c14552

Browse files
committed
Fix size
1 parent 4fba23e commit 0c14552

File tree

1 file changed

+33
-40
lines changed

1 file changed

+33
-40
lines changed

src/vonal_daemon/app.rs

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ pub struct App {
3939
prompt_icon: RetainedImage,
4040
plugin_manager: PluginManager,
4141
error: Option<String>,
42-
cache_gui_height: f32,
4342
}
4443

4544
impl App {
@@ -55,7 +54,6 @@ impl App {
5554
plugin_manager: PluginManager::new(),
5655
error: None,
5756
reset_search_input_cursor: false,
58-
cache_gui_height: 0.0,
5957
}
6058
}
6159
}
@@ -141,46 +139,41 @@ impl App {
141139
self.render_search_screen(ui, ctx, preparation, gl_window);
142140
}
143141

144-
let real_height = ui.cursor().min.y * ctx.pixels_per_point();
145-
if (self.cache_gui_height - real_height).abs() > 0.1 {
146-
if let Some(monitor) = gl_window.window().current_monitor() {
147-
let real_height = ui.cursor().min.y * ctx.pixels_per_point();
148-
let monitor_height = monitor.size().height;
149-
let monitor_width = monitor.size().width;
150-
151-
let width = self.config.window_width.get_points(monitor_width as f64) as u32;
152-
let height = self.config.window_height.get_points(monitor_height as f64) as u32;
153-
154-
let old_position = gl_window.window().outer_position().unwrap_or_default();
155-
let new_position = PhysicalPosition::new(
156-
if self.config.center_window_horizontally {
157-
monitor_width / 2 - width / 2
158-
} else {
159-
0
160-
} as i32,
161-
if self.config.center_window_vertically {
162-
monitor_height / 2 - height / 2
163-
} else {
164-
0
165-
} as i32,
166-
);
167-
if old_position != new_position {
168-
gl_window.window().set_outer_position(new_position);
169-
}
170-
171-
let height = if self.config.auto_set_window_height {
172-
real_height as u32
142+
if let Some(monitor) = gl_window.window().current_monitor() {
143+
let real_height = ui.cursor().min.y * ctx.pixels_per_point();
144+
let monitor_height = monitor.size().height;
145+
let monitor_width = monitor.size().width;
146+
147+
let width = self.config.window_width.get_points(monitor_width as f64) as u32;
148+
let height = self.config.window_height.get_points(monitor_height as f64) as u32;
149+
150+
let old_position = gl_window.window().outer_position().unwrap_or_default();
151+
let new_position = PhysicalPosition::new(
152+
if self.config.center_window_horizontally {
153+
monitor_width / 2 - width / 2
173154
} else {
174-
height
175-
} + ((self.config.border_width).max(self.config.shadow_size)
176-
* ctx.pixels_per_point()) as u32;
177-
let size = PhysicalSize { width, height };
178-
gl_window.resize(size);
179-
gl_window.window().set_inner_size(size);
180-
gl_window.window().set_max_inner_size(Some(size));
181-
182-
self.cache_gui_height = real_height;
155+
0
156+
} as i32,
157+
if self.config.center_window_vertically {
158+
monitor_height / 2 - height / 2
159+
} else {
160+
0
161+
} as i32,
162+
);
163+
if old_position != new_position {
164+
gl_window.window().set_outer_position(new_position);
183165
}
166+
167+
let height = if self.config.auto_set_window_height {
168+
real_height as u32
169+
} else {
170+
height
171+
} + ((self.config.border_width).max(self.config.shadow_size)
172+
* ctx.pixels_per_point()) as u32;
173+
let size = PhysicalSize { width, height };
174+
gl_window.resize(size);
175+
gl_window.window().set_inner_size(size);
176+
gl_window.window().set_max_inner_size(Some(size));
184177
}
185178
});
186179
}

0 commit comments

Comments
 (0)