[328/906] Convert gtk examples to use helper library

Helper lib implements gst-gtk glue on all platforms
This commit is contained in:
David Schleef 2009-04-12 20:03:30 -07:00 committed by Matthew Waters
parent bf0b1fa1ab
commit d164f882be
3 changed files with 37 additions and 23 deletions

View file

@ -3,11 +3,7 @@
#include <gdk/gdk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#ifdef WIN32
#include <gdk/gdkwin32.h>
#else
#include <gdk/gdkx.h>
#endif
#include "../gstgtk.h"
#include <gst/interfaces/xoverlay.h>
@ -19,12 +15,8 @@ expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
GstXOverlay *overlay =
GST_X_OVERLAY (gst_bin_get_by_interface (GST_BIN (data),
GST_TYPE_X_OVERLAY));
#ifdef WIN32
gst_x_overlay_set_xwindow_id (overlay,
(gulong) GDK_WINDOW_HWND (widget->window));
#else
gst_x_overlay_set_xwindow_id (overlay, GDK_WINDOW_XWINDOW (widget->window));
#endif
gst_x_overlay_set_gtk_window (overlay, widget);
return FALSE;
}

View file

@ -3,11 +3,7 @@
#include <gdk/gdk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#ifdef WIN32
#include <gdk/gdkwin32.h>
#else
#include <gdk/gdkx.h>
#endif
#include "../gstgtk.h"
#include <gst/interfaces/xoverlay.h>
@ -33,13 +29,7 @@ create_window (GstBus * bus, GstMessage * message, GtkWidget * widget)
if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
return GST_BUS_PASS;
#ifdef WIN32
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
(gulong) GDK_WINDOW_HWND (widget->window));
#else
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
GDK_WINDOW_XWINDOW (widget->window));
#endif
gst_x_overlay_set_gtk_window (GST_X_OVERLAY (GST_MESSAGE_SRC (message)), widget);
gst_message_unref (message);

View file

@ -0,0 +1,32 @@
#include "gstgtk.h"
#if defined(GDK_WINDOWING_WIN32)
#include <gdk/gdkwin32.h>
#elif defined(GDK_WINDOWING_X11)
#include <gdk/gdkx.h>
#elif defined(GDK_WINDOWING_QUARTZ)
#include <gdk/gdkquartz.h>
#else
#error unimplemented GTK backend
#endif
void
gst_x_overlay_set_gtk_window (GstXOverlay *xoverlay, GtkWidget *window)
{
#if defined(GDK_WINDOWING_WIN32)
gst_x_overlay_set_xwindow_id (xoverlay, (gulong)GDK_WINDOW_HWND(window->window));
#elif defined(GDK_WINDOWING_QUARTZ)
gst_x_overlay_set_xwindow_id (xoverlay,
(gulong)gdk_quartz_window_get_nswindow (window->window));
#elif defined(GDK_WINDOWING_X11)
gst_x_overlay_set_xwindow_id (xoverlay, GDK_WINDOW_XWINDOW(window->window));
#else
#error unimplemented GTK backend
#endif
}