tests: Don't use deprecated GTK API to fix the build with GTK+ 3.0

This commit is contained in:
Sebastian Dröge 2010-06-27 07:40:50 +02:00
parent d13a122a56
commit 44b9b422d8
2 changed files with 15 additions and 9 deletions

View file

@ -268,7 +268,7 @@ my_bus_sync_callback (GstBus * bus, GstMessage * message, gpointer data)
/* FIXME: make sure to get XID in main thread */
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (message->src),
GDK_WINDOW_XWINDOW (ui_drawing->window));
GDK_WINDOW_XWINDOW (gtk_widget_get_window (ui_drawing)));
gst_message_unref (message);
return GST_BUS_DROP;
@ -838,7 +838,7 @@ void
on_drawingareaView_realize (GtkWidget * widget, gpointer data)
{
#if GTK_CHECK_VERSION (2, 18, 0)
gdk_window_ensure_native (widget->window);
gdk_window_ensure_native (gtk_widget_get_window (widget));
#endif
}
@ -846,9 +846,11 @@ gboolean
on_drawingareaView_configure_event (GtkWidget * widget,
GdkEventConfigure * event, gpointer data)
{
gdk_window_move_resize (widget->window,
widget->allocation.x, widget->allocation.y,
widget->allocation.width, widget->allocation.height);
GtkAllocation a;
gtk_widget_get_allocation (widget, &a);
gdk_window_move_resize (gtk_widget_get_window (widget),
a.x, a.y, a.width, a.height);
gdk_display_sync (gtk_widget_get_display (widget));
return TRUE;

View file

@ -322,9 +322,11 @@ gboolean
on_drawingMain_expose_event (GtkWidget * widget, GdkEventExpose * event,
gpointer data)
{
GtkAllocation a = widget->allocation;
GtkAllocation a;
gint w, h, x, y;
gtk_widget_get_allocation (widget, &a);
if (draw_pixbuf == NULL)
return FALSE;
@ -341,7 +343,8 @@ on_drawingMain_expose_event (GtkWidget * widget, GdkEventExpose * event,
if (y < 0)
y = 0;
gdk_draw_pixbuf (GDK_DRAWABLE (widget->window), widget->style->black_gc,
gdk_draw_pixbuf (GDK_DRAWABLE (gtk_widget_get_window (widget)),
gtk_widget_get_style (widget)->black_gc,
draw_pixbuf, 0, 0, x, y, w, h, GDK_RGB_DITHER_NONE, 0, 0);
return TRUE; /* handled expose event */
@ -902,6 +905,7 @@ me_gst_bus_callback_view (GstBus * bus, GstMessage * message, gpointer data)
break;
case GST_MESSAGE_ELEMENT: {
const GValue *val;
GtkAllocation a;
/* only interested in element messages from our gdkpixbufsink */
if (message->src != GST_OBJECT_CAST (gst_video_sink))
@ -925,8 +929,8 @@ me_gst_bus_callback_view (GstBus * bus, GstMessage * message, gpointer data)
g_print ("Got image pixbuf: %dx%d\n", gdk_pixbuf_get_width (last_pixbuf),
gdk_pixbuf_get_height (last_pixbuf));
update_draw_pixbuf (GTK_WIDGET (ui_drawing)->allocation.width,
GTK_WIDGET (ui_drawing)->allocation.height);
gtk_widget_get_allocation (GTK_WIDGET (ui_drawing), &a);
update_draw_pixbuf (a.width, a.height);
gtk_widget_queue_draw (ui_drawing);
break;