1
0
Fork 0

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]) AC_MSG_ERROR([Xinerama extension was not found])
fi 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= RANDR_LIBS=
found_randr=no found_randr=no
AC_CHECK_LIB(Xrandr, XRRUpdateConfiguration, AC_CHECK_LIB(Xrandr, XRRUpdateConfiguration,

View file

@ -69,7 +69,6 @@
* *
* If the configure script found we had no XKB, this does not exist. * If the configure script found we had no XKB, this does not exist.
*/ */
#ifdef HAVE_XKB
static void static void
bell_flash_fullscreen (MetaDisplay *display, bell_flash_fullscreen (MetaDisplay *display,
XkbAnyEvent *xkb_ev) XkbAnyEvent *xkb_ev)
@ -244,12 +243,10 @@ meta_bell_notify (MetaDisplay *display,
} }
#endif /* HAVE_LIBCANBERRA */ #endif /* HAVE_LIBCANBERRA */
} }
#endif /* HAVE_XKB */
void void
meta_bell_set_audible (MetaDisplay *display, gboolean audible) meta_bell_set_audible (MetaDisplay *display, gboolean audible)
{ {
#ifdef HAVE_XKB
#ifdef HAVE_LIBCANBERRA #ifdef HAVE_LIBCANBERRA
/* When we are playing sounds using libcanberra support, we handle the /* When we are playing sounds using libcanberra support, we handle the
* bell whether its an audible bell or a visible bell */ * bell whether its an audible bell or a visible bell */
@ -262,13 +259,11 @@ meta_bell_set_audible (MetaDisplay *display, gboolean audible)
XkbUseCoreKbd, XkbUseCoreKbd,
XkbAudibleBellMask, XkbAudibleBellMask,
enable_system_bell ? XkbAudibleBellMask : 0); enable_system_bell ? XkbAudibleBellMask : 0);
#endif /* HAVE_XKB */
} }
gboolean gboolean
meta_bell_init (MetaDisplay *display) meta_bell_init (MetaDisplay *display)
{ {
#ifdef HAVE_XKB
int xkb_base_error_type, xkb_opcode; int xkb_base_error_type, xkb_opcode;
if (!XkbQueryExtension (display->xdisplay, &xkb_opcode, if (!XkbQueryExtension (display->xdisplay, &xkb_opcode,
@ -298,20 +293,17 @@ meta_bell_init (MetaDisplay *display)
} }
return TRUE; return TRUE;
} }
#endif
return FALSE; return FALSE;
} }
void void
meta_bell_shutdown (MetaDisplay *display) meta_bell_shutdown (MetaDisplay *display)
{ {
#ifdef HAVE_XKB
/* TODO: persist initial bell state in display, reset here */ /* TODO: persist initial bell state in display, reset here */
XkbChangeEnabledControls (display->xdisplay, XkbChangeEnabledControls (display->xdisplay,
XkbUseCoreKbd, XkbUseCoreKbd,
XkbAudibleBellMask, XkbAudibleBellMask,
XkbAudibleBellMask); XkbAudibleBellMask);
#endif
} }
/** /**

View file

@ -18,13 +18,10 @@
*/ */
#include <X11/Xlib.h> #include <X11/Xlib.h>
#ifdef HAVE_XKB
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
#endif
#include "display-private.h" #include "display-private.h"
#include "frame.h" #include "frame.h"
#ifdef HAVE_XKB
/** /**
* meta_bell_notify: * meta_bell_notify:
* @display: The display the bell event came in on * @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. * If the configure script found we had no XKB, this does not exist.
*/ */
void meta_bell_notify (MetaDisplay *display, XkbAnyEvent *xkb_ev); void meta_bell_notify (MetaDisplay *display, XkbAnyEvent *xkb_ev);
#endif
/** /**
* meta_bell_set_audible: * meta_bell_set_audible:

View file

@ -207,10 +207,8 @@ struct _MetaDisplay
*/ */
int sentinel_counter; int sentinel_counter;
#ifdef HAVE_XKB
int xkb_base_event_type; int xkb_base_event_type;
guint32 last_bell_time; guint32 last_bell_time;
#endif
int grab_resize_timeout_id; int grab_resize_timeout_id;
/* Keybindings stuff */ /* Keybindings stuff */

View file

@ -634,9 +634,7 @@ meta_display_open (void)
display->grab_resize_timeout_id = 0; display->grab_resize_timeout_id = 0;
display->grab_have_keyboard = FALSE; display->grab_have_keyboard = FALSE;
#ifdef HAVE_XKB
display->last_bell_time = 0; display->last_bell_time = 0;
#endif
display->grab_op = META_GRAB_OP_NONE; display->grab_op = META_GRAB_OP_NONE;
display->grab_window = NULL; display->grab_window = NULL;

View file

@ -51,9 +51,7 @@
#include <xkbcommon/xkbcommon.h> #include <xkbcommon/xkbcommon.h>
#ifdef HAVE_XKB
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
#endif
#include "backends/x11/meta-backend-x11.h" #include "backends/x11/meta-backend-x11.h"
#include "x11/window-x11.h" #include "x11/window-x11.h"
@ -930,7 +928,6 @@ meta_display_process_mapping_event (MetaDisplay *display,
gboolean keymap_changed = FALSE; gboolean keymap_changed = FALSE;
gboolean modmap_changed = FALSE; gboolean modmap_changed = FALSE;
#ifdef HAVE_XKB
if (event->type == display->xkb_base_event_type) if (event->type == display->xkb_base_event_type)
{ {
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
@ -939,9 +936,7 @@ meta_display_process_mapping_event (MetaDisplay *display,
keymap_changed = TRUE; keymap_changed = TRUE;
modmap_changed = TRUE; modmap_changed = TRUE;
} }
else else if (event->xmapping.request == MappingModifier)
#endif
if (event->xmapping.request == MappingModifier)
{ {
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"Received MappingModifier event, will reload modmap and redo keybindings\n"); "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); meta_prefs_add_listener (bindings_changed_callback, display);
#ifdef HAVE_XKB
/* meta_display_init_keys() should have already called XkbQueryExtension() */ /* meta_display_init_keys() should have already called XkbQueryExtension() */
if (display->xkb_base_event_type != -1) if (display->xkb_base_event_type != -1)
XkbSelectEvents (display->xdisplay, XkbUseCoreKbd, XkbSelectEvents (display->xdisplay, XkbUseCoreKbd,
XkbNewKeyboardNotifyMask | XkbMapNotifyMask, XkbNewKeyboardNotifyMask | XkbMapNotifyMask,
XkbNewKeyboardNotifyMask | XkbMapNotifyMask); XkbNewKeyboardNotifyMask | XkbMapNotifyMask);
#endif
} }