[gtk+] x11: Make headers identical no matter if we run with or without XI2



commit de9a082ddbc9a0107ef677e9f18a01966d3aa10f
Author: Benjamin Otte <otte redhat com>
Date:   Sat Feb 12 01:27:40 2011 +0100

    x11: Make headers identical no matter if we run with or without XI2
    
    Previously we weren't installing the device headers when compiling
    without XINPUT support. But we would include them from gdkx.h, so
    essentially the build was broken.
    
    With this patch the types will exist but not do anything.

 gdk/x11/Makefile.am            |   30 ++++++++-------------------
 gdk/x11/gdkdevice-xi.c         |   25 +++++++++++++++++++++-
 gdk/x11/gdkdevice-xi2.c        |   24 ++++++++++++++++++++-
 gdk/x11/gdkdevicemanager-xi.c  |   34 +++++++++++++++++++++++++++----
 gdk/x11/gdkdevicemanager-xi2.c |   43 +++++++++++++++++++++++++++++++--------
 5 files changed, 117 insertions(+), 39 deletions(-)
---
diff --git a/gdk/x11/Makefile.am b/gdk/x11/Makefile.am
index c9421b8..6aea001 100644
--- a/gdk/x11/Makefile.am
+++ b/gdk/x11/Makefile.am
@@ -24,9 +24,13 @@ libgdk_x11_la_SOURCES = 	\
 	gdkasync.h		\
 	gdkcursor-x11.c		\
 	gdkdevice-core-x11.c	\
+	gdkdevice-xi.c		\
+	gdkdevice-xi2.c		\
 	gdkdeviceprivate-xi.h	\
 	gdkdevicemanager-core-x11.c \
 	gdkdevicemanager-x11.c	\
+	gdkdevicemanager-xi.c	\
+	gdkdevicemanager-xi2.c	\
 	gdkdevicemanagerprivate-core.h \
 	gdkdisplaymanager-x11.c	\
 	gdkdisplay-x11.c	\
@@ -56,34 +60,18 @@ libgdk_x11_la_SOURCES = 	\
 	xsettings-common.h	\
 	xsettings-common.c
 
-libgdkx11include_HEADERS =
-
-if XINPUT_XFREE
-libgdk_x11_la_SOURCES += 	\
-	gdkdevicemanager-xi.c	\
-	gdkdevice-xi.c
-libgdkx11include_HEADERS +=	\
-	gdkx11devicemanager-xi.h \
-	gdkx11device-xi.h
-if XINPUT_2
-libgdk_x11_la_SOURCES += 	\
-	gdkdevicemanager-xi2.c	\
-	gdkdevice-xi2.c
-libgdkx11include_HEADERS +=	\
-	gdkx11devicemanager-xi2.h \
-	gdkx11device-xi2.h
-endif
-endif
-
-
 libgdkinclude_HEADERS = 	\
 	gdkx.h
 
-libgdkx11include_HEADERS += 	\
+libgdkx11include_HEADERS = 	\
 	gdkx11applaunchcontext.h \
 	gdkx11cursor.h		\
 	gdkx11device-core.h	\
+	gdkx11device-xi.h	\
+	gdkx11device-xi2.h	\
 	gdkx11devicemanager-core.h \
+	gdkx11devicemanager-xi.h \
+	gdkx11devicemanager-xi2.h \
 	gdkx11display.h		\
 	gdkx11displaymanager.h	\
 	gdkx11dnd.h		\
diff --git a/gdk/x11/gdkdevice-xi.c b/gdk/x11/gdkdevice-xi.c
index 1d59761..ae0f727 100644
--- a/gdk/x11/gdkdevice-xi.c
+++ b/gdk/x11/gdkdevice-xi.c
@@ -20,13 +20,22 @@
 #include "config.h"
 
 #include "gdkx11device-xi.h"
+
 #include "gdkdeviceprivate-xi.h"
 
+#ifdef XINPUT_XFREE
+
 #include "gdkwindow.h"
 #include "gdkintl.h"
 #include "gdkprivate-x11.h"
 #include "gdkasync.h"
 
+#endif
+
+G_DEFINE_TYPE (GdkX11DeviceXI, gdk_x11_device_xi, GDK_TYPE_DEVICE)
+
+#ifdef XINPUT_XFREE
+
 #define MAX_DEVICE_CLASSES 13
 
 static GQuark quark_window_input_info = 0;
@@ -97,8 +106,6 @@ static void gdk_x11_device_xi_select_window_events (GdkDevice    *device,
                                                     GdkEventMask  mask);
 
 
-G_DEFINE_TYPE (GdkX11DeviceXI, gdk_x11_device_xi, GDK_TYPE_DEVICE)
-
 enum {
   PROP_0,
   PROP_DEVICE_ID
@@ -639,3 +646,17 @@ _gdk_x11_device_xi_translate_axes (GdkDevice *device,
   if (y)
     *y = temp_y;
 }
+
+#else /* XINPUT_XFREE */
+
+static void
+gdk_x11_device_xi_class_init (GdkX11DeviceXIClass *klass)
+{
+}
+
+static void
+gdk_x11_device_xi_init (GdkX11DeviceXI *device)
+{
+}
+
+#endif /* XINPUT_XFREE */
diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c
index 4b71810..7622fec 100644
--- a/gdk/x11/gdkdevice-xi2.c
+++ b/gdk/x11/gdkdevice-xi2.c
@@ -26,11 +26,15 @@
 #include "gdkasync.h"
 #include "gdkprivate-x11.h"
 
+#ifdef XINPUT_2
+
 #include <stdlib.h>
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/extensions/XInput2.h>
 
+#endif
+
 struct _GdkX11DeviceXI2
 {
   GdkDevice parent_instance;
@@ -43,6 +47,10 @@ struct _GdkX11DeviceXI2Class
   GdkDeviceClass parent_class;
 };
 
+G_DEFINE_TYPE (GdkX11DeviceXI2, gdk_x11_device_xi2, GDK_TYPE_DEVICE)
+
+#ifdef XINPUT_2
+
 static void gdk_x11_device_xi2_get_property (GObject      *object,
                                              guint         prop_id,
                                              GValue       *value,
@@ -93,8 +101,6 @@ static void  gdk_x11_device_xi2_select_window_events (GdkDevice    *device,
                                                       GdkEventMask  event_mask);
 
 
-G_DEFINE_TYPE (GdkX11DeviceXI2, gdk_x11_device_xi2, GDK_TYPE_DEVICE)
-
 enum {
   PROP_0,
   PROP_DEVICE_ID
@@ -742,3 +748,17 @@ _gdk_x11_device_xi2_translate_state (XIModifierState *mods_state,
 
   return state;
 }
+
+#else /* XINPUT_XI2 */
+
+static void
+gdk_x11_device_xi2_class_init (GdkX11DeviceXI2Class *klass)
+{
+}
+
+static void
+gdk_x11_device_xi2_init (GdkX11DeviceXI2 *device)
+{
+}
+
+#endif /* XINPUT_XI2 */
diff --git a/gdk/x11/gdkdevicemanager-xi.c b/gdk/x11/gdkdevicemanager-xi.c
index 5bd479b..a0ba467 100644
--- a/gdk/x11/gdkdevicemanager-xi.c
+++ b/gdk/x11/gdkdevicemanager-xi.c
@@ -28,8 +28,11 @@
 #include "gdkintl.h"
 #include "gdkprivate-x11.h"
 
+#ifdef XINPUT_XFREE
+
 #include <X11/extensions/XInput.h>
 
+#endif /* XINPUT_XFREE */
 
 struct _GdkX11DeviceManagerXI
 {
@@ -46,6 +49,13 @@ struct _GdkX11DeviceManagerXIClass
   GdkX11DeviceManagerCoreClass parent_class;
 };
 
+static void     gdk_x11_device_manager_xi_event_translator_init  (GdkEventTranslatorIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerXI, gdk_x11_device_manager_xi, GDK_TYPE_X11_DEVICE_MANAGER_CORE,
+                         G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR,
+                                                gdk_x11_device_manager_xi_event_translator_init))
+
+#ifdef XINPUT_XFREE
 
 static void gdk_x11_device_manager_xi_constructed  (GObject      *object);
 static void gdk_x11_device_manager_xi_dispose      (GObject      *object);
@@ -58,7 +68,6 @@ static void gdk_x11_device_manager_xi_get_property (GObject      *object,
                                                     GValue       *value,
                                                     GParamSpec   *pspec);
 
-static void     gdk_x11_device_manager_xi_event_translator_init  (GdkEventTranslatorIface *iface);
 static gboolean gdk_x11_device_manager_xi_translate_event (GdkEventTranslator *translator,
                                                            GdkDisplay         *display,
                                                            GdkEvent           *event,
@@ -67,10 +76,6 @@ static GList *  gdk_x11_device_manager_xi_list_devices    (GdkDeviceManager  *de
                                                            GdkDeviceType      type);
 
 
-G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerXI, gdk_x11_device_manager_xi, GDK_TYPE_X11_DEVICE_MANAGER_CORE,
-                         G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR,
-                                                gdk_x11_device_manager_xi_event_translator_init))
-
 enum {
   PROP_0,
   PROP_EVENT_BASE
@@ -661,3 +666,22 @@ gdk_x11_device_manager_xi_list_devices (GdkDeviceManager *manager,
   else
     return NULL;
 }
+
+#else /* XINPUT_XFREE */
+
+static void
+gdk_x11_device_manager_xi_class_init (GdkX11DeviceManagerXIClass *klass)
+{
+}
+
+static void
+gdk_x11_device_manager_xi_init (GdkX11DeviceManagerXI *device_manager)
+{
+}
+
+static void
+gdk_x11_device_manager_xi_event_translator_init (GdkEventTranslatorIface *iface)
+{
+}
+
+#endif /* XINPUT_XFREE */
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index fa0980c..40b989b 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -22,7 +22,7 @@
 #include "gdkx11devicemanager-xi2.h"
 #include "gdkx11device-xi2.h"
 
-#include "gdkdevicemanagerprivate.h"
+#include "gdkdevicemanagerprivate-core.h"
 #include "gdkdeviceprivate.h"
 #include "gdkdisplayprivate.h"
 #include "gdkeventtranslator.h"
@@ -30,15 +30,19 @@
 #include "gdkintl.h"
 #include "gdkkeysyms.h"
 
+#ifdef XINPUT_XI2
+
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/extensions/XInput2.h>
 
 #include <string.h>
 
+#endif /* XINPUT_XI2 */
+
 struct _GdkX11DeviceManagerXI2
 {
-  GdkX11DeviceManager parent_object;
+  GdkX11DeviceManagerCore parent_object;
 
   GHashTable *id_table;
 
@@ -52,6 +56,15 @@ struct _GdkX11DeviceManagerXI2Class
   GdkDeviceManagerClass parent_class;
 };
 
+static void     gdk_x11_device_manager_xi2_event_translator_init (GdkEventTranslatorIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerXI2, gdk_x11_device_manager_xi2, GDK_TYPE_X11_DEVICE_MANAGER_CORE,
+                         G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR,
+                                                gdk_x11_device_manager_xi2_event_translator_init))
+
+
+#ifdef XINPUT_XI2
+
 #define HAS_FOCUS(toplevel) ((toplevel)->has_focus || (toplevel)->has_pointer_focus)
 
 
@@ -70,8 +83,6 @@ static GList * gdk_x11_device_manager_xi2_list_devices (GdkDeviceManager *device
                                                         GdkDeviceType     type);
 static GdkDevice * gdk_x11_device_manager_xi2_get_client_pointer (GdkDeviceManager *device_manager);
 
-static void     gdk_x11_device_manager_xi2_event_translator_init (GdkEventTranslatorIface *iface);
-
 static gboolean gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
                                                             GdkDisplay         *display,
                                                             GdkEvent           *event,
@@ -82,11 +93,6 @@ static void         gdk_x11_device_manager_xi2_select_window_events (GdkEventTra
                                                                      GdkEventMask        event_mask);
 
 
-G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerXI2, gdk_x11_device_manager_xi2, GDK_TYPE_X11_DEVICE_MANAGER_CORE,
-                         G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR,
-                                                gdk_x11_device_manager_xi2_event_translator_init))
-
-
 enum {
   PROP_0,
   PROP_OPCODE
@@ -1301,3 +1307,22 @@ gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator,
   _gdk_x11_device_manager_xi2_select_events (device_manager, window, &event_mask);
   g_free (event_mask.mask);
 }
+
+#else /* XINPUT_XI2 */
+
+static void
+gdk_x11_device_manager_xi2_class_init (GdkX11DeviceManagerXI2Class *klass)
+{
+}
+
+static void
+gdk_x11_device_manager_xi2_init (GdkX11DeviceManagerXI2 *device_manager)
+{
+}
+
+static void
+gdk_x11_device_manager_xi2_event_translator_init (GdkEventTranslatorIface *iface)
+{
+}
+
+#endif /* XINPUT_XI2 */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]