From: Rob Bradford <r...@linux.intel.com>

---
 configure.ac     |  9 ++++++++-
 src/compositor.c |  6 +++++-
 src/input.c      | 20 +++++++++++++++++++-
 3 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index b625221..5e5e7bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,7 +54,7 @@ AC_CHECK_HEADERS([execinfo.h])
 
 AC_CHECK_FUNCS([mkostemp strchrnul])
 
-COMPOSITOR_MODULES="wayland-server >= 1.1.90 xkbcommon pixman-1"
+COMPOSITOR_MODULES="wayland-server >= 1.1.90 pixman-1"
 
 AC_ARG_ENABLE(egl, [  --disable-egl],,
               enable_egl=yes)
@@ -64,6 +64,13 @@ if test x$enable_egl = xyes; then
        COMPOSITOR_MODULES="$COMPOSITOR_MODULES egl >= 7.10 glesv2"
 fi
 
+AC_ARG_ENABLE(xkbcommon, [  --disable-xkbcommon],,
+              enable_xkbcommon=yes)
+if test x$enable_xkbcommon = xyes; then
+       AC_DEFINE(ENABLE_XKBCOMMON, [1], [Build Weston with libxkbcommon 
support])
+       COMPOSITOR_MODULES="$COMPOSITOR_MODULES xkbcommon"
+fi
+
 PKG_CHECK_MODULES(COMPOSITOR, [$COMPOSITOR_MODULES])
 
 AC_ARG_ENABLE(setuid-install, [  --enable-setuid-install],,
diff --git a/src/compositor.c b/src/compositor.c
index fc407dd..6657c7a 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2811,7 +2811,6 @@ weston_compositor_init(struct weston_compositor *ec,
        weston_plane_init(&ec->primary_plane, 0, 0);
        weston_compositor_stack_plane(ec, &ec->primary_plane, NULL);
 
-       ec->use_xkbcommon = 1;
        s = weston_config_get_section(ec->config, "keyboard", NULL, NULL);
        weston_config_section_get_string(s, "keymap_rules",
                                         (char **) &xkb_names.rules, NULL);
@@ -2823,8 +2822,11 @@ weston_compositor_init(struct weston_compositor *ec,
                                         (char **) &xkb_names.variant, NULL);
        weston_config_section_get_string(s, "keymap_options",
                                         (char **) &xkb_names.options, NULL);
+#ifdef ENABLE_XKBCOMMON
+       ec->use_xkbcommon = 1;
        if (weston_compositor_xkb_init(ec, &xkb_names) < 0)
                return -1;
+#endif
 
        ec->ping_handler = NULL;
 
@@ -3330,7 +3332,9 @@ int main(int argc, char *argv[])
        for (i = ARRAY_LENGTH(signals); i;)
                wl_event_source_remove(signals[--i]);
 
+#ifdef ENABLE_XKBCOMMON
        weston_compositor_xkb_destroy(ec);
+#endif
 
        ec->destroy(ec);
        wl_display_destroy(display);
diff --git a/src/input.c b/src/input.c
index 8ffbd10..4816f4b 100644
--- a/src/input.c
+++ b/src/input.c
@@ -741,6 +741,7 @@ notify_axis(struct weston_seat *seat, uint32_t time, 
uint32_t axis,
                                     value);
 }
 
+#ifdef ENABLE_XKBCOMMON
 WL_EXPORT void
 notify_modifiers(struct weston_seat *seat, uint32_t serial)
 {
@@ -830,6 +831,18 @@ update_modifier_state(struct weston_seat *seat, uint32_t 
serial, uint32_t key,
 
        notify_modifiers(seat, serial);
 }
+#else
+WL_EXPORT void
+notify_modifiers(struct weston_seat *seat, uint32_t serial)
+{
+}
+
+static void
+update_modifier_state(struct weston_seat *seat, uint32_t serial, uint32_t key,
+                     enum wl_keyboard_key_state state)
+{
+}
+#endif
 
 WL_EXPORT void
 notify_key(struct weston_seat *seat, uint32_t time, uint32_t key,
@@ -1266,6 +1279,7 @@ bind_seat(struct wl_client *client, void *data, uint32_t 
version, uint32_t id)
                wl_seat_send_name(resource, seat->seat_name);
 }
 
+#ifdef ENABLE_XKBCOMMON
 int
 weston_compositor_xkb_init(struct weston_compositor *ec,
                           struct xkb_rule_names *names)
@@ -1413,6 +1427,7 @@ weston_compositor_build_global_keymap(struct 
weston_compositor *ec)
 
        return 0;
 }
+#endif
 
 WL_EXPORT int
 weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap)
@@ -1422,7 +1437,7 @@ weston_seat_init_keyboard(struct weston_seat *seat, 
struct xkb_keymap *keymap)
        if (seat->keyboard)
                return 0;
 
-
+#ifdef ENABLE_XKBCOMMON
        if (seat->compositor->use_xkbcommon) {
                if (keymap != NULL) {
                        seat->xkb_info.keymap = xkb_map_ref(keymap);
@@ -1443,6 +1458,7 @@ weston_seat_init_keyboard(struct weston_seat *seat, 
struct xkb_keymap *keymap)
 
                seat->xkb_state.leds = 0;
        }
+#endif
 
        keyboard = weston_keyboard_create();
        if (keyboard == NULL) {
@@ -1527,11 +1543,13 @@ weston_seat_release(struct weston_seat *seat)
        wl_list_remove(&seat->link);
        /* The global object is destroyed at wl_display_destroy() time. */
 
+#ifdef ENABLE_XKBCOMMON
        if (seat->compositor->use_xkbcommon) {
                if (seat->xkb_state.state != NULL)
                        xkb_state_unref(seat->xkb_state.state);
                xkb_info_destroy(&seat->xkb_info);
        }
+#endif
 
        if (seat->pointer)
                weston_pointer_destroy(seat->pointer);
-- 
1.8.2.1

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to