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
This commit is contained in:
Rui Matos 2014-08-05 15:53:03 +02:00
parent e5c4fedd55
commit 6af48de0b8
6 changed files with 1 additions and 35 deletions

View File

@ -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,

View File

@ -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
}
/**

View File

@ -18,13 +18,10 @@
*/
#include <X11/Xlib.h>
#ifdef HAVE_XKB
#include <X11/XKBlib.h>
#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:

View File

@ -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 */

View File

@ -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;

View File

@ -51,9 +51,7 @@
#include <xkbcommon/xkbcommon.h>
#ifdef HAVE_XKB
#include <X11/XKBlib.h>
#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
}