From fb6a7f730136dddcef06f2ada56667086069c02f Mon Sep 17 00:00:00 2001 From: otaj Date: Tue, 8 Aug 2023 23:00:43 +0200 Subject: [PATCH] Make sure that the first calculation of percent size is done when the window is visible --- src/wofi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wofi.c b/src/wofi.c index 3a90bda..f061f60 100644 --- a/src/wofi.c +++ b/src/wofi.c @@ -1662,6 +1662,12 @@ static gboolean do_percent_size(gpointer data) { return G_SOURCE_CONTINUE; } +static gboolean do_percent_size_first(gpointer data){ + gdk_threads_add_timeout(50, do_percent_size, data); + do_percent_size(data); + return G_SOURCE_REMOVE; +} + void wofi_init(struct map* _config) { config = _config; char* width_str = config_get(config, "width", "50%"); @@ -1968,8 +1974,7 @@ void wofi_init(struct map* _config) { static char* geo_str[2]; geo_str[0] = width_str; geo_str[1] = height_str; - gdk_threads_add_timeout(50, do_percent_size, geo_str); - do_percent_size(geo_str); + gdk_threads_add_timeout(25, do_percent_size_first, geo_str); } wl_list_init(&mode_list);