From 3a46270e235e40d0ce016fa1ea65607426790c3f Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Thu, 2 Apr 2015 11:33:12 +0100 Subject: [PATCH] tests: fix deprecated API in colorkey and videooverlay --- tests/icles/test-colorkey.c | 10 ++-------- tests/icles/test-videooverlay.c | 12 +++++++----- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/tests/icles/test-colorkey.c b/tests/icles/test-colorkey.c index 2e6c782ce6..62b041dcfd 100644 --- a/tests/icles/test-colorkey.c +++ b/tests/icles/test-colorkey.c @@ -23,11 +23,6 @@ #include "config.h" #endif -/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex - * with newer GTK versions (>= 3.3.0) */ -#define GLIB_DISABLE_DEPRECATION_WARNINGS -#define GDK_DISABLE_DEPRECATION_WARNINGS - #include #include @@ -41,7 +36,7 @@ static GtkWidget *video_window = NULL; static GstElement *sink = NULL; static gulong embed_xid = 0; -static GdkColor trans_color; +static GdkRGBA trans_color; static gboolean trans_color_set = FALSE; static void @@ -62,7 +57,7 @@ redraw_overlay (GtkWidget * widget) guint x, y; guint h = allocation.height * 0.75; - gdk_cairo_set_source_color (cr, &trans_color); + gdk_cairo_set_source_rgba (cr, &trans_color); cairo_rectangle (cr, 0, 0, allocation.width, h); cairo_fill (cr); @@ -242,7 +237,6 @@ main (int argc, char **argv) g_signal_connect (G_OBJECT (video_window), "draw", G_CALLBACK (draw_cb), NULL); g_signal_connect (video_window, "realize", G_CALLBACK (realize_cb), NULL); - gtk_widget_set_double_buffered (video_window, FALSE); gtk_container_add (GTK_CONTAINER (window), video_window); /* show the gui and play */ diff --git a/tests/icles/test-videooverlay.c b/tests/icles/test-videooverlay.c index 191c30d209..2cd59ee6b1 100644 --- a/tests/icles/test-videooverlay.c +++ b/tests/icles/test-videooverlay.c @@ -22,8 +22,8 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex - * with newer GTK versions (>= 3.3.0) */ +/* Disable deprecation warnings because we need to use + * gtk_widget_set_double_buffered () or display will flicker */ #define GDK_DISABLE_DEPRECATION_WARNINGS #include @@ -97,15 +97,17 @@ static gboolean handle_draw_cb (GtkWidget * widget, cairo_t * cr, gpointer user_data) { GstVideoRectangle *r = &anim_state.rect; - GtkStyle *style; + GtkStyleContext *style; + GdkRGBA color; int width, height; width = gtk_widget_get_allocated_width (widget); height = gtk_widget_get_allocated_height (widget); - style = gtk_widget_get_style (widget); + style = gtk_widget_get_style_context (widget); - gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]); + gtk_style_context_get_color (style, 0, &color); + gdk_cairo_set_source_rgba (cr, &color); /* we should only redraw outside of the video rect! */ cairo_rectangle (cr, 0, 0, r->x, height);