Input: Add POINTER_EMULATED flag to GetPointerEvents

POINTER_EMULATED merely sets XIPointerEmulated in the generated
DeviceEvent.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Daniel Stone 2011-02-15 19:44:53 +00:00 committed by Peter Hutterer
parent 78d8d6dd7f
commit 5ac1f885f5
3 changed files with 24 additions and 1 deletions

View File

@ -58,6 +58,7 @@
#endif
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2.h>
#include <X11/extensions/XIproto.h>
#include <pixman.h>
#include "exglobals.h"
@ -1159,6 +1160,11 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
event->root_x_frac = screenx - trunc(screenx);
event->root_y_frac = screeny - trunc(screeny);
if (flags & POINTER_EMULATED) {
raw->flags = XIPointerEmulated;
event->flags = XIPointerEmulated;
}
set_valuators(pDev, event, &mask);
return num_events;

View File

@ -68,6 +68,7 @@ SOFTWARE.
#define POINTER_ACCELERATE (1 << 3)
#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */
#define POINTER_NORAW (1 << 5) /* Don't generate RawEvents */
#define POINTER_EMULATED (1 << 6) /* Event was emulated from another event */
/*int constants for pointer acceleration schemes*/
#define PtrAccelNoOp 0

View File

@ -41,6 +41,7 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
int nvals = 0;
int bits_set;
int len;
uint32_t flagmask = 0;
if (swap)
{
@ -62,7 +63,17 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
assert(out->detail == in->detail.button);
assert(out->deviceid == in->deviceid);
assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(sizeof(in->valuators.mask))));
assert(out->flags == 0); /* FIXME: we don't set the flags yet */
switch (in->type) {
case ET_RawMotion:
case ET_RawButtonPress:
case ET_RawButtonRelease:
flagmask = XIPointerEmulated;
break;
default:
flagmask = 0;
}
assert((out->flags & ~flagmask) == 0);
ptr = (unsigned char*)&out[1];
bits_set = 0;
@ -304,6 +315,11 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
assert(out->sourceid == in->sourceid);
switch (in->type) {
case ET_ButtonPress:
case ET_Motion:
case ET_ButtonRelease:
flagmask = XIPointerEmulated;
break;
case ET_KeyPress:
flagmask = XIKeyRepeat;
break;