aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xquartz/X11Application.m
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-04-30 10:36:15 +0200
committermarha <marha@users.sourceforge.net>2012-04-30 10:36:15 +0200
commit762b7fde3d57d3a151f98535fd31516b7e823bc0 (patch)
tree11c32921b96808f2aab11a86863534fb28b274f6 /xorg-server/hw/xquartz/X11Application.m
parentb68922d51f52ca6ab9daa0105ef5c57f35bfbdcf (diff)
downloadvcxsrv-762b7fde3d57d3a151f98535fd31516b7e823bc0.tar.gz
vcxsrv-762b7fde3d57d3a151f98535fd31516b7e823bc0.tar.bz2
vcxsrv-762b7fde3d57d3a151f98535fd31516b7e823bc0.zip
fontconfig libX11 libfontenc mesa pixman xserver git update 30 Apr 2012
Diffstat (limited to 'xorg-server/hw/xquartz/X11Application.m')
-rw-r--r--xorg-server/hw/xquartz/X11Application.m154
1 files changed, 134 insertions, 20 deletions
diff --git a/xorg-server/hw/xquartz/X11Application.m b/xorg-server/hw/xquartz/X11Application.m
index a203f7807..0c3283ed0 100644
--- a/xorg-server/hw/xquartz/X11Application.m
+++ b/xorg-server/hw/xquartz/X11Application.m
@@ -215,9 +215,8 @@ message_kit_thread(SEL selector, NSObject *arg)
if (state) {
if (bgMouseLocationUpdated) {
DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
- bgMouseLocation.x, bgMouseLocation.y, 0.0,
- 0.0,
- 0.0);
+ bgMouseLocation.x, bgMouseLocation.y,
+ 0.0, 0.0);
bgMouseLocationUpdated = FALSE;
}
DarwinSendDDXEvent(kXquartzActivate, 0);
@@ -1549,9 +1548,9 @@ handle_mouse:
if ([e isEnteringProximity])
needsProximityIn = YES;
else
- DarwinSendProximityEvents(darwinTabletCurrent, ProximityOut,
- location.x, location.y, pressure,
- tilt.x, tilt.y);
+ DarwinSendTabletEvents(darwinTabletCurrent, ProximityOut, 0,
+ location.x, location.y, pressure,
+ tilt.x, tilt.y);
return;
}
@@ -1563,9 +1562,9 @@ handle_mouse:
pDev = darwinTabletCurrent;
if (needsProximityIn) {
- DarwinSendProximityEvents(darwinTabletCurrent, ProximityIn,
- location.x, location.y, pressure,
- tilt.x, tilt.y);
+ DarwinSendTabletEvents(darwinTabletCurrent, ProximityIn, 0,
+ location.x, location.y, pressure,
+ tilt.x, tilt.y);
needsProximityIn = NO;
}
@@ -1596,14 +1595,22 @@ handle_mouse:
if (bgMouseLocationUpdated) {
if (!(ev_type == MotionNotify && ev_button == 0)) {
- DarwinSendPointerEvents(pDev, MotionNotify, 0, location.x,
- location.y, pressure, tilt.x, tilt.y);
+ DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
+ location.x, location.y,
+ 0.0, 0.0);
}
bgMouseLocationUpdated = FALSE;
}
- DarwinSendPointerEvents(pDev, ev_type, ev_button, location.x,
- location.y, pressure, tilt.x, tilt.y);
+ if (pDev == darwinPointer) {
+ DarwinSendPointerEvents(pDev, ev_type, ev_button,
+ location.x, location.y,
+ [e deltaX], [e deltaY]);
+ } else {
+ DarwinSendTabletEvents(pDev, ev_type, ev_button,
+ location.x, location.y, pressure,
+ tilt.x, tilt.y);
+ }
break;
@@ -1627,15 +1634,35 @@ handle_mouse:
if ([e isEnteringProximity])
needsProximityIn = YES;
else
- DarwinSendProximityEvents(darwinTabletCurrent, ProximityOut,
- location.x, location.y, pressure,
- tilt.x, tilt.y);
+ DarwinSendTabletEvents(darwinTabletCurrent, ProximityOut, 0,
+ location.x, location.y, pressure,
+ tilt.x, tilt.y);
break;
case NSScrollWheel:
{
- float deltaX = [e deltaX];
- float deltaY = [e deltaY];
+ CGFloat deltaX = [e deltaX];
+ CGFloat deltaY = [e deltaY];
+ CGEventRef cge = [e CGEvent];
+ BOOL isContinuous =
+ CGEventGetIntegerValueField(cge, kCGScrollWheelEventIsContinuous);
+
+#if 0
+ /* Scale the scroll value by line height */
+ CGEventSourceRef source = CGEventCreateSourceFromEvent(cge);
+ if (source) {
+ double lineHeight = CGEventSourceGetPixelsPerLine(source);
+ CFRelease(source);
+
+ /* There's no real reason for the 1/5 ratio here other than that
+ * it feels like a good ratio after some testing.
+ */
+
+ deltaX *= lineHeight / 5.0;
+ deltaY *= lineHeight / 5.0;
+ }
+#endif
+
#if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION == 0
/* If we're in the background, we need to send a MotionNotify event
* first, since we aren't getting them on background mouse motion
@@ -1643,8 +1670,8 @@ handle_mouse:
if (!XQuartzServerVisible && noTestExtensions) {
bgMouseLocationUpdated = FALSE;
DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
- location.x, location.y, pressure,
- tilt.x, tilt.y);
+ location.x, location.y,
+ 0.0, 0.0);
}
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
@@ -1656,6 +1683,93 @@ handle_mouse:
deltaY *= -1;
}
#endif
+ /* This hack is in place to better deal with "clicky" scroll wheels:
+ * http://xquartz.macosforge.org/trac/ticket/562
+ */
+ if (!isContinuous) {
+ static NSTimeInterval lastScrollTime = 0.0;
+
+ /* These store how much extra we have already scrolled.
+ * ie, this is how much we ignore on the next event.
+ */
+ static double deficit_x = 0.0;
+ static double deficit_y = 0.0;
+
+ /* If we have past a second since the last scroll, wipe the slate
+ * clean
+ */
+ if ([e timestamp] - lastScrollTime > 1.0) {
+ deficit_x = deficit_y = 0.0;
+ }
+ lastScrollTime = [e timestamp];
+
+ if (deltaX != 0.0) {
+ /* If we changed directions, wipe the slate clean */
+ if ((deficit_x < 0.0 && deltaX > 0.0) ||
+ (deficit_x > 0.0 && deltaX < 0.0)) {
+ deficit_x = 0.0;
+ }
+
+ /* Eat up the deficit, but ensure that something is
+ * always sent
+ */
+ if (fabs(deltaX) > fabs(deficit_x)) {
+ deltaX -= deficit_x;
+
+ if (deltaX > 0.0) {
+ deficit_x = ceil(deltaX) - deltaX;
+ deltaX = ceil(deltaX);
+ } else {
+ deficit_x = floor(deltaX) - deltaX;
+ deltaX = floor(deltaX);
+ }
+ } else {
+ deficit_x -= deltaX;
+
+ if (deltaX > 0.0) {
+ deltaX = 1.0;
+ } else {
+ deltaX = -1.0;
+ }
+
+ deficit_x += deltaX;
+ }
+ }
+
+ if (deltaY != 0.0) {
+ /* If we changed directions, wipe the slate clean */
+ if ((deficit_y < 0.0 && deltaY > 0.0) ||
+ (deficit_y > 0.0 && deltaY < 0.0)) {
+ deficit_y = 0.0;
+ }
+
+ /* Eat up the deficit, but ensure that something is
+ * always sent
+ */
+ if (fabs(deltaY) > fabs(deficit_y)) {
+ deltaY -= deficit_y;
+
+ if (deltaY > 0.0) {
+ deficit_y = ceil(deltaY) - deltaY;
+ deltaY = ceil(deltaY);
+ } else {
+ deficit_y = floor(deltaY) - deltaY;
+ deltaY = floor(deltaY);
+ }
+ } else {
+ deficit_y -= deltaY;
+
+ if (deltaY > 0.0) {
+ deltaY = 1.0;
+ } else {
+ deltaY = -1.0;
+ }
+
+ deficit_y += deltaY;
+ }
+ }
+ }
+
DarwinSendScrollEvents(deltaX, deltaY);
break;
}