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
This commit is contained in:
Peter Hutterer 2006-11-16 12:51:08 +10:30 committed by Peter Hutterer
parent 4d07b50372
commit 7ce2dc5784
7 changed files with 107 additions and 2 deletions

25
Changelog Normal file
View File

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

View File

@ -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])

View File

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

View File

@ -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++)

View File

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

View File

@ -347,6 +347,9 @@
/* Support X Input extension */
#undef XINPUT
/* Support MPX multipointer extension */
#undef MPX
/* Build XKB */
#undef XKB

View File

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