From 6af48de0b8c1d12ee90b9b81a5065eb66f54cc08 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Tue, 5 Aug 2014 15:53:03 +0200 Subject: [PATCH] Use libX11's Xkb* API unconditionally At this point there shouldn't be any system capable of running mutter that doesn't have it and we're introducing functionality like setting the keymap that has an hard requirement on it. https://bugzilla.gnome.org/show_bug.cgi?id=734301 --- configure.ac | 11 ----------- src/core/bell.c | 8 -------- src/core/bell.h | 4 ---- src/core/display-private.h | 2 -- src/core/display.c | 2 -- src/core/keybindings.c | 9 +-------- 6 files changed, 1 insertion(+), 35 deletions(-) diff --git a/configure.ac b/configure.ac index 9fd3900aa..b5bbc2fd2 100644 --- a/configure.ac +++ b/configure.ac @@ -235,17 +235,6 @@ if test x$have_xinerama = xno; then AC_MSG_ERROR([Xinerama extension was not found]) fi -found_xkb=no -AC_CHECK_LIB(X11, XkbQueryExtension, - [AC_CHECK_HEADER(X11/XKBlib.h, - found_xkb=yes)], - , $ALL_X_LIBS) - -if test "x$found_xkb" = "xyes"; then - AC_DEFINE(HAVE_XKB, , [Have keyboard extension library]) -fi - - RANDR_LIBS= found_randr=no AC_CHECK_LIB(Xrandr, XRRUpdateConfiguration, diff --git a/src/core/bell.c b/src/core/bell.c index 8b4e76b59..7c89160b0 100644 --- a/src/core/bell.c +++ b/src/core/bell.c @@ -69,7 +69,6 @@ * * If the configure script found we had no XKB, this does not exist. */ -#ifdef HAVE_XKB static void bell_flash_fullscreen (MetaDisplay *display, XkbAnyEvent *xkb_ev) @@ -244,12 +243,10 @@ meta_bell_notify (MetaDisplay *display, } #endif /* HAVE_LIBCANBERRA */ } -#endif /* HAVE_XKB */ void meta_bell_set_audible (MetaDisplay *display, gboolean audible) { -#ifdef HAVE_XKB #ifdef HAVE_LIBCANBERRA /* When we are playing sounds using libcanberra support, we handle the * bell whether its an audible bell or a visible bell */ @@ -262,13 +259,11 @@ meta_bell_set_audible (MetaDisplay *display, gboolean audible) XkbUseCoreKbd, XkbAudibleBellMask, enable_system_bell ? XkbAudibleBellMask : 0); -#endif /* HAVE_XKB */ } gboolean meta_bell_init (MetaDisplay *display) { -#ifdef HAVE_XKB int xkb_base_error_type, xkb_opcode; if (!XkbQueryExtension (display->xdisplay, &xkb_opcode, @@ -298,20 +293,17 @@ meta_bell_init (MetaDisplay *display) } return TRUE; } -#endif return FALSE; } void meta_bell_shutdown (MetaDisplay *display) { -#ifdef HAVE_XKB /* TODO: persist initial bell state in display, reset here */ XkbChangeEnabledControls (display->xdisplay, XkbUseCoreKbd, XkbAudibleBellMask, XkbAudibleBellMask); -#endif } /** diff --git a/src/core/bell.h b/src/core/bell.h index 70bd97b4a..dbbafa7c5 100644 --- a/src/core/bell.h +++ b/src/core/bell.h @@ -18,13 +18,10 @@ */ #include -#ifdef HAVE_XKB #include -#endif #include "display-private.h" #include "frame.h" -#ifdef HAVE_XKB /** * meta_bell_notify: * @display: The display the bell event came in on @@ -37,7 +34,6 @@ * If the configure script found we had no XKB, this does not exist. */ void meta_bell_notify (MetaDisplay *display, XkbAnyEvent *xkb_ev); -#endif /** * meta_bell_set_audible: diff --git a/src/core/display-private.h b/src/core/display-private.h index 606440e92..95d79e8f7 100644 --- a/src/core/display-private.h +++ b/src/core/display-private.h @@ -207,10 +207,8 @@ struct _MetaDisplay */ int sentinel_counter; -#ifdef HAVE_XKB int xkb_base_event_type; guint32 last_bell_time; -#endif int grab_resize_timeout_id; /* Keybindings stuff */ diff --git a/src/core/display.c b/src/core/display.c index 77a9f5d98..0b360baf5 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -634,9 +634,7 @@ meta_display_open (void) display->grab_resize_timeout_id = 0; display->grab_have_keyboard = FALSE; -#ifdef HAVE_XKB display->last_bell_time = 0; -#endif display->grab_op = META_GRAB_OP_NONE; display->grab_window = NULL; diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 09d95d549..db8708f52 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -51,9 +51,7 @@ #include -#ifdef HAVE_XKB #include -#endif #include "backends/x11/meta-backend-x11.h" #include "x11/window-x11.h" @@ -930,7 +928,6 @@ meta_display_process_mapping_event (MetaDisplay *display, gboolean keymap_changed = FALSE; gboolean modmap_changed = FALSE; -#ifdef HAVE_XKB if (event->type == display->xkb_base_event_type) { meta_topic (META_DEBUG_KEYBINDINGS, @@ -939,9 +936,7 @@ meta_display_process_mapping_event (MetaDisplay *display, keymap_changed = TRUE; modmap_changed = TRUE; } - else -#endif - if (event->xmapping.request == MappingModifier) + else if (event->xmapping.request == MappingModifier) { meta_topic (META_DEBUG_KEYBINDINGS, "Received MappingModifier event, will reload modmap and redo keybindings\n"); @@ -3966,11 +3961,9 @@ meta_display_init_keys (MetaDisplay *display) meta_prefs_add_listener (bindings_changed_callback, display); -#ifdef HAVE_XKB /* meta_display_init_keys() should have already called XkbQueryExtension() */ if (display->xkb_base_event_type != -1) XkbSelectEvents (display->xdisplay, XkbUseCoreKbd, XkbNewKeyboardNotifyMask | XkbMapNotifyMask, XkbNewKeyboardNotifyMask | XkbMapNotifyMask); -#endif }