I want to detect when the user finished re-sizing or moving the GTK window. Basically an equivalent of WM_EXITSIZEMOVE in windows.
I have looked at GTK detecting window resize from the user and am able to detect size/location changes using the configure-event; however because of how my other code is architect I want to know when the resizing is done. Almost like ValueChanged instead of ValueChanging event.
I was thinking if i could find out is the mouse button is released or not and then try to detect if it was the last event I got. But can't find a way to do that either for a window object.
You could use a timeout function that gets called once the resizing is done. The timeout is in ms, you might want to play with the value to get a balance between the delay in calling resize_done and triggering it before the resize is really done.
#define TIMEOUT 250
gboolean resize_done (gpointer data)
{
guint *id = data;
*id = 0;
/* call your existing code here */
return FALSE;
}
gboolean on_configure_event (GtkWidget *window, GdkEvent *event, gpointer data)
{
static guint id = 0;
if (id)
g_source_remove (id);
id = g_timeout_add (TIMEOUT, resize_done, &id);
return FALSE;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With