Hide the small window before percent resizing

This commit is contained in:
lbonn 2020-04-22 11:22:23 +02:00
parent 443b729de5
commit de40550d2f

View File

@ -1416,6 +1416,7 @@ static gboolean do_percent_size(gpointer data) {
bool width_percent = strchr(geo_str[0], '%') != NULL; bool width_percent = strchr(geo_str[0], '%') != NULL;
bool height_percent = strchr(geo_str[1], '%') != NULL && lines == 0; 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)); GdkMonitor* monitor = gdk_display_get_monitor_at_window(gdk_display_get_default(), gtk_widget_get_window(window));
GdkRectangle rect; GdkRectangle rect;
gdk_monitor_get_geometry(monitor, &rect); gdk_monitor_get_geometry(monitor, &rect);
if(width_percent) { if(width_percent) {
@ -1425,7 +1426,8 @@ static gboolean do_percent_size(gpointer data) {
height = (height / 100.f) * rect.height; height = (height / 100.f) * rect.height;
} }
update_surface_size(); update_surface_size();
free(geo_str);
gtk_widget_show_all(window);
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
@ -1628,13 +1630,14 @@ void wofi_init(struct map* _config) {
gdk_threads_add_timeout(filter_rate, do_search, NULL); gdk_threads_add_timeout(filter_rate, do_search, NULL);
bool delay_show = false;
bool width_percent = strchr(width_str, '%') != NULL; bool width_percent = strchr(width_str, '%') != NULL;
bool height_percent = strchr(height_str, '%') != NULL && lines == 0; bool height_percent = strchr(height_str, '%') != NULL && lines == 0;
if(width_percent || height_percent) { if(width_percent || height_percent) {
char** geo_str = malloc(sizeof(char*) * 2); static char* geo_str[2];
geo_str[0] = width_str; geo_str[0] = width_str;
geo_str[1] = height_str; geo_str[1] = height_str;
delay_show = true;
gdk_threads_add_timeout(70, do_percent_size, geo_str); 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); gdk_threads_add_idle(insert_all_widgets, modes);
gtk_window_set_title(GTK_WINDOW(window), prompt); gtk_window_set_title(GTK_WINDOW(window), prompt);
if (!delay_show) {
gtk_widget_show_all(window); gtk_widget_show_all(window);
} }
}