clutter: Unconditionalize a few X11 extensions

We now require xcomposite, xkb, xi 2.2, at least at compile time.
This commit is contained in:
Jonas Ådahl 2018-05-24 17:34:48 +02:00
parent 3e03d1e38e
commit 0067f78155
6 changed files with 56 additions and 181 deletions

View File

@ -42,13 +42,8 @@
#include "xsettings/xsettings-common.h" #include "xsettings/xsettings-common.h"
#if HAVE_XCOMPOSITE
#include <X11/extensions/Xcomposite.h> #include <X11/extensions/Xcomposite.h>
#endif
#if HAVE_XINPUT_2
#include <X11/extensions/XInput2.h> #include <X11/extensions/XInput2.h>
#endif
#include <cogl/cogl.h> #include <cogl/cogl.h>
#include <cogl/cogl-xlib.h> #include <cogl/cogl-xlib.h>
@ -241,7 +236,6 @@ clutter_backend_x11_create_device_manager (ClutterBackendX11 *backend_x11)
ClutterEventTranslator *translator; ClutterEventTranslator *translator;
ClutterBackend *backend; ClutterBackend *backend;
#ifdef HAVE_XINPUT_2
if (clutter_enable_xinput) if (clutter_enable_xinput)
{ {
int event_base, first_event, first_error; int event_base, first_event, first_error;
@ -270,7 +264,6 @@ clutter_backend_x11_create_device_manager (ClutterBackendX11 *backend_x11)
} }
if (backend_x11->device_manager == NULL) if (backend_x11->device_manager == NULL)
#endif /* HAVE_XINPUT_2 */
{ {
CLUTTER_NOTE (BACKEND, "Creating Core device manager"); CLUTTER_NOTE (BACKEND, "Creating Core device manager");
backend_x11->has_xinput = FALSE; backend_x11->has_xinput = FALSE;
@ -517,14 +510,12 @@ static const GOptionEntry entries[] =
G_OPTION_ARG_NONE, &clutter_synchronise, G_OPTION_ARG_NONE, &clutter_synchronise,
N_("Make X calls synchronous"), NULL N_("Make X calls synchronous"), NULL
}, },
#ifdef HAVE_XINPUT_2
{ {
"disable-xinput", 0, "disable-xinput", 0,
G_OPTION_FLAG_REVERSE, G_OPTION_FLAG_REVERSE,
G_OPTION_ARG_NONE, &clutter_enable_xinput, G_OPTION_ARG_NONE, &clutter_enable_xinput,
N_("Disable XInput support"), NULL N_("Disable XInput support"), NULL
}, },
#endif /* HAVE_XINPUT_2 */
{ NULL } { NULL }
}; };
@ -1218,7 +1209,6 @@ clutter_x11_get_input_devices (void)
gboolean gboolean
clutter_x11_has_xinput (void) clutter_x11_has_xinput (void)
{ {
#ifdef HAVE_XINPUT_2
ClutterBackend *backend = clutter_get_default_backend (); ClutterBackend *backend = clutter_get_default_backend ();
if (backend == NULL) if (backend == NULL)
@ -1234,9 +1224,6 @@ clutter_x11_has_xinput (void)
} }
return CLUTTER_BACKEND_X11 (backend)->has_xinput; return CLUTTER_BACKEND_X11 (backend)->has_xinput;
#else
return FALSE;
#endif
} }
/** /**
@ -1250,7 +1237,6 @@ clutter_x11_has_xinput (void)
gboolean gboolean
clutter_x11_has_composite_extension (void) clutter_x11_has_composite_extension (void)
{ {
#if HAVE_XCOMPOSITE
static gboolean have_composite = FALSE, done_check = FALSE; static gboolean have_composite = FALSE, done_check = FALSE;
int error = 0, event = 0; int error = 0, event = 0;
Display *dpy; Display *dpy;
@ -1281,9 +1267,6 @@ clutter_x11_has_composite_extension (void)
done_check = TRUE; done_check = TRUE;
return have_composite; return have_composite;
#else
return FALSE;
#endif /* HAVE_XCOMPOSITE */
} }
/** /**

View File

@ -199,7 +199,6 @@ translate_device_classes (Display *xdisplay,
(XIValuatorClassInfo *) class_info); (XIValuatorClassInfo *) class_info);
break; break;
#ifdef HAVE_XINPUT_2_2
case XIScrollClass: case XIScrollClass:
{ {
XIScrollClassInfo *scroll_info = (XIScrollClassInfo *) class_info; XIScrollClassInfo *scroll_info = (XIScrollClassInfo *) class_info;
@ -223,7 +222,6 @@ translate_device_classes (Display *xdisplay,
scroll_info->increment); scroll_info->increment);
} }
break; break;
#endif /* HAVE_XINPUT_2_2 */
default: default:
break; break;
@ -237,7 +235,6 @@ is_touch_device (XIAnyClassInfo **classes,
ClutterInputDeviceType *device_type, ClutterInputDeviceType *device_type,
guint *n_touch_points) guint *n_touch_points)
{ {
#ifdef HAVE_XINPUT_2_2
guint i; guint i;
for (i = 0; i < n_classes; i++) for (i = 0; i < n_classes; i++)
@ -261,7 +258,6 @@ is_touch_device (XIAnyClassInfo **classes,
return TRUE; return TRUE;
} }
} }
#endif
return FALSE; return FALSE;
} }
@ -771,11 +767,9 @@ get_event_stage (ClutterEventTranslator *translator,
case XI_ButtonPress: case XI_ButtonPress:
case XI_ButtonRelease: case XI_ButtonRelease:
case XI_Motion: case XI_Motion:
#ifdef HAVE_XINPUT_2_2
case XI_TouchBegin: case XI_TouchBegin:
case XI_TouchUpdate: case XI_TouchUpdate:
case XI_TouchEnd: case XI_TouchEnd:
#endif /* HAVE_XINPUT_2_2 */
{ {
XIDeviceEvent *xev = (XIDeviceEvent *) xi_event; XIDeviceEvent *xev = (XIDeviceEvent *) xi_event;
@ -1037,7 +1031,6 @@ clutter_device_manager_xi2_select_stage_events (ClutterDeviceManager *manager,
XISetMask (mask, XI_Enter); XISetMask (mask, XI_Enter);
XISetMask (mask, XI_Leave); XISetMask (mask, XI_Leave);
#ifdef HAVE_XINPUT_2_2
/* enable touch event support if we're running on XInput 2.2 */ /* enable touch event support if we're running on XInput 2.2 */
if (backend_x11->xi_minor >= 2) if (backend_x11->xi_minor >= 2)
{ {
@ -1045,7 +1038,6 @@ clutter_device_manager_xi2_select_stage_events (ClutterDeviceManager *manager,
XISetMask (mask, XI_TouchUpdate); XISetMask (mask, XI_TouchUpdate);
XISetMask (mask, XI_TouchEnd); XISetMask (mask, XI_TouchEnd);
} }
#endif /* HAVE_XINPUT_2_2 */
xi_event_mask.deviceid = XIAllMasterDevices; xi_event_mask.deviceid = XIAllMasterDevices;
xi_event_mask.mask = mask; xi_event_mask.mask = mask;
@ -1472,11 +1464,7 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
"invalid", "invalid",
event->scroll.x, event->scroll.x,
event->scroll.y, event->scroll.y,
#ifdef HAVE_XINPUT_2_2
(xev->flags & XIPointerEmulated) ? "yes" : "no" (xev->flags & XIPointerEmulated) ? "yes" : "no"
#else
"no"
#endif
); );
break; break;
@ -1522,11 +1510,7 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
event->button.x, event->button.x,
event->button.y, event->button.y,
event->button.axes != NULL ? "yes" : "no", event->button.axes != NULL ? "yes" : "no",
#ifdef HAVE_XINPUT_2_2
(xev->flags & XIPointerEmulated) ? "yes" : "no" (xev->flags & XIPointerEmulated) ? "yes" : "no"
#else
"no"
#endif
); );
break; break;
} }
@ -1534,10 +1518,8 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
if (source_device != NULL && device->stage != NULL) if (source_device != NULL && device->stage != NULL)
_clutter_input_device_set_stage (source_device, device->stage); _clutter_input_device_set_stage (source_device, device->stage);
#ifdef HAVE_XINPUT_2_2
if (xev->flags & XIPointerEmulated) if (xev->flags & XIPointerEmulated)
_clutter_event_set_pointer_emulated (event, TRUE); _clutter_event_set_pointer_emulated (event, TRUE);
#endif /* HAVE_XINPUT_2_2 */
if (xi_event->evtype == XI_ButtonPress) if (xi_event->evtype == XI_ButtonPress)
_clutter_stage_x11_set_user_time (stage_x11, event->button.time); _clutter_stage_x11_set_user_time (stage_x11, event->button.time);
@ -1627,10 +1609,8 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
if (source_device != NULL && device->stage != NULL) if (source_device != NULL && device->stage != NULL)
_clutter_input_device_set_stage (source_device, device->stage); _clutter_input_device_set_stage (source_device, device->stage);
#ifdef HAVE_XINPUT_2_2
if (xev->flags & XIPointerEmulated) if (xev->flags & XIPointerEmulated)
_clutter_event_set_pointer_emulated (event, TRUE); _clutter_event_set_pointer_emulated (event, TRUE);
#endif /* HAVE_XINPUT_2_2 */
CLUTTER_NOTE (EVENT, "motion: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, axes:%s)", CLUTTER_NOTE (EVENT, "motion: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, axes:%s)",
(unsigned int) stage_x11->xwin, (unsigned int) stage_x11->xwin,
@ -1644,7 +1624,6 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
} }
break; break;
#ifdef HAVE_XINPUT_2_2
case XI_TouchBegin: case XI_TouchBegin:
{ {
XIDeviceEvent *xev = (XIDeviceEvent *) xi_event; XIDeviceEvent *xev = (XIDeviceEvent *) xi_event;
@ -1756,7 +1735,6 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
retval = CLUTTER_TRANSLATE_QUEUE; retval = CLUTTER_TRANSLATE_QUEUE;
} }
break; break;
#endif /* HAVE_XINPUT_2_2 */
case XI_Enter: case XI_Enter:
case XI_Leave: case XI_Leave:

View File

@ -31,10 +31,7 @@
#include "clutter-private.h" #include "clutter-private.h"
#include <X11/Xatom.h> #include <X11/Xatom.h>
#ifdef HAVE_XKB
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
#endif
typedef struct _ClutterKeymapX11Class ClutterKeymapX11Class; typedef struct _ClutterKeymapX11Class ClutterKeymapX11Class;
typedef struct _DirectionCacheEntry DirectionCacheEntry; typedef struct _DirectionCacheEntry DirectionCacheEntry;
@ -71,7 +68,6 @@ struct _ClutterKeymapX11
PangoDirection current_direction; PangoDirection current_direction;
#ifdef HAVE_XKB
XkbDescPtr xkb_desc; XkbDescPtr xkb_desc;
int xkb_event_base; int xkb_event_base;
guint xkb_map_serial; guint xkb_map_serial;
@ -79,7 +75,6 @@ struct _ClutterKeymapX11
guint current_cache_serial; guint current_cache_serial;
DirectionCacheEntry group_direction_cache[4]; DirectionCacheEntry group_direction_cache[4];
int current_group; int current_group;
#endif
guint caps_lock_state : 1; guint caps_lock_state : 1;
guint num_lock_state : 1; guint num_lock_state : 1;
@ -110,8 +105,6 @@ G_DEFINE_TYPE_WITH_CODE (ClutterKeymapX11, clutter_keymap_x11, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_EVENT_TRANSLATOR, G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_EVENT_TRANSLATOR,
clutter_event_translator_iface_init)); clutter_event_translator_iface_init));
#ifdef HAVE_XKB
/* code adapted from gdk/x11/gdkkeys-x11.c - update_modmap */ /* code adapted from gdk/x11/gdkkeys-x11.c - update_modmap */
static void static void
update_modmap (Display *display, update_modmap (Display *display,
@ -214,9 +207,7 @@ get_xkb (ClutterKeymapX11 *keymap_x11)
return keymap_x11->xkb_desc; return keymap_x11->xkb_desc;
} }
#endif /* HAVE_XKB */
#ifdef HAVE_XKB
static void static void
update_locked_mods (ClutterKeymapX11 *keymap_x11, update_locked_mods (ClutterKeymapX11 *keymap_x11,
gint locked_mods) gint locked_mods)
@ -242,9 +233,7 @@ update_locked_mods (ClutterKeymapX11 *keymap_x11,
g_signal_emit_by_name (keymap_x11->backend, "key-lock-changed"); g_signal_emit_by_name (keymap_x11->backend, "key-lock-changed");
#endif #endif
} }
#endif /* HAVE_XKB */
#ifdef HAVE_XKB
/* the code to retrieve the keymap direction and cache it /* the code to retrieve the keymap direction and cache it
* is taken from GDK: * is taken from GDK:
* gdk/x11/gdkkeys-x11.c * gdk/x11/gdkkeys-x11.c
@ -345,13 +334,11 @@ get_direction_from_cache (ClutterKeymapX11 *keymap_x11,
return direction; return direction;
} }
#endif /* HAVE_XKB */
static void static void
update_direction (ClutterKeymapX11 *keymap_x11, update_direction (ClutterKeymapX11 *keymap_x11,
int group) int group)
{ {
#ifdef HAVE_XKB
XkbDescPtr xkb = get_xkb (keymap_x11); XkbDescPtr xkb = get_xkb (keymap_x11);
Atom group_atom; Atom group_atom;
@ -363,7 +350,6 @@ update_direction (ClutterKeymapX11 *keymap_x11,
keymap_x11->current_group_atom = group_atom; keymap_x11->current_group_atom = group_atom;
keymap_x11->has_direction = TRUE; keymap_x11->has_direction = TRUE;
} }
#endif /* HAVE_XKB */
} }
static void static void
@ -371,15 +357,12 @@ clutter_keymap_x11_constructed (GObject *gobject)
{ {
ClutterKeymapX11 *keymap_x11 = CLUTTER_KEYMAP_X11 (gobject); ClutterKeymapX11 *keymap_x11 = CLUTTER_KEYMAP_X11 (gobject);
ClutterBackendX11 *backend_x11; ClutterBackendX11 *backend_x11;
gint xkb_major = XkbMajorVersion;
gint xkb_minor = XkbMinorVersion;
g_assert (keymap_x11->backend != NULL); g_assert (keymap_x11->backend != NULL);
backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend); backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend);
#ifdef HAVE_XKB
{
gint xkb_major = XkbMajorVersion;
gint xkb_minor = XkbMinorVersion;
if (XkbLibraryVersion (&xkb_major, &xkb_minor)) if (XkbLibraryVersion (&xkb_major, &xkb_minor))
{ {
xkb_major = XkbMajorVersion; xkb_major = XkbMajorVersion;
@ -418,8 +401,6 @@ clutter_keymap_x11_constructed (GObject *gobject)
} }
} }
} }
#endif /* HAVE_XKB */
}
static void static void
clutter_keymap_x11_set_property (GObject *gobject, clutter_keymap_x11_set_property (GObject *gobject,
@ -450,12 +431,10 @@ clutter_keymap_x11_finalize (GObject *gobject)
keymap = CLUTTER_KEYMAP_X11 (gobject); keymap = CLUTTER_KEYMAP_X11 (gobject);
translator = CLUTTER_EVENT_TRANSLATOR (keymap); translator = CLUTTER_EVENT_TRANSLATOR (keymap);
#ifdef HAVE_XKB
_clutter_backend_remove_event_translator (keymap->backend, translator); _clutter_backend_remove_event_translator (keymap->backend, translator);
if (keymap->xkb_desc != NULL) if (keymap->xkb_desc != NULL)
XkbFreeKeyboard (keymap->xkb_desc, XkbAllComponentsMask, True); XkbFreeKeyboard (keymap->xkb_desc, XkbAllComponentsMask, True);
#endif
G_OBJECT_CLASS (clutter_keymap_x11_parent_class)->finalize (gobject); G_OBJECT_CLASS (clutter_keymap_x11_parent_class)->finalize (gobject);
} }
@ -503,7 +482,6 @@ clutter_keymap_x11_translate_event (ClutterEventTranslator *translator,
retval = CLUTTER_TRANSLATE_CONTINUE; retval = CLUTTER_TRANSLATE_CONTINUE;
#ifdef HAVE_XKB
if (xevent->type == keymap_x11->xkb_event_base) if (xevent->type == keymap_x11->xkb_event_base)
{ {
XkbEvent *xkb_event = (XkbEvent *) xevent; XkbEvent *xkb_event = (XkbEvent *) xevent;
@ -530,7 +508,6 @@ clutter_keymap_x11_translate_event (ClutterEventTranslator *translator,
break; break;
} }
} }
#endif /* HAVE_XKB */
return retval; return retval;
} }
@ -545,11 +522,7 @@ gint
_clutter_keymap_x11_get_key_group (ClutterKeymapX11 *keymap, _clutter_keymap_x11_get_key_group (ClutterKeymapX11 *keymap,
ClutterModifierType state) ClutterModifierType state)
{ {
#ifdef HAVE_XKB
return XkbGroupForCoreState (state); return XkbGroupForCoreState (state);
#else
return 0;
#endif /* HAVE_XKB */
} }
gboolean gboolean
@ -606,7 +579,6 @@ _clutter_keymap_x11_translate_key_state (ClutterKeymapX11 *keymap,
backend_x11 = CLUTTER_BACKEND_X11 (keymap->backend); backend_x11 = CLUTTER_BACKEND_X11 (keymap->backend);
#ifdef HAVE_XKB
if (backend_x11->use_xkb) if (backend_x11->use_xkb)
{ {
XkbDescRec *xkb = get_xkb (keymap); XkbDescRec *xkb = get_xkb (keymap);
@ -622,7 +594,6 @@ _clutter_keymap_x11_translate_key_state (ClutterKeymapX11 *keymap,
retval = 0; retval = 0;
} }
else else
#endif /* HAVE_XKB */
retval = translate_keysym (keymap, hardware_keycode); retval = translate_keysym (keymap, hardware_keycode);
if (mods_p) if (mods_p)
@ -644,7 +615,6 @@ _clutter_keymap_x11_get_is_modifier (ClutterKeymapX11 *keymap,
if (keycode < keymap->min_keycode || keycode > keymap->max_keycode) if (keycode < keymap->min_keycode || keycode > keymap->max_keycode)
return FALSE; return FALSE;
#ifdef HAVE_XKB
if (CLUTTER_BACKEND_X11 (keymap->backend)->use_xkb) if (CLUTTER_BACKEND_X11 (keymap->backend)->use_xkb)
{ {
XkbDescRec *xkb = get_xkb (keymap); XkbDescRec *xkb = get_xkb (keymap);
@ -652,7 +622,6 @@ _clutter_keymap_x11_get_is_modifier (ClutterKeymapX11 *keymap,
if (xkb->map->modmap && xkb->map->modmap[keycode] != 0) if (xkb->map->modmap && xkb->map->modmap[keycode] != 0)
return TRUE; return TRUE;
} }
#endif /* HAVE_XKB */
return FALSE; return FALSE;
} }
@ -662,7 +631,6 @@ _clutter_keymap_x11_get_direction (ClutterKeymapX11 *keymap)
{ {
g_return_val_if_fail (CLUTTER_IS_KEYMAP_X11 (keymap), PANGO_DIRECTION_NEUTRAL); g_return_val_if_fail (CLUTTER_IS_KEYMAP_X11 (keymap), PANGO_DIRECTION_NEUTRAL);
#ifdef HAVE_XKB
if (CLUTTER_BACKEND_X11 (keymap->backend)->use_xkb) if (CLUTTER_BACKEND_X11 (keymap->backend)->use_xkb)
{ {
if (!keymap->has_direction) if (!keymap->has_direction)
@ -677,7 +645,6 @@ _clutter_keymap_x11_get_direction (ClutterKeymapX11 *keymap)
return keymap->current_direction; return keymap->current_direction;
} }
else else
#endif
return PANGO_DIRECTION_NEUTRAL; return PANGO_DIRECTION_NEUTRAL;
} }
@ -687,7 +654,6 @@ clutter_keymap_x11_get_entries_for_keyval (ClutterKeymapX11 *keymap_x11,
ClutterKeymapKey **keys, ClutterKeymapKey **keys,
gint *n_keys) gint *n_keys)
{ {
#ifdef HAVE_XKB
if (CLUTTER_BACKEND_X11 (keymap_x11->backend)->use_xkb) if (CLUTTER_BACKEND_X11 (keymap_x11->backend)->use_xkb)
{ {
XkbDescRec *xkb = get_xkb (keymap_x11); XkbDescRec *xkb = get_xkb (keymap_x11);
@ -760,7 +726,6 @@ clutter_keymap_x11_get_entries_for_keyval (ClutterKeymapX11 *keymap_x11,
return *n_keys > 0; return *n_keys > 0;
} }
else else
#endif
{ {
return FALSE; return FALSE;
} }
@ -771,7 +736,6 @@ clutter_keymap_x11_latch_modifiers (ClutterKeymapX11 *keymap_x11,
uint32_t level, uint32_t level,
gboolean enable) gboolean enable)
{ {
#ifdef HAVE_XKB
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend); ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend);
uint32_t modifiers[] = { uint32_t modifiers[] = {
0, 0,
@ -794,7 +758,6 @@ clutter_keymap_x11_latch_modifiers (ClutterKeymapX11 *keymap_x11,
XkbLatchModifiers (clutter_x11_get_default_display (), XkbLatchModifiers (clutter_x11_get_default_display (),
XkbUseCoreKbd, modifiers[level], XkbUseCoreKbd, modifiers[level],
value); value);
#endif
} }
static uint32_t static uint32_t

View File

@ -57,10 +57,7 @@
#include <cogl/winsys/cogl-texture-pixmap-x11.h> #include <cogl/winsys/cogl-texture-pixmap-x11.h>
#include <X11/extensions/Xdamage.h> #include <X11/extensions/Xdamage.h>
#if HAVE_XCOMPOSITE
#include <X11/extensions/Xcomposite.h> #include <X11/extensions/Xcomposite.h>
#endif
enum enum
{ {
@ -960,7 +957,6 @@ clutter_x11_texture_pixmap_set_window (ClutterX11TexturePixmap *texture,
if (dpy == NULL) if (dpy == NULL)
return; return;
#if HAVE_XCOMPOSITE
priv = texture->priv; priv = texture->priv;
if (priv->window == window && automatic == priv->window_redirect_automatic) if (priv->window == window && automatic == priv->window_redirect_automatic)
@ -1024,8 +1020,6 @@ clutter_x11_texture_pixmap_set_window (ClutterX11TexturePixmap *texture,
attr.width, attr.height, attr.width, attr.height,
attr.override_redirect); attr.override_redirect);
g_object_unref (texture); g_object_unref (texture);
#endif /* HAVE_XCOMPOSITE */
} }
static void static void

View File

@ -283,13 +283,11 @@ AS_IF([test "x$SUPPORT_X11" = "x1"],
[AC_MSG_ERROR([not found])] [AC_MSG_ERROR([not found])]
) )
# XCOMPOSITE (optional) # XCOMPOSITE (required)
AC_MSG_CHECKING([for XCOMPOSITE extension >= $XCOMPOSITE_REQ_VERSION]) AC_MSG_CHECKING([for XCOMPOSITE extension >= $XCOMPOSITE_REQ_VERSION])
PKG_CHECK_EXISTS([xcomposite >= $XCOMPOSITE_REQ_VERSION], [have_xcomposite=yes], [have_xcomposite=no]) PKG_CHECK_EXISTS([xcomposite >= $XCOMPOSITE_REQ_VERSION], [have_xcomposite=yes], [have_xcomposite=no])
AS_IF([test "x$have_xcomposite" = "xyes"], AS_IF([test "x$have_xcomposite" = "xyes"],
[ [
AC_DEFINE(HAVE_XCOMPOSITE, [1], [Define to 1 if we have the XCOMPOSITE X extension])
X11_LIBS="$X11_LIBS -lXcomposite" X11_LIBS="$X11_LIBS -lXcomposite"
X11_PC_FILES="$X11_PC_FILES xcomposite >= $XCOMPOSITE_REQ_VERSION" X11_PC_FILES="$X11_PC_FILES xcomposite >= $XCOMPOSITE_REQ_VERSION"
X11_EXTS="$X11_EXTS xcomposite" X11_EXTS="$X11_EXTS xcomposite"
@ -333,45 +331,17 @@ AS_IF([test "x$SUPPORT_X11" = "x1"],
CPPFLAGS="$clutter_save_CPPFLAGS" CPPFLAGS="$clutter_save_CPPFLAGS"
LIBS="$clutter_save_LIBS" LIBS="$clutter_save_LIBS"
# XI (optional) PKG_CHECK_EXISTS([xi], [have_xinput=yes], AC_MSG_ERROR([XI support not found]))
AC_ARG_ENABLE([xinput],
[AS_HELP_STRING([--enable-xinput], [Use the XI X extension])],
[],
[enable_xinput=yes])
AS_IF([test "x$enable_xinput" = "xyes"],
[
PKG_CHECK_EXISTS([xi], [have_xinput=yes], [have_xinput=no])
],
[
have_xinput=no
])
AS_CASE([$have_xinput],
[yes],
[
AC_CHECK_HEADERS([X11/extensions/XInput2.h], AC_CHECK_HEADERS([X11/extensions/XInput2.h],
[ [],
have_xinput2=yes AC_MSG_ERROR([XI2 not found]))
AC_DEFINE([HAVE_XINPUT_2],
[1],
[Define to 1 if XI2 is available])
])
clutter_save_LIBS="$LIBS"
LIBS="$LIBS -lXi"
AC_CHECK_FUNC([XIAllowTouchEvents], AC_CHECK_FUNC([XIAllowTouchEvents],
[ [
AC_CHECK_MEMBER([XIScrollClassInfo.number], AC_CHECK_MEMBER([XIScrollClassInfo.number],
[ [],
have_xinput_2_2=yes AC_MSG_ERROR([XIScrollClasSInfo.number member missing in XI2]),
AC_DEFINE([HAVE_XINPUT_2_2], [1], [Define to 1 if XInput 2.2 is available]) [[#include <X11/extensions/XInput2.h>]])
], ])
[have_xinput_2_2=no],
[[#include <X11/extensions/XInput2.h>]])])
LIBS="$clutter_save_LIBS" LIBS="$clutter_save_LIBS"
X11_LIBS="$X11_LIBS $XINPUT_LIBS" X11_LIBS="$X11_LIBS $XINPUT_LIBS"
@ -380,14 +350,6 @@ AS_IF([test "x$SUPPORT_X11" = "x1"],
AS_IF([test "x$have_xinput_2_2" = "xyes"], AS_IF([test "x$have_xinput_2_2" = "xyes"],
[X11_EXTS="$X11_EXTS xi2.2"], [X11_EXTS="$X11_EXTS xi2.2"],
[X11_EXTS="$X11_EXTS xi2.0"]) [X11_EXTS="$X11_EXTS xi2.0"])
],
[no],
[have_xinput2=no],
[*],
[AC_MSG_ERROR([Invalid argument for --enable-xinput])]
)
# XKB # XKB
clutter_save_CPPFLAGS="$CPPFLAGS" clutter_save_CPPFLAGS="$CPPFLAGS"
@ -396,14 +358,9 @@ AS_IF([test "x$SUPPORT_X11" = "x1"],
clutter_save_LIBS="$LIBS" clutter_save_LIBS="$LIBS"
LIBS="$LIBS $X11_LIBS" LIBS="$LIBS $X11_LIBS"
have_xkb=no
AC_CHECK_FUNC([XkbQueryExtension], AC_CHECK_FUNC([XkbQueryExtension],
[ [],
AC_DEFINE(HAVE_XKB, 1, [Define to use XKB extension]) [AC_MSG_ERROR([XKB support not found])])
have_xkb=yes
X11_EXTS="$X11_EXTS xkb"
])
CPPFLAGS="$clutter_save_CPPFLAGS" CPPFLAGS="$clutter_save_CPPFLAGS"
LIBS="$clutter_save_LIBS" LIBS="$clutter_save_LIBS"

View File

@ -21,7 +21,7 @@
#include <clutter/clutter.h> #include <clutter/clutter.h>
#if defined CLUTTER_WINDOWING_X11 && HAVE_XINPUT_2_2 #ifdef CLUTTER_WINDOWING_X11
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -355,12 +355,12 @@ error:
return 0; return 0;
} }
#endif /* defined CLUTTER_WINDOWING_X11 && HAVE_XINPUT_2_2 */ #endif /* CLUTTER_WINDOWING_X11 */
static void static void
events_touch (void) events_touch (void)
{ {
#if defined CLUTTER_WINDOWING_X11 && HAVE_XINPUT_2_2 #ifdef CLUTTER_WINDOWING_X11
ClutterActor *stage; ClutterActor *stage;
State state; State state;
@ -384,7 +384,7 @@ events_touch (void)
g_print ("end result: %s\n", state.pass ? "pass" : "FAIL"); g_print ("end result: %s\n", state.pass ? "pass" : "FAIL");
g_assert (state.pass); g_assert (state.pass);
#endif /* defined CLUTTER_WINDOWING_X11 && HAVE_XINPUT_2_2 */ #endif /* CLUTTER_WINDOWING_X11 */
} }
CLUTTER_TEST_SUITE ( CLUTTER_TEST_SUITE (