diff options
Diffstat (limited to 'src/x11_in_gtk3.c')
-rw-r--r-- | src/x11_in_gtk3.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/x11_in_gtk3.c b/src/x11_in_gtk3.c index c93f3dd..bd0ee3b 100644 --- a/src/x11_in_gtk3.c +++ b/src/x11_in_gtk3.c @@ -1,18 +1,5 @@ -/* - Copyright 2011-2020 David Robillard <d@drobilla.net> - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ +// Copyright 2011-2021 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC #include "suil_internal.h" #include "warnings.h" @@ -50,6 +37,7 @@ typedef struct { const LV2UI_Idle_Interface* idle_iface; guint idle_id; guint idle_ms; + guint idle_size_request_id; int initial_width; int initial_height; int req_width; @@ -114,6 +102,11 @@ on_plug_removed(GtkSocket* sock, gpointer data) self->idle_id = 0; } + if (self->idle_size_request_id) { + g_source_remove(self->idle_size_request_id); + self->idle_size_request_id = 0; + } + if (self->instance->handle) { self->instance->descriptor->cleanup(self->instance->handle); self->instance->handle = NULL; @@ -207,8 +200,11 @@ forward_key_event(SuilX11Wrapper* socket, GdkEvent* gdk_event) static gboolean idle_size_request(gpointer user_data) { - GtkWidget* w = GTK_WIDGET(user_data); + SuilX11Wrapper* socket = (SuilX11Wrapper*)user_data; + GtkWidget* w = GTK_WIDGET(socket->plug); + gtk_widget_queue_resize(w); + socket->idle_size_request_id = 0; return FALSE; } @@ -264,7 +260,7 @@ forward_size_request(SuilX11Wrapper* socket, GtkAllocation* allocation) } else { /* Child has not been realized, so unable to resize now. Queue an idle resize. */ - g_idle_add(idle_size_request, socket->plug); + socket->idle_size_request_id = g_idle_add(idle_size_request, socket); } } |