summaryrefslogtreecommitdiff
path: root/ext/gtk
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@gnome.org>2015-09-19 11:46:37 +0200
committerThibault Saunier <tsaunier@gnome.org>2015-09-19 12:31:49 +0200
commita2bdce8df3ba76587cb273d7d5aaed0d6dd39fbc (patch)
tree998468c21b0c3b08163b0a0488f8131701b4747a /ext/gtk
parent07203364cb444360e4ecb320e3c7a5dab61af5ee (diff)
downloadgstreamer-plugins-bad-a2bdce8df3ba76587cb273d7d5aaed0d6dd39fbc.tar.gz
gtkglsink: Hide and clean the GtkWindow we might create
When stopping the sink we should always hide the window. https://bugzilla.gnome.org/show_bug.cgi?id=755249
Diffstat (limited to 'ext/gtk')
-rw-r--r--ext/gtk/gstgtkbasesink.c28
-rw-r--r--ext/gtk/gstgtkbasesink.h2
-rw-r--r--ext/gtk/gstgtkglsink.c2
3 files changed, 24 insertions, 8 deletions
diff --git a/ext/gtk/gstgtkbasesink.c b/ext/gtk/gstgtkbasesink.c
index d0744a0c9..42f74261a 100644
--- a/ext/gtk/gstgtkbasesink.c
+++ b/ext/gtk/gstgtkbasesink.c
@@ -44,6 +44,7 @@ static void gst_gtk_base_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * param_spec);
static gboolean gst_gtk_base_sink_start (GstBaseSink * bsink);
+static gboolean gst_gtk_base_sink_stop (GstBaseSink * bsink);
static GstStateChangeReturn
gst_gtk_base_sink_change_state (GstElement * element,
@@ -121,6 +122,7 @@ gst_gtk_base_sink_class_init (GstGtkBaseSinkClass * klass)
gstbasesink_class->set_caps = gst_gtk_base_sink_set_caps;
gstbasesink_class->get_times = gst_gtk_base_sink_get_times;
gstbasesink_class->start = gst_gtk_base_sink_start;
+ gstbasesink_class->stop = gst_gtk_base_sink_stop;
gstvideosink_class->show_frame = gst_gtk_base_sink_show_frame;
}
@@ -279,18 +281,30 @@ gst_gtk_base_sink_start (GstBaseSink * bsink)
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (gst_sink->widget));
if (!gtk_widget_is_toplevel (toplevel)) {
- GtkWidget *window;
-
/* sanity check */
g_assert (klass->window_title);
/* User did not add widget its own UI, let's popup a new GtkWindow to
* make gst-launch-1.0 work. */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
- gtk_window_set_title (GTK_WINDOW (window), klass->window_title);
- gtk_container_add (GTK_CONTAINER (window), toplevel);
- gtk_widget_show_all (window);
+ gst_sink->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_default_size (GTK_WINDOW (gst_sink->window), 640, 480);
+ gtk_window_set_title (GTK_WINDOW (gst_sink->window), klass->window_title);
+ gtk_container_add (GTK_CONTAINER (gst_sink->window), toplevel);
+ gtk_widget_show_all (gst_sink->window);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+gst_gtk_base_sink_stop (GstBaseSink * bsink)
+{
+ GstGtkBaseSink *gst_sink = GST_GTK_BASE_SINK (bsink);
+
+ if (gst_sink->window) {
+ gtk_widget_destroy (gst_sink->window);
+ gst_sink->window = NULL;
+ gst_sink->widget = NULL;
}
return TRUE;
diff --git a/ext/gtk/gstgtkbasesink.h b/ext/gtk/gstgtkbasesink.h
index 6158d81ed..7260cd5a7 100644
--- a/ext/gtk/gstgtkbasesink.h
+++ b/ext/gtk/gstgtkbasesink.h
@@ -67,6 +67,8 @@ struct _GstGtkBaseSink
gboolean ignore_alpha;
GBinding *bind_ignore_alpha;
+
+ GtkWidget *window;
};
/**
diff --git a/ext/gtk/gstgtkglsink.c b/ext/gtk/gstgtkglsink.c
index d59880c53..ceba7bda1 100644
--- a/ext/gtk/gstgtkglsink.c
+++ b/ext/gtk/gstgtkglsink.c
@@ -212,7 +212,7 @@ gst_gtk_gl_sink_stop (GstBaseSink * bsink)
gtk_sink->gtk_context = NULL;
}
- return TRUE;
+ return GST_BASE_SINK_CLASS (parent_class)->stop (bsink);
}
static gboolean