mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-09-06 18:05:39 +00:00
build: Make libxkbcommon build-time optional in the compositor
v2: Incorporate review feedback from Daniel Stone - improved configure message about the purpose of this option and reorganisation of #ifdefs.
This commit is contained in:
parent
01a9273bd2
commit
382ff46ffb
15
configure.ac
15
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,19 @@ if test x$enable_egl = xyes; then
|
|||
COMPOSITOR_MODULES="$COMPOSITOR_MODULES egl >= 7.10 glesv2"
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(xkbcommon,
|
||||
AS_HELP_STRING([--disable-xkbcommon], [Disable libxkbcommon
|
||||
support: This is only useful in environments
|
||||
where you do not have a hardware keyboard. If
|
||||
libxkbcommon support is disabled clients will not
|
||||
be sent a keymap and and must know how to
|
||||
interpret the keycode sent for any key event.]),,
|
||||
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],,
|
||||
|
|
|
@ -2829,7 +2829,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);
|
||||
|
@ -2841,6 +2840,7 @@ 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);
|
||||
|
||||
if (weston_compositor_xkb_init(ec, &xkb_names) < 0)
|
||||
return -1;
|
||||
|
||||
|
|
39
src/input.c
39
src/input.c
|
@ -744,6 +744,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)
|
||||
{
|
||||
|
@ -833,6 +834,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,
|
||||
|
@ -1276,16 +1289,12 @@ 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)
|
||||
{
|
||||
/*
|
||||
* If we're operating in raw keyboard mode, libxkbcommon isn't used and
|
||||
* shouldn't be initialized.
|
||||
*/
|
||||
if (!ec->use_xkbcommon)
|
||||
return 0;
|
||||
ec->use_xkbcommon = 1;
|
||||
|
||||
if (ec->xkb_context == NULL) {
|
||||
ec->xkb_context = xkb_context_new(0);
|
||||
|
@ -1423,6 +1432,19 @@ weston_compositor_build_global_keymap(struct weston_compositor *ec)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int
|
||||
weston_compositor_xkb_init(struct weston_compositor *ec,
|
||||
struct xkb_rule_names *names)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
weston_compositor_xkb_destroy(struct weston_compositor *ec)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
WL_EXPORT int
|
||||
weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap)
|
||||
|
@ -1432,7 +1454,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);
|
||||
|
@ -1453,6 +1475,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) {
|
||||
|
@ -1537,11 +1560,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);
|
||||
|
|
Loading…
Reference in a new issue