diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2006-11-16 12:51:08 +1030 |
---|---|---|
committer | Peter Hutterer <whot@hyena.localdomain> | 2006-11-16 12:51:08 +1030 |
commit | 7ce2dc57844872cc340b60387d4d1cb3d982633e (patch) | |
tree | 3d6f319bb8f57c68a0a5e39284925ef5d3efdcaa | |
parent | 4d07b503727ba86315b90d6f45b06ed6185724b2 (diff) |
dix:
merge with code cleanup from master
GetPointerEvents treats events in the same way as XINPUT devices when flag
has POINTER_MULTIPOINTER set.
xfree86/common:
added XI86_MP_DEVICE flag and parsing in xf86ProcessCommonOptions
added POINTER_MULTIPOINTER define. Is used in xf86PostMotionEvent and
xf86PostButtonEvent for the flags that are passed into GetPointerEvents()
global:
added flags to configure.ac to enable/disable MPX define
added flags to dix-config.h.in to define MPX
-rw-r--r-- | Changelog | 25 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | dix/getevents.c | 25 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Xinput.c | 40 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Xinput.h | 4 | ||||
-rw-r--r-- | include/dix-config.h.in | 3 | ||||
-rw-r--r-- | include/input.h | 3 |
7 files changed, 107 insertions, 2 deletions
diff --git a/Changelog b/Changelog new file mode 100644 index 000000000..d8f930037 --- /dev/null +++ b/Changelog @@ -0,0 +1,25 @@ +MPX Changelog file + +== 16.11.06 == +dix: + merge with code cleanup from master + GetPointerEvents treats events in the same way as XINPUT devices when flag + has POINTER_MULTIPOINTER set. + +xfree86/common: + added XI86_MP_DEVICE flag and parsing in xf86ProcessCommonOptions + added POINTER_MULTIPOINTER define. Is used in xf86PostMotionEvent and + xf86PostButtonEvent for the flags that are passed into GetPointerEvents() + +global: + added flags to configure.ac to enable/disable MPX define + added flags to dix-config.h.in to #define MPX + +Files: + dix/getevents.c + hw/xfree86/common/xf86Xinput.c + hw/xfree86/common/xf86Xinput.h + include/input.h + configure.ac + include/dix-config.h.in + diff --git a/configure.ac b/configure.ac index 2108db4d3..706df9137 100644 --- a/configure.ac +++ b/configure.ac @@ -421,6 +421,7 @@ AC_ARG_ENABLE(builtin-fonts, AS_HELP_STRING([--enable-builtin-fonts], [Use only AC_ARG_ENABLE(null-root-cursor, AS_HELP_STRING([--enable-null-root-cursor], [Use an empty root cursor (default: use core cursor)]), [NULL_ROOT_CURSOR=$enableval], [NULL_ROOT_CURSOR=no]) +AC_ARG_ENABLE(mpx, AS_HELP_STRING([--disable-mpx], [Disable MPX multipointer support (Default: enabled)]), [MPX=$enableval], [MPX=yes]) dnl Extensions. AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes]) @@ -783,6 +784,14 @@ AC_DEFINE(XINPUT, 1, [Support X Input extension]) XI_LIB='$(top_builddir)/Xi/libXi.la' XI_INC='-I$(top_srcdir)/Xi' +dnl Enable MPX multipointer extension +AC_MSG_CHECKING([whether to use MPX extension]) +AC_MSG_RESULT([$MPX]) +AM_CONDITIONAL(MPX, [test "x$MPX" = xyes]) + +if test "x$MPX" = xyes; then + AC_DEFINE(MPX, 1, [Support MPX multipointer extension]) +fi AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes) AC_DEFINE(SHAPE, 1, [Support SHAPE extension]) diff --git a/dix/getevents.c b/dix/getevents.c index 2077ce2a7..eb3c2a58c 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -21,6 +21,15 @@ * * Author: Daniel Stone <daniel@fooishbar.org> */ +#ifdef MPX + /* + * MPX additions: + * Copyright © 2006 Peter Hutterer + * License see above. + * Author: Peter Hutterer <peter@cs.unisa.edu.au> + * + */ +#endif #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -480,6 +489,11 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type, * The DDX is responsible for allocating the event structure in the first * place via GetMaximumEventsNum(), and for freeing it. */ +#ifdef MPX + /* In MPX, flags can be set to POINTER_MULTIPOINTER to indicate that the + * device is a multipointer device. MP devices always send core events. + */ +#endif _X_EXPORT int GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, int flags, int first_valuator, int num_valuators, @@ -525,6 +539,11 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, kbp->time = ms; kbp->deviceid = pDev->id; +#ifdef MPX + if (flags & POINTER_MULTIPOINTER) + pointer = pDev; + else +#endif if (pDev->coreEvents) pointer = inputInfo.pointer; else @@ -581,6 +600,12 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, updateMotionHistory(pDev, ms, first_valuator, num_valuators, valuators); +#ifdef MPX + if (flags & POINTER_MULTIPOINTER) + { + // noop, just to fit MPX in easier with the following if + } else +#endif if (pDev->coreEvents) { /* set the virtual core pointer's coordinates */ pointer->valuator->lastx = x; diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 50df56633..0dc392a5c 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -47,6 +47,17 @@ */ /* $XConsortium: xf86Xinput.c /main/14 1996/10/27 11:05:25 kaleb $ */ +#ifdef MPX + /* + * MPX additions: + * Copyright © 2006 Peter Hutterer + * License see above. + * Author: Peter Hutterer <peter@cs.unisa.edu.au> + * + */ +#endif + + #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif @@ -133,6 +144,13 @@ xf86ProcessCommonOptions(LocalDevicePtr local, xf86Msg(X_CONFIG, "%s: always reports core events\n", local->name); } +#ifdef MPX + if (xf86SetBoolOption(list, "IsMPDevice", 0)) { + local->flags |= XI86_MP_DEVICE; + xf86Msg(X_CONFIG, "%s: is MP device\n", local->name); + } +#endif + if (xf86SetBoolOption(list, "SendDragEvents", 1)) { local->flags |= XI86_SEND_DRAG_EVENTS; } else { @@ -196,6 +214,9 @@ xf86ActivateDevice(LocalDevicePtr local) xf86XinputFinalizeInit(dev); dev->coreEvents = local->flags & XI86_ALWAYS_CORE; +#ifdef MPX + dev->coreEvents |= local->flags & XI86_MP_DEVICE; +#endif RegisterOtherDevice(dev); if (serverGeneration == 1) @@ -441,6 +462,11 @@ xf86PostMotionEvent(DeviceIntPtr device, flags = POINTER_ABSOLUTE; else flags = POINTER_RELATIVE | POINTER_ACCELERATE; + +#ifdef MPX + if (device->coreEvents & XI86_MP_DEVICE) + flags |= POINTER_MULTIPOINTER; +#endif valuators = xcalloc(sizeof(int), num_valuators); @@ -507,6 +533,17 @@ xf86PostButtonEvent(DeviceIntPtr device, va_list var; int *valuators = NULL; int i = 0, nevents = 0; + int flags = 0; + + if (is_absolute) + flags = POINTER_ABSOLUTE; + else + flags = POINTER_RELATIVE; + +#ifdef MPX + if (device->coreEvents & XI86_MP_DEVICE) + flags |= POINTER_MULTIPOINTER; +#endif valuators = xcalloc(sizeof(int), num_valuators); @@ -522,8 +559,7 @@ xf86PostButtonEvent(DeviceIntPtr device, nevents = GetPointerEvents(xf86Events, device, is_down ? ButtonPress : ButtonRelease, button, - is_absolute ? POINTER_ABSOLUTE : - POINTER_RELATIVE, + flags, first_valuator, num_valuators, valuators); for (i = 0; i < nevents; i++) diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h index fe65643ce..4c752cd32 100644 --- a/hw/xfree86/common/xf86Xinput.h +++ b/hw/xfree86/common/xf86Xinput.h @@ -83,6 +83,10 @@ #define XI86_POINTER_CAPABLE 0x40 /* capable of being a core pointer */ #define XI86_KEYBOARD_CAPABLE 0x80 /* capable of being a core keyboard */ +#ifdef MPX +#define XI86_MP_DEVICE 0x100 /* device is multipointer device */ +#endif + #define XI_PRIVATE(dev) \ (((LocalDevicePtr)((dev)->public.devicePrivate))->private) diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 1120337e8..ed7a3d776 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -347,6 +347,9 @@ /* Support X Input extension */ #undef XINPUT +/* Support MPX multipointer extension */ +#undef MPX + /* Build XKB */ #undef XKB diff --git a/include/input.h b/include/input.h index e7017cb27..c7b2dfeba 100644 --- a/include/input.h +++ b/include/input.h @@ -62,6 +62,9 @@ SOFTWARE. #define POINTER_RELATIVE (1 << 1) #define POINTER_ABSOLUTE (1 << 2) #define POINTER_ACCELERATE (1 << 3) +#ifdef MPX +#define POINTER_MULTIPOINTER (1 << 4) +#endif #define MAP_LENGTH 256 #define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */ |