Hide the small window before percent resizing
This commit is contained in:
parent
443b729de5
commit
de40550d2f
13
src/wofi.c
13
src/wofi.c
@ -1416,6 +1416,7 @@ static gboolean do_percent_size(gpointer data) {
|
||||
bool width_percent = strchr(geo_str[0], '%') != NULL;
|
||||
bool height_percent = strchr(geo_str[1], '%') != NULL && lines == 0;
|
||||
GdkMonitor* monitor = gdk_display_get_monitor_at_window(gdk_display_get_default(), gtk_widget_get_window(window));
|
||||
|
||||
GdkRectangle rect;
|
||||
gdk_monitor_get_geometry(monitor, &rect);
|
||||
if(width_percent) {
|
||||
@ -1425,7 +1426,8 @@ static gboolean do_percent_size(gpointer data) {
|
||||
height = (height / 100.f) * rect.height;
|
||||
}
|
||||
update_surface_size();
|
||||
free(geo_str);
|
||||
|
||||
gtk_widget_show_all(window);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
@ -1628,13 +1630,14 @@ void wofi_init(struct map* _config) {
|
||||
|
||||
gdk_threads_add_timeout(filter_rate, do_search, NULL);
|
||||
|
||||
|
||||
bool delay_show = false;
|
||||
bool width_percent = strchr(width_str, '%') != NULL;
|
||||
bool height_percent = strchr(height_str, '%') != NULL && lines == 0;
|
||||
if(width_percent || height_percent) {
|
||||
char** geo_str = malloc(sizeof(char*) * 2);
|
||||
static char* geo_str[2];
|
||||
geo_str[0] = width_str;
|
||||
geo_str[1] = height_str;
|
||||
delay_show = true;
|
||||
gdk_threads_add_timeout(70, do_percent_size, geo_str);
|
||||
}
|
||||
|
||||
@ -1655,5 +1658,7 @@ void wofi_init(struct map* _config) {
|
||||
gdk_threads_add_idle(insert_all_widgets, modes);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(window), prompt);
|
||||
gtk_widget_show_all(window);
|
||||
if (!delay_show) {
|
||||
gtk_widget_show_all(window);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user