diff options
author | Keith Packard <keithp@keithp.com> | 2011-06-07 07:45:22 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-06-07 07:45:22 -0700 |
commit | bf9fd0a83eef771ee018438f05e2d9f20b43539b (patch) | |
tree | ce2d7d271b3e17f18130f62e1b1407b4fb497bde | |
parent | 21eec367d0d9c142458f973062e17add4f693033 (diff) | |
parent | 0d140567ba2b5bf364265dba07de519f691c67a1 (diff) |
Merge remote-tracking branch 'whot/for-keith'
-rw-r--r-- | Xi/exevents.c | 4 | ||||
-rw-r--r-- | dix/events.c | 6 | ||||
-rw-r--r-- | dix/getevents.c | 43 | ||||
-rw-r--r-- | test/input.c | 3 |
4 files changed, 36 insertions, 20 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c index c6f9d467f..3b0411d61 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -890,8 +890,8 @@ ProcessRawEvent(RawDeviceEvent *ev, DeviceIntPtr device) i = EventToXI2((InternalEvent*)ev, (xEvent**)&xi); if (i != Success) { - ErrorF("[Xi] %s: XI2 conversion failed in ProcessRawEvent (%d)\n", - device->name, i); + ErrorF("[Xi] %s: XI2 conversion failed in %s (%d)\n", + __func__, device->name, i); return; } diff --git a/dix/events.c b/dix/events.c index b60c29952..3c7bd50cd 100644 --- a/dix/events.c +++ b/dix/events.c @@ -432,7 +432,7 @@ GetEventFilter(DeviceIntPtr dev, xEvent *event) return filters[dev ? dev->id : 0][event->u.u.type]; else if ((evtype = xi2_get_type(event))) return (1 << (evtype % 8)); - ErrorF("[dix] Unknown device type %d. No filter\n", event->u.u.type); + ErrorF("[dix] Unknown event type %d. No filter\n", event->u.u.type); return 0; } @@ -1421,7 +1421,7 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode) static void DetachFromMaster(DeviceIntPtr dev) { - if (!IsFloating(dev)) + if (IsFloating(dev)) return; dev->saved_master_id = GetMaster(dev, MASTER_ATTACHED)->id; @@ -3997,7 +3997,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, rc = EventToXI2(event, &xi2); if (rc == Success) { - int evtype = ((xGenericEvent*)xi2)->evtype; + int evtype = xi2_get_type(xi2); mask = grab->xi2mask[XIAllDevices][evtype/8] | grab->xi2mask[XIAllMasterDevices][evtype/8] | grab->xi2mask[thisDev->id][evtype/8]; diff --git a/dix/getevents.c b/dix/getevents.c index 13789f6a2..c935c971c 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -864,7 +864,7 @@ positionSprite(DeviceIntPtr dev, int mode, * to the current screen. */ miPointerSetPosition(dev, mode, screenx, screeny); - if(!IsMaster(dev) || !IsFloating(dev)) { + if(!IsMaster(dev) && !IsFloating(dev)) { DeviceIntPtr master = GetMaster(dev, MASTER_POINTER); master->last.valuators[0] = *screenx; master->last.valuators[1] = *screeny; @@ -911,7 +911,7 @@ updateHistory(DeviceIntPtr dev, ValuatorMask *mask, CARD32 ms) return; updateMotionHistory(dev, ms, mask, dev->last.valuators); - if(!IsMaster(dev) || !IsFloating(dev)) + if(!IsMaster(dev) && !IsFloating(dev)) { DeviceIntPtr master = GetMaster(dev, MASTER_POINTER); updateMotionHistory(master, ms, mask, dev->last.valuators); @@ -1052,17 +1052,39 @@ FreeEventList(InternalEvent *list, int num_events) free(list); } +/** + * Transform vector x/y according to matrix m and drop the rounded coords + * back into x/y. + */ static void -transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask, int *x, int *y) +transform(struct pixman_f_transform *m, int *x, int *y) { struct pixman_f_vector p = {.v = {*x, *y, 1}}; - - pixman_f_transform_point(&dev->transform, &p); + pixman_f_transform_point(m, &p); *x = lround(p.v[0]); *y = lround(p.v[1]); } +static void +transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask) +{ + int x, y, ox, oy; + + ox = x = valuator_mask_isset(mask, 0) ? valuator_mask_get(mask, 0) : + dev->last.valuators[0]; + oy = y = valuator_mask_isset(mask, 1) ? valuator_mask_get(mask, 1) : + dev->last.valuators[1]; + + transform(&dev->transform, &x, &y); + + if (valuator_mask_isset(mask, 0) || ox != x) + valuator_mask_set(mask, 0, x); + + if (valuator_mask_isset(mask, 1) || oy != y) + valuator_mask_set(mask, 1, y); +} + /** * Generate internal events representing this pointer event and enqueue them * on the event queue. @@ -1175,16 +1197,7 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons } } - x = (valuator_mask_isset(&mask, 0) ? valuator_mask_get(&mask, 0) : - pDev->last.valuators[0]); - y = (valuator_mask_isset(&mask, 1) ? valuator_mask_get(&mask, 1) : - pDev->last.valuators[1]); - transformAbsolute(pDev, &mask, &x, &y); - if (valuator_mask_isset(&mask, 0)) - valuator_mask_set(&mask, 0, x); - if (valuator_mask_isset(&mask, 1)) - valuator_mask_set(&mask, 1, y); - + transformAbsolute(pDev, &mask); moveAbsolute(pDev, &x, &y, &mask); } else { if (flags & POINTER_ACCELERATE) { diff --git a/test/input.c b/test/input.c index ac37d67a1..837ce49dc 100644 --- a/test/input.c +++ b/test/input.c @@ -1223,8 +1223,11 @@ static void dix_valuator_alloc(void) assert(v); assert(v->numAxes == num_axes); +#ifndef __i386__ + /* must be double-aligned on 64 bit */ assert(((void*)v->axisVal - (void*)v) % sizeof(double) == 0); assert(((void*)v->axes - (void*)v) % sizeof(double) == 0); +#endif num_axes ++; } |