gtk: Add a way to queue redrawing the base GTK widget

This will be used to request a redraw of the GTK widget should the
display be changed using properties not directly handled by the base GTK
widget, but by one of its descendants.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1710>
This commit is contained in:
Bastien Nocera 2022-02-01 14:26:02 +01:00 committed by GStreamer Marge Bot
parent 23adc61ac7
commit 30f85ca806
2 changed files with 17 additions and 0 deletions

View file

@ -593,3 +593,19 @@ gtk_gst_base_widget_set_buffer (GtkGstBaseWidget * widget, GstBuffer * buffer)
GTK_GST_BASE_WIDGET_UNLOCK (widget); GTK_GST_BASE_WIDGET_UNLOCK (widget);
} }
void
gtk_gst_base_widget_queue_draw (GtkGstBaseWidget * widget)
{
/* As we have no type, this is better then no check */
g_return_if_fail (GTK_IS_WIDGET (widget));
GTK_GST_BASE_WIDGET_LOCK (widget);
if (!widget->draw_id) {
widget->draw_id = g_idle_add_full (G_PRIORITY_DEFAULT,
(GSourceFunc) _queue_draw, widget, NULL);
}
GTK_GST_BASE_WIDGET_UNLOCK (widget);
}

View file

@ -91,6 +91,7 @@ void gtk_gst_base_widget_finalize (GObject * object);
/* API */ /* API */
gboolean gtk_gst_base_widget_set_format (GtkGstBaseWidget * widget, GstVideoInfo * v_info); gboolean gtk_gst_base_widget_set_format (GtkGstBaseWidget * widget, GstVideoInfo * v_info);
void gtk_gst_base_widget_set_buffer (GtkGstBaseWidget * widget, GstBuffer * buffer); void gtk_gst_base_widget_set_buffer (GtkGstBaseWidget * widget, GstBuffer * buffer);
void gtk_gst_base_widget_queue_draw (GtkGstBaseWidget * widget);
void gtk_gst_base_widget_set_element (GtkGstBaseWidget * widget, GstElement * element); void gtk_gst_base_widget_set_element (GtkGstBaseWidget * widget, GstElement * element);
void gtk_gst_base_widget_display_size_to_stream_size (GtkGstBaseWidget * base_widget, void gtk_gst_base_widget_display_size_to_stream_size (GtkGstBaseWidget * base_widget,
gdouble x, gdouble y, gdouble x, gdouble y,