@@ -39,7 +39,6 @@ pub struct App {
39
39
prompt_icon : RetainedImage ,
40
40
plugin_manager : PluginManager ,
41
41
error : Option < String > ,
42
- cache_gui_height : f32 ,
43
42
}
44
43
45
44
impl App {
@@ -55,7 +54,6 @@ impl App {
55
54
plugin_manager : PluginManager :: new ( ) ,
56
55
error : None ,
57
56
reset_search_input_cursor : false ,
58
- cache_gui_height : 0.0 ,
59
57
}
60
58
}
61
59
}
@@ -141,46 +139,41 @@ impl App {
141
139
self . render_search_screen ( ui, ctx, preparation, gl_window) ;
142
140
}
143
141
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
173
154
} 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) ;
183
165
}
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) ) ;
184
177
}
185
178
} ) ;
186
179
}
0 commit comments