[virt-tools-list] [virt-viewer 1/2] Fix compilation with older gtk+

Christophe Fergeau cfergeau at redhat.com
Wed Mar 20 14:42:26 UTC 2013


gtk_widget_get_mapped is only available in gtk+ 2.28, so we need
a compat definition for older releases.
---
 src/virt-gtk-compat.h     | 5 +++++
 src/virt-viewer-display.c | 1 +
 2 files changed, 6 insertions(+)

diff --git a/src/virt-gtk-compat.h b/src/virt-gtk-compat.h
index 7467781..7b10b08 100644
--- a/src/virt-gtk-compat.h
+++ b/src/virt-gtk-compat.h
@@ -24,10 +24,15 @@
 #ifndef _VIRT_GTK_COMPAT
 # define _VIRT_GTK_COMPAT
 
+#include <gtk/gtk.h>
 #include <gdk/gdk.h>
 
 G_BEGIN_DECLS
 
+#if !GTK_CHECK_VERSION(2, 20, 0)
+#define gtk_widget_get_mapped(w) GTK_WIDGET_MAPPED(w)
+#endif
+
 #if GTK_CHECK_VERSION(3, 0, 0)
 #define GDK_Control_L GDK_KEY_Control_L
 #define GDK_Alt_L GDK_KEY_Alt_L
diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index ba4ac03..5ac66b9 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -27,6 +27,7 @@
 #include <locale.h>
 #include <math.h>
 
+#include "virt-gtk-compat.h"
 #include "virt-viewer-session.h"
 #include "virt-viewer-display.h"
 #include "virt-viewer-util.h"
-- 
1.8.1.4




More information about the virt-tools-list mailing list