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.
This commit is contained in:
Benjamin Otte
2011-02-12 01:27:40 +01:00
parent 30abd4d8b5
commit de9a082ddb
5 changed files with 117 additions and 39 deletions

View File

@ -24,9 +24,13 @@ libgdk_x11_la_SOURCES = \
gdkasync.h \ gdkasync.h \
gdkcursor-x11.c \ gdkcursor-x11.c \
gdkdevice-core-x11.c \ gdkdevice-core-x11.c \
gdkdevice-xi.c \
gdkdevice-xi2.c \
gdkdeviceprivate-xi.h \ gdkdeviceprivate-xi.h \
gdkdevicemanager-core-x11.c \ gdkdevicemanager-core-x11.c \
gdkdevicemanager-x11.c \ gdkdevicemanager-x11.c \
gdkdevicemanager-xi.c \
gdkdevicemanager-xi2.c \
gdkdevicemanagerprivate-core.h \ gdkdevicemanagerprivate-core.h \
gdkdisplaymanager-x11.c \ gdkdisplaymanager-x11.c \
gdkdisplay-x11.c \ gdkdisplay-x11.c \
@ -56,34 +60,18 @@ libgdk_x11_la_SOURCES = \
xsettings-common.h \ xsettings-common.h \
xsettings-common.c 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 = \ libgdkinclude_HEADERS = \
gdkx.h gdkx.h
libgdkx11include_HEADERS += \ libgdkx11include_HEADERS = \
gdkx11applaunchcontext.h \ gdkx11applaunchcontext.h \
gdkx11cursor.h \ gdkx11cursor.h \
gdkx11device-core.h \ gdkx11device-core.h \
gdkx11device-xi.h \
gdkx11device-xi2.h \
gdkx11devicemanager-core.h \ gdkx11devicemanager-core.h \
gdkx11devicemanager-xi.h \
gdkx11devicemanager-xi2.h \
gdkx11display.h \ gdkx11display.h \
gdkx11displaymanager.h \ gdkx11displaymanager.h \
gdkx11dnd.h \ gdkx11dnd.h \

View File

@ -20,13 +20,22 @@
#include "config.h" #include "config.h"
#include "gdkx11device-xi.h" #include "gdkx11device-xi.h"
#include "gdkdeviceprivate-xi.h" #include "gdkdeviceprivate-xi.h"
#ifdef XINPUT_XFREE
#include "gdkwindow.h" #include "gdkwindow.h"
#include "gdkintl.h" #include "gdkintl.h"
#include "gdkprivate-x11.h" #include "gdkprivate-x11.h"
#include "gdkasync.h" #include "gdkasync.h"
#endif
G_DEFINE_TYPE (GdkX11DeviceXI, gdk_x11_device_xi, GDK_TYPE_DEVICE)
#ifdef XINPUT_XFREE
#define MAX_DEVICE_CLASSES 13 #define MAX_DEVICE_CLASSES 13
static GQuark quark_window_input_info = 0; static GQuark quark_window_input_info = 0;
@ -97,8 +106,6 @@ static void gdk_x11_device_xi_select_window_events (GdkDevice *device,
GdkEventMask mask); GdkEventMask mask);
G_DEFINE_TYPE (GdkX11DeviceXI, gdk_x11_device_xi, GDK_TYPE_DEVICE)
enum { enum {
PROP_0, PROP_0,
PROP_DEVICE_ID PROP_DEVICE_ID
@ -639,3 +646,17 @@ _gdk_x11_device_xi_translate_axes (GdkDevice *device,
if (y) if (y)
*y = temp_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 */

View File

@ -26,11 +26,15 @@
#include "gdkasync.h" #include "gdkasync.h"
#include "gdkprivate-x11.h" #include "gdkprivate-x11.h"
#ifdef XINPUT_2
#include <stdlib.h> #include <stdlib.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/extensions/XInput2.h> #include <X11/extensions/XInput2.h>
#endif
struct _GdkX11DeviceXI2 struct _GdkX11DeviceXI2
{ {
GdkDevice parent_instance; GdkDevice parent_instance;
@ -43,6 +47,10 @@ struct _GdkX11DeviceXI2Class
GdkDeviceClass parent_class; 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, static void gdk_x11_device_xi2_get_property (GObject *object,
guint prop_id, guint prop_id,
GValue *value, GValue *value,
@ -93,8 +101,6 @@ static void gdk_x11_device_xi2_select_window_events (GdkDevice *device,
GdkEventMask event_mask); GdkEventMask event_mask);
G_DEFINE_TYPE (GdkX11DeviceXI2, gdk_x11_device_xi2, GDK_TYPE_DEVICE)
enum { enum {
PROP_0, PROP_0,
PROP_DEVICE_ID PROP_DEVICE_ID
@ -742,3 +748,17 @@ _gdk_x11_device_xi2_translate_state (XIModifierState *mods_state,
return 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 */

View File

@ -28,8 +28,11 @@
#include "gdkintl.h" #include "gdkintl.h"
#include "gdkprivate-x11.h" #include "gdkprivate-x11.h"
#ifdef XINPUT_XFREE
#include <X11/extensions/XInput.h> #include <X11/extensions/XInput.h>
#endif /* XINPUT_XFREE */
struct _GdkX11DeviceManagerXI struct _GdkX11DeviceManagerXI
{ {
@ -46,6 +49,13 @@ struct _GdkX11DeviceManagerXIClass
GdkX11DeviceManagerCoreClass parent_class; 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_constructed (GObject *object);
static void gdk_x11_device_manager_xi_dispose (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, GValue *value,
GParamSpec *pspec); 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, static gboolean gdk_x11_device_manager_xi_translate_event (GdkEventTranslator *translator,
GdkDisplay *display, GdkDisplay *display,
GdkEvent *event, GdkEvent *event,
@ -67,10 +76,6 @@ static GList * gdk_x11_device_manager_xi_list_devices (GdkDeviceManager *de
GdkDeviceType type); 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 { enum {
PROP_0, PROP_0,
PROP_EVENT_BASE PROP_EVENT_BASE
@ -661,3 +666,22 @@ gdk_x11_device_manager_xi_list_devices (GdkDeviceManager *manager,
else else
return NULL; 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 */

View File

@ -22,7 +22,7 @@
#include "gdkx11devicemanager-xi2.h" #include "gdkx11devicemanager-xi2.h"
#include "gdkx11device-xi2.h" #include "gdkx11device-xi2.h"
#include "gdkdevicemanagerprivate.h" #include "gdkdevicemanagerprivate-core.h"
#include "gdkdeviceprivate.h" #include "gdkdeviceprivate.h"
#include "gdkdisplayprivate.h" #include "gdkdisplayprivate.h"
#include "gdkeventtranslator.h" #include "gdkeventtranslator.h"
@ -30,15 +30,19 @@
#include "gdkintl.h" #include "gdkintl.h"
#include "gdkkeysyms.h" #include "gdkkeysyms.h"
#ifdef XINPUT_XI2
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/extensions/XInput2.h> #include <X11/extensions/XInput2.h>
#include <string.h> #include <string.h>
#endif /* XINPUT_XI2 */
struct _GdkX11DeviceManagerXI2 struct _GdkX11DeviceManagerXI2
{ {
GdkX11DeviceManager parent_object; GdkX11DeviceManagerCore parent_object;
GHashTable *id_table; GHashTable *id_table;
@ -52,6 +56,15 @@ struct _GdkX11DeviceManagerXI2Class
GdkDeviceManagerClass parent_class; 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) #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); GdkDeviceType type);
static GdkDevice * gdk_x11_device_manager_xi2_get_client_pointer (GdkDeviceManager *device_manager); 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, static gboolean gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
GdkDisplay *display, GdkDisplay *display,
GdkEvent *event, GdkEvent *event,
@ -82,11 +93,6 @@ static void gdk_x11_device_manager_xi2_select_window_events (GdkEventTra
GdkEventMask event_mask); 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 { enum {
PROP_0, PROP_0,
PROP_OPCODE 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); _gdk_x11_device_manager_xi2_select_events (device_manager, window, &event_mask);
g_free (event_mask.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 */