tests: fix deprecated API in colorkey and videooverlay

This commit is contained in:
Luis de Bethencourt 2015-04-02 11:33:12 +01:00
parent 1d9d60e0ea
commit 3a46270e23
2 changed files with 9 additions and 13 deletions

View file

@ -23,11 +23,6 @@
#include "config.h" #include "config.h"
#endif #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 <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -41,7 +36,7 @@
static GtkWidget *video_window = NULL; static GtkWidget *video_window = NULL;
static GstElement *sink = NULL; static GstElement *sink = NULL;
static gulong embed_xid = 0; static gulong embed_xid = 0;
static GdkColor trans_color; static GdkRGBA trans_color;
static gboolean trans_color_set = FALSE; static gboolean trans_color_set = FALSE;
static void static void
@ -62,7 +57,7 @@ redraw_overlay (GtkWidget * widget)
guint x, y; guint x, y;
guint h = allocation.height * 0.75; 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_rectangle (cr, 0, 0, allocation.width, h);
cairo_fill (cr); cairo_fill (cr);
@ -242,7 +237,6 @@ main (int argc, char **argv)
g_signal_connect (G_OBJECT (video_window), "draw", g_signal_connect (G_OBJECT (video_window), "draw",
G_CALLBACK (draw_cb), NULL); G_CALLBACK (draw_cb), NULL);
g_signal_connect (video_window, "realize", G_CALLBACK (realize_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); gtk_container_add (GTK_CONTAINER (window), video_window);
/* show the gui and play */ /* show the gui and play */

View file

@ -22,8 +22,8 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex /* Disable deprecation warnings because we need to use
* with newer GTK versions (>= 3.3.0) */ * gtk_widget_set_double_buffered () or display will flicker */
#define GDK_DISABLE_DEPRECATION_WARNINGS #define GDK_DISABLE_DEPRECATION_WARNINGS
#include <stdlib.h> #include <stdlib.h>
@ -97,15 +97,17 @@ static gboolean
handle_draw_cb (GtkWidget * widget, cairo_t * cr, gpointer user_data) handle_draw_cb (GtkWidget * widget, cairo_t * cr, gpointer user_data)
{ {
GstVideoRectangle *r = &anim_state.rect; GstVideoRectangle *r = &anim_state.rect;
GtkStyle *style; GtkStyleContext *style;
GdkRGBA color;
int width, height; int width, height;
width = gtk_widget_get_allocated_width (widget); width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (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! */ /* we should only redraw outside of the video rect! */
cairo_rectangle (cr, 0, 0, r->x, height); cairo_rectangle (cr, 0, 0, r->x, height);