Ensure that X11 symbols are only used when necessary
authorEmmanuele Bassi <ebassi@gnome.org>
Fri, 18 Nov 2016 11:03:36 +0000 (11:03 +0000)
committerMike Gorse <mgorse@suse.com>
Sat, 19 Nov 2016 09:11:06 +0000 (03:11 -0600)
Since at-spi2-core can be build with X11 support disabled, we need to
ensure that we include and build the X11-specific bits only when needed.

https://bugzilla.gnome.org/show_bug.cgi?id=773710

registryd/Makefile.am
registryd/deviceeventcontroller.c

index c9c9d39..1ea3fd0 100644 (file)
@@ -28,7 +28,7 @@ at_spi2_registryd_SOURCES =   \
        de-marshaller.h         \
        de-marshaller.c         \
        de-types.h              \
-       keymasks.h              \
+       keymasks.h              \
        paths.h                 \
        registry-main.c         \
        registry.c              \
@@ -38,15 +38,15 @@ at_spi2_registryd_SOURCES = \
        deviceeventcontroller.c \
        deviceeventcontroller.h \
        reentrant-list.c        \
-       reentrant-list.h        \
-       ucs2keysym.c
+       reentrant-list.h
 
 X11_SOURCES = \
        deviceeventcontroller-x11.c \
-       display.h               \
-       display.c               \
+       display.h \
+       display.c \
        event-source.c \
-       event-source.h
+       event-source.h \
+       ucs2keysym.c
 
 if USE_X11
 at_spi2_registryd_SOURCES += $(X11_SOURCES)
index 8fefbd7..0c965ef 100644 (file)
@@ -23,7 +23,7 @@
 
 /* deviceeventcontroller.c: implement the DeviceEventController interface */
 
-#include <config.h>
+#include "config.h"
 
 #undef  SPI_XKB_DEBUG
 #undef  SPI_DEBUG
 #include <dbus/dbus.h>
 
 #include "paths.h"
-#include "keymasks.h"
 #include "de-types.h"
 #include "de-marshaller.h"
+#include "keymasks.h"
+
+#ifdef HAVE_X11
 #include "display.h"
 #include "event-source.h"
+#endif
 
 #include "deviceeventcontroller.h"
 #include "reentrant-list.h"
@@ -64,6 +67,7 @@ struct _SpiPoint {
     gint y;
 };
 typedef struct _SpiPoint SpiPoint;
+
 static unsigned int mouse_mask_state = 0;
 static unsigned int key_modifier_mask =
   SPI_KEYMASK_MOD1 | SPI_KEYMASK_MOD2 | SPI_KEYMASK_MOD3 | SPI_KEYMASK_MOD4 |
@@ -634,7 +638,7 @@ handle_keygrab (SpiDEController         *controller,
   grab_mask.mod_mask = key_listener->mask;
   if (g_slist_length (key_listener->keys) == 0) /* special case means AnyKey/AllKeys */
     {
-      grab_mask.key_val = AnyKey;
+      grab_mask.key_val = 0L; /* AnyKey */
 #ifdef SPI_DEBUG
       fprintf (stderr, "AnyKey grab!");
 #endif
@@ -1751,7 +1755,7 @@ impl_generate_keyboard_event (DBusConnection *bus, DBusMessage *message, void *u
               * in our arg list; it can contain either
               * a keycode or a keysym.
               */
-             spi_dec_synth_keysym (controller, (KeySym) keycode);
+             spi_dec_synth_keysym (controller, keycode);
              break;
       case Accessibility_KEY_STRING:
              if (!spi_dec_plat_synth_keystring (controller, synth_type, keycode, keystring))