/pidgin/main: e7741c77c5b2: Add support for multiple GDK backends.

Elliott Sales de Andrade qulogic at pidgin.im
Mon Nov 5 21:35:01 EST 2012


Changeset: e7741c77c5b2378ce68a480874eaff7e550a9a45
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2012-11-05 21:33 -0500
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/e7741c77c5b2

Description:

Add support for multiple GDK backends.

diffstat:

 pidgin/gtkmedia.c |  38 ++++++++++++++++++++++++++------------
 pidgin/gtkprefs.c |  38 ++++++++++++++++++++++++++++----------
 2 files changed, 54 insertions(+), 22 deletions(-)

diffs (114 lines):

diff --git a/pidgin/gtkmedia.c b/pidgin/gtkmedia.c
--- a/pidgin/gtkmedia.c
+++ b/pidgin/gtkmedia.c
@@ -38,11 +38,13 @@
 #ifdef USE_VV
 #include "media-gst.h"
 
-#ifdef _WIN32
+#ifdef GDK_WINDOWING_WIN32
 #include <gdk/gdkwin32.h>
-#elif defined(GDK_WINDOWING_X11)
+#endif
+#ifdef GDK_WINDOWING_X11
 #include <gdk/gdkx.h>
-#elif defined(GDK_WINDOWING_QUARTZ)
+#endif
+#ifdef GDK_WINDOWING_QUARTZ
 #include <gdk/gdkquartz.h>
 #endif
 
@@ -551,15 +553,27 @@ realize_cb_cb(PidginMediaRealizeData *da
 	}
 
 	if (window) {
-		gulong window_id;
-#ifdef _WIN32
-		window_id = GDK_WINDOW_HWND(window);
-#elif defined(HAVE_X11)
-		window_id = gdk_x11_window_get_xid(window);
-#elif defined(GDK_WINDOWING_QUARTZ)
-		window_id = (gulong) gdk_quartz_window_get_nsview(window);
-#else
-#		error "Unsupported windowing system"
+		gulong window_id = 0;
+#ifdef GDK_WINDOWING_WIN32
+		if (GDK_IS_WIN32_WINDOW(window))
+			window_id = GDK_WINDOW_HWND(window);
+		else
+#endif
+#ifdef GDK_WINDOWING_X11
+		if (GDK_IS_X11_WINDOW(window))
+			window_id = gdk_x11_window_get_xid(window);
+		else
+#endif
+#ifdef GDK_WINDOWING_QUARTZ
+		if (GDK_IS_QUARTZ_WINDOW(window))
+			window_id = (gulong)gdk_quartz_window_get_nsview(window);
+		else
+#endif
+			g_warning("Unsupported GDK backend");
+#if !(defined(GDK_WINDOWING_WIN32) \
+   || defined(GDK_WINDOWING_X11) \
+   || defined(GDK_WINDOWING_QUARTZ))
+#		error "Unsupported GDK windowing system"
 #endif
 
 		purple_media_set_output_window(priv->media, data->session_id,
diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c
--- a/pidgin/gtkprefs.c
+++ b/pidgin/gtkprefs.c
@@ -66,9 +66,15 @@
 #include <gst/interfaces/xoverlay.h>
 #include <gst/interfaces/propertyprobe.h>
 #endif
-#ifdef HAVE_X11
+#ifdef GDK_WINDOWING_WIN32
+#include <gdk/gdkwin32.h>
+#endif
+#ifdef GDK_WINDOWING_X11
 #include <gdk/gdkx.h>
 #endif
+#ifdef GDK_WINDOWING_QUARTZ
+#include <gdk/gdkquartz.h>
+#endif
 #endif
 
 #include "gtk3compat.h"
@@ -3512,15 +3518,27 @@ toggle_video_test_cb(GtkToggleButton *te
 
 	if (gtk_toggle_button_get_active(test)) {
 		GdkWindow *window = gtk_widget_get_window(video);
-		gulong window_id;
-#ifdef _WIN32
-		window_id = GDK_WINDOW_HWND(window);
-#elif defined(HAVE_X11)
-		window_id = gdk_x11_window_get_xid(window);
-#elif defined(GDK_WINDOWING_QUARTZ)
-		window_id = (gulong)gdk_quartz_window_get_nsview(window);
-#else
-#		error "Unsupported windowing system"
+		gulong window_id = 0;
+#ifdef GDK_WINDOWING_WIN32
+		if (GDK_IS_WIN32_WINDOW(window))
+			window_id = GDK_WINDOW_HWND(window);
+		else
+#endif
+#ifdef GDK_WINDOWING_X11
+		if (GDK_IS_X11_WINDOW(window))
+			window_id = gdk_x11_window_get_xid(window);
+		else
+#endif
+#ifdef GDK_WINDOWING_QUARTZ
+		if (GDK_IS_QUARTZ_WINDOW(window))
+			window_id = (gulong)gdk_quartz_window_get_nsview(window);
+		else
+#endif
+			g_warning("Unsupported GDK backend");
+#if !(defined(GDK_WINDOWING_WIN32) \
+   || defined(GDK_WINDOWING_X11) \
+   || defined(GDK_WINDOWING_QUARTZ))
+#		error "Unsupported GDK windowing system"
 #endif
 
 		video_pipeline = create_video_pipeline();



More information about the Commits mailing list