From bf521978968f6ae9e4b58e73b018365283f81ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Sun, 12 Feb 2023 13:53:45 +0100 Subject: [PATCH] plugin: Present fallback window right after assembled UI When started from gst-play/launch-1.0 show window right after it was created. No need to idle dispatch window present when changing state, since we are already on correct thread when opening resources using start() method. --- lib/gst/plugin/gstclappersink.c | 23 +++-------------------- lib/gst/plugin/gstclappersink.h | 2 -- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/lib/gst/plugin/gstclappersink.c b/lib/gst/plugin/gstclappersink.c index e6356162..ae4c3e4c 100644 --- a/lib/gst/plugin/gstclappersink.c +++ b/lib/gst/plugin/gstclappersink.c @@ -67,7 +67,6 @@ window_clear_no_lock (GstClapperSink *self) self->window_destroy_id = 0; } self->window = NULL; - self->presented_window = FALSE; } static void @@ -568,6 +567,9 @@ gst_clapper_sink_start_on_main (GstClapperSink *self) self->window_destroy_id = g_signal_connect (self->window, "destroy", G_CALLBACK (window_destroy_cb), self); + + GST_INFO_OBJECT (self, "Presenting window"); + gtk_window_present (self->window); } GST_CLAPPER_SINK_UNLOCK (self); @@ -575,15 +577,6 @@ gst_clapper_sink_start_on_main (GstClapperSink *self) return TRUE; } -static gboolean -window_present_on_main_idle (GtkWindow *window) -{ - GST_INFO ("Presenting window"); - gtk_window_present (window); - - return G_SOURCE_REMOVE; -} - static gboolean gst_clapper_sink_start (GstBaseSink *bsink) { @@ -658,16 +651,6 @@ gst_clapper_sink_change_state (GstElement *element, GstStateChange transition) } GST_CLAPPER_SINK_UNLOCK (self); break; - case GST_STATE_CHANGE_PAUSED_TO_PLAYING: - GST_CLAPPER_SINK_LOCK (self); - if (G_UNLIKELY (self->window && !self->presented_window)) { - g_idle_add_full (G_PRIORITY_DEFAULT, - (GSourceFunc) window_present_on_main_idle, - g_object_ref (self->window), (GDestroyNotify) g_object_unref); - self->presented_window = TRUE; - } - GST_CLAPPER_SINK_UNLOCK (self); - break; default: break; } diff --git a/lib/gst/plugin/gstclappersink.h b/lib/gst/plugin/gstclappersink.h index 79efa146..489c64bb 100644 --- a/lib/gst/plugin/gstclappersink.h +++ b/lib/gst/plugin/gstclappersink.h @@ -54,8 +54,6 @@ struct _GstClapperSink GtkWidget *widget; GtkWindow *window; - gboolean presented_window; - /* Properties */ gboolean force_aspect_ratio; gint par_n, par_d;