xserver: Branch 'master' - 9 commits

Jeremy Huddleston jeremyhu at apple.com
Thu Apr 19 22:29:48 PDT 2012


Crap,

I just noticed that the machine I was on was tracking the wrong master, and this was pushed to origin instead of ~jeremyhu/master.  I'm terribly sorry about that.  I was planning on sending a [PULL] for this soon anyways, but I wanted to get some of the changes reviewed-by first.

I'm terribly sorry for pushing.  I'll go hide in a corner now.

--Jeremy

On Apr 19, 2012, at 10:02 PM, Jeremy Huddleston <jeremyhu at kemper.freedesktop.org> wrote:

> Xext/xres.c                   |    3 
> hw/xquartz/X11Application.m   |  154 ++++++++++++++++++++++++++----
> hw/xquartz/console_redirect.c |    2 
> hw/xquartz/darwin.c           |   57 ++++++-----
> hw/xquartz/darwinEvents.c     |  210 +++++++++++++++++-------------------------
> hw/xquartz/darwinEvents.h     |   13 +-
> hw/xquartz/xpr/xprFrame.c     |    2 
> include/os.h                  |    3 
> test/Makefile.am              |    5 -
> 9 files changed, 271 insertions(+), 178 deletions(-)
> 
> New commits:
> commit 9e681a8d331b73c6f544a27aa33752f9054a6cdb
> Author: Jeremy Huddleston <jeremyhu at apple.com>
> Date:   Thu Apr 19 16:38:06 2012 -0700
> 
>    XQuartz: darwinPointer now sends both absolute and relative motion
> 
>    This should hopefully help out wine clients that were continuing to
>    have issues after the earlier changes.
> 
>    http://xquartz.macosforge.org/trac/ticket/548
> 
>    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
> 
> diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
> index 2a9ad73..0c3283e 100644
> --- a/hw/xquartz/X11Application.m
> +++ b/hw/xquartz/X11Application.m
> @@ -215,7 +215,8 @@ message_kit_thread(SEL selector, NSObject *arg)
>     if (state) {
>         if (bgMouseLocationUpdated) {
>             DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
> -                                    bgMouseLocation.x, bgMouseLocation.y);
> +                                    bgMouseLocation.x, bgMouseLocation.y,
> +                                    0.0, 0.0);
>             bgMouseLocationUpdated = FALSE;
>         }
>         DarwinSendDDXEvent(kXquartzActivate, 0);
> @@ -1595,14 +1596,16 @@ handle_mouse:
>         if (bgMouseLocationUpdated) {
>             if (!(ev_type == MotionNotify && ev_button == 0)) {
>                 DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
> -                                        location.x, location.y);
> +                                        location.x, location.y,
> +                                        0.0, 0.0);
>             }
>             bgMouseLocationUpdated = FALSE;
>         }
> 
>         if (pDev == darwinPointer) {
>             DarwinSendPointerEvents(pDev, ev_type, ev_button,
> -                                    location.x, location.y);
> +                                    location.x, location.y,
> +                                    [e deltaX], [e deltaY]);
>         } else {
>             DarwinSendTabletEvents(pDev, ev_type, ev_button,
>                                    location.x, location.y, pressure,
> @@ -1667,7 +1670,8 @@ handle_mouse:
>         if (!XQuartzServerVisible && noTestExtensions) {
>             bgMouseLocationUpdated = FALSE;
>             DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
> -                                    location.x, location.y);
> +                                    location.x, location.y,
> +                                    0.0, 0.0);
>         }
> #endif
> #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
> diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
> index 03030ad..41db72a 100644
> --- a/hw/xquartz/darwin.c
> +++ b/hw/xquartz/darwin.c
> @@ -309,7 +309,7 @@ static int
> DarwinMouseProc(DeviceIntPtr pPointer, int what)
> {
> #define NBUTTONS 3
> -#define NAXES    4
> +#define NAXES    6
>     // 3 buttons: left, middle, right
>     CARD8 map[NBUTTONS + 1] = { 0, 1, 2, 3};
>     Atom btn_labels[NBUTTONS] = { 0 };
> @@ -323,10 +323,12 @@ DarwinMouseProc(DeviceIntPtr pPointer, int what)
>         btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
>         btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
> 
> -        axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
> -        axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
> -        axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_WHEEL);
> -        axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HWHEEL);
> +        axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
> +        axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
> +        axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
> +        axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
> +        axes_labels[4] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_WHEEL);
> +        axes_labels[5] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HWHEEL);
> 
>         // Set button map.
>         InitPointerDeviceStruct((DevicePtr)pPointer, map, NBUTTONS,
> @@ -334,21 +336,27 @@ DarwinMouseProc(DeviceIntPtr pPointer, int what)
>                                 (PtrCtrlProcPtr)NoopDDA,
>                                 GetMotionHistorySize(), NAXES,
>                                 axes_labels);
> -        InitValuatorAxisStruct(pPointer, 0, axes_labels[0], 
> +        InitValuatorAxisStruct(pPointer, 0, axes_labels[0],
>                                NO_AXIS_LIMITS, NO_AXIS_LIMITS,
> -                               1, 0, 1, Relative);
> -        InitValuatorAxisStruct(pPointer, 1, axes_labels[1], 
> +                               0, 0, 0, Absolute);
> +        InitValuatorAxisStruct(pPointer, 1, axes_labels[1],
>                                NO_AXIS_LIMITS, NO_AXIS_LIMITS,
> -                               1, 0, 1, Relative);
> +                               0, 0, 0, Absolute);
>         InitValuatorAxisStruct(pPointer, 2, axes_labels[2], 
>                                NO_AXIS_LIMITS, NO_AXIS_LIMITS,
>                                1, 0, 1, Relative);
>         InitValuatorAxisStruct(pPointer, 3, axes_labels[3], 
>                                NO_AXIS_LIMITS, NO_AXIS_LIMITS,
>                                1, 0, 1, Relative);
> +        InitValuatorAxisStruct(pPointer, 4, axes_labels[4], 
> +                               NO_AXIS_LIMITS, NO_AXIS_LIMITS,
> +                               1, 0, 1, Relative);
> +        InitValuatorAxisStruct(pPointer, 5, axes_labels[5], 
> +                               NO_AXIS_LIMITS, NO_AXIS_LIMITS,
> +                               1, 0, 1, Relative);
> 
> -        SetScrollValuator(pPointer, 2, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_PREFERRED);
> -        SetScrollValuator(pPointer, 3, SCROLL_TYPE_HORIZONTAL, -1.0, SCROLL_FLAG_NONE);
> +        SetScrollValuator(pPointer, 4, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_PREFERRED);
> +        SetScrollValuator(pPointer, 5, SCROLL_TYPE_HORIZONTAL, -1.0, SCROLL_FLAG_NONE);
>         break;
> 
>     case DEVICE_ON:
> @@ -399,23 +407,24 @@ DarwinTabletProc(DeviceIntPtr pPointer, int what)
>                                 axes_labels);
>         InitProximityClassDeviceStruct(pPointer);
> 
> -        InitValuatorAxisStruct(pPointer, 0, axes_labels[0], 0,
> -                               XQUARTZ_VALUATOR_LIMIT, 1, 0, 1,
> -                               Absolute);
> -        InitValuatorAxisStruct(pPointer, 1, axes_labels[1], 0,
> -                               XQUARTZ_VALUATOR_LIMIT, 1, 0, 1,
> -                               Absolute);
> -        InitValuatorAxisStruct(pPointer, 2, axes_labels[2], 0,
> -                               XQUARTZ_VALUATOR_LIMIT, 1, 0, 1,
> -                               Absolute);
> +        InitValuatorAxisStruct(pPointer, 0, axes_labels[0],
> +                               0, XQUARTZ_VALUATOR_LIMIT,
> +                               1, 0, 1, Absolute);
> +        InitValuatorAxisStruct(pPointer, 1, axes_labels[1],
> +                               0, XQUARTZ_VALUATOR_LIMIT,
> +                               1, 0, 1, Absolute);
> +        InitValuatorAxisStruct(pPointer, 2, axes_labels[2],
> +                               0, XQUARTZ_VALUATOR_LIMIT,
> +                               1, 0, 1, Absolute);
>         InitValuatorAxisStruct(pPointer, 3, axes_labels[3],
>                                -XQUARTZ_VALUATOR_LIMIT,
> -                               XQUARTZ_VALUATOR_LIMIT, 1, 0, 1,
> -                               Absolute);
> +                               XQUARTZ_VALUATOR_LIMIT,
> +                               1, 0, 1, Absolute);
>         InitValuatorAxisStruct(pPointer, 4, axes_labels[4],
>                                -XQUARTZ_VALUATOR_LIMIT,
> -                               XQUARTZ_VALUATOR_LIMIT, 1, 0, 1,
> -                               Absolute);
> +                               XQUARTZ_VALUATOR_LIMIT,
> +                               1, 0, 1, Absolute);
> +
>         //          pPointer->use = IsXExtensionDevice;
>         break;
> 
> diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
> index 25f011b..b41c6fd 100644
> --- a/hw/xquartz/darwinEvents.c
> +++ b/hw/xquartz/darwinEvents.c
> @@ -74,12 +74,6 @@
> 
> #include <IOKit/hidsystem/IOLLEvent.h>
> 
> -/* Fake button press/release for scroll wheel move. */
> -#define SCROLLWHEELUPFAKE    4
> -#define SCROLLWHEELDOWNFAKE  5
> -#define SCROLLWHEELLEFTFAKE  6
> -#define SCROLLWHEELRIGHTFAKE 7
> -
> #include <X11/extensions/applewmconst.h>
> #include "applewmExt.h"
> 
> @@ -497,12 +491,6 @@ DarwinSendTabletEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
>     pointer_x -= darwinMainScreenX + screen->x;
>     pointer_y -= darwinMainScreenY + screen->y;
> 
> -    if (pointer_x < 0.0)
> -        pointer_x = 0.0;
> -
> -    if (pointer_y < 0.0)
> -        pointer_y = 0.0;
> -    
>     /* Adjust our pointer location to the [0,1] range */
>     pointer_x = pointer_x / (double)screenInfo.width;
>     pointer_y = pointer_y / (double)screenInfo.height;
> @@ -528,7 +516,8 @@ DarwinSendTabletEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
> 
> void
> DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
> -                        double pointer_x, double pointer_y)
> +                        double pointer_x, double pointer_y,
> +                        double pointer_dx, double pointer_dy)
> {
>     static int darwinFakeMouseButtonDown = 0;
>     ScreenPtr screen;
> @@ -553,7 +542,7 @@ DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
>             /* We're currently "down" with another button, so release it first */
>             DarwinSendPointerEvents(pDev, ButtonRelease,
>                                     darwinFakeMouseButtonDown,
> -                                    pointer_x, pointer_y);
> +                                    pointer_x, pointer_y, 0.0, 0.0);
>             darwinFakeMouseButtonDown = 0;
>         }
>         if (darwin_all_modifier_flags & darwinFakeMouse2Mask) {
> @@ -591,22 +580,23 @@ DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
>     pointer_x -= darwinMainScreenX + screen->x;
>     pointer_y -= darwinMainScreenY + screen->y;
> 
> -    if (pointer_x < 0.0)
> -        pointer_x = 0.0;
> -
> -    if (pointer_y < 0.0)
> -        pointer_y = 0.0;
> -
>     valuator_mask_zero(&valuators);
>     valuator_mask_set_double(&valuators, 0, pointer_x);
>     valuator_mask_set_double(&valuators, 1, pointer_y);
> 
> +    if (ev_type == MotionNotify) {
> +        if (pointer_dx != 0.0)
> +            valuator_mask_set_double(&valuators, 2, pointer_dx);
> +        if (pointer_dy != 0.0)
> +            valuator_mask_set_double(&valuators, 3, pointer_dy);
> +    }
> +
>     darwinEvents_lock();
>     {
>         QueuePointerEvents(pDev, ev_type, ev_button, POINTER_ABSOLUTE,
>                            &valuators);
>         DarwinPokeEQ();
> -    } darwinEvents_unlock();
> +    } darwinEvents_unlock();   
> }
> 
> void
> @@ -647,8 +637,8 @@ DarwinSendScrollEvents(double scroll_x, double scroll_y) {
>     }
> 
>     valuator_mask_zero(&valuators);
> -    valuator_mask_set_double(&valuators, 2, scroll_y);
> -    valuator_mask_set_double(&valuators, 3, scroll_x);
> +    valuator_mask_set_double(&valuators, 4, scroll_y);
> +    valuator_mask_set_double(&valuators, 5, scroll_x);
> 
>     darwinEvents_lock();
>     {
> diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
> index 812a5dc..448e730 100644
> --- a/hw/xquartz/darwinEvents.h
> +++ b/hw/xquartz/darwinEvents.h
> @@ -49,7 +49,8 @@ DarwinSendTabletEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
>                        double tilt_x, double tilt_y);
> void
> DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
> -                        double pointer_x, double pointer_y);
> +                        double pointer_x, double pointer_y,
> +                        double pointer_dx, double pointer_dy);
> void
> DarwinSendKeyboardEvents(int ev_type, int keycode);
> void
> commit 4efd35ecdd79eeaca765b461ebf3dcf2509ed0b1
> Author: Jeremy Huddleston <jeremyhu at apple.com>
> Date:   Thu Apr 19 18:48:22 2012 -0700
> 
>    XQuartz: Add a hack to better handle clicky wheel scroll mice
> 
>    We loose information from AppKit being in our way.  Before adopting
>    smooth scrolling, we always rounded-up the number of scroll button
>    clicks per NSEvent.  Now, the scroll value is accumulated in the
>    dix, and clicky scroll wheels with legacy X11 clients are seeing
>    an accumulation of error due to so many translations (button press
>    to smooth scrolling value in AppKit, passed to the dix, and then
>    synthesized into a button press).  This attempts to make the
>    situation better.
> 
>    http://xquartz.macosforge.org/trac/ticket/562
> 
>    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
> 
> diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
> index f700c67..2a9ad73 100644
> --- a/hw/xquartz/X11Application.m
> +++ b/hw/xquartz/X11Application.m
> @@ -1638,8 +1638,28 @@ handle_mouse:
> 
>     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
> @@ -1659,6 +1679,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;
>     }
> commit 873acd8e62a2678870e6aae984cd9b6693846757
> Author: Jeremy Huddleston <jeremyhu at apple.com>
> Date:   Thu Apr 19 16:20:30 2012 -0700
> 
>    XQuartz: Use screenInfo.{width,height} instead of grabbing it from the first screen
> 
>    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
> 
> diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
> index 9fc23a3..25f011b 100644
> --- a/hw/xquartz/darwinEvents.c
> +++ b/hw/xquartz/darwinEvents.c
> @@ -504,8 +504,8 @@ DarwinSendTabletEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
>         pointer_y = 0.0;
> 
>     /* Adjust our pointer location to the [0,1] range */
> -    pointer_x = pointer_x / (double)screenInfo.screens[0]->width;
> -    pointer_y = pointer_y / (double)screenInfo.screens[0]->height;
> +    pointer_x = pointer_x / (double)screenInfo.width;
> +    pointer_y = pointer_y / (double)screenInfo.height;
> 
>     valuator_mask_zero(&valuators);
>     valuator_mask_set_double(&valuators, 0, XQUARTZ_VALUATOR_LIMIT * pointer_x);
> commit 53fe023393cea635ad2093f2aeb5cef7409d3867
> Author: Jeremy Huddleston <jeremyhu at apple.com>
> Date:   Wed Apr 18 17:50:55 2012 -0700
> 
>    XQuartz: Separate out tablet and mouse event delivery into separate functions
> 
>    This should have no immediate impact aside from fake mouse buttons no longer
>    working with tablets (where they aren't needed or desired anyways).  This
>    prepares us for future changes.
> 
>    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
> 
> diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
> index a203f78..f700c67 100644
> --- a/hw/xquartz/X11Application.m
> +++ b/hw/xquartz/X11Application.m
> @@ -215,9 +215,7 @@ 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);
>             bgMouseLocationUpdated = FALSE;
>         }
>         DarwinSendDDXEvent(kXquartzActivate, 0);
> @@ -1549,9 +1547,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 +1561,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 +1594,20 @@ 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);
>             }
>             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);
> +        } else {
> +            DarwinSendTabletEvents(pDev, ev_type, ev_button,
> +                                   location.x, location.y, pressure,
> +                                   tilt.x, tilt.y);
> +        }
> 
>         break;
> 
> @@ -1627,9 +1631,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);
>         break;
> 
>     case NSScrollWheel:
> @@ -1643,8 +1647,7 @@ handle_mouse:
>         if (!XQuartzServerVisible && noTestExtensions) {
>             bgMouseLocationUpdated = FALSE;
>             DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
> -                                    location.x, location.y, pressure, 
> -                                    tilt.x, tilt.y);
> +                                    location.x, location.y);
>         }
> #endif
> #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
> diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
> index c62dd44..9fc23a3 100644
> --- a/hw/xquartz/darwinEvents.c
> +++ b/hw/xquartz/darwinEvents.c
> @@ -44,19 +44,20 @@
> #include <dix-config.h>
> #endif
> 
> -#include   <X11/X.h>
> -#include   <X11/Xmd.h>
> -#include   <X11/Xproto.h>
> -#include   "misc.h"
> -#include   "windowstr.h"
> -#include   "pixmapstr.h"
> -#include   "inputstr.h"
> -#include   "inpututils.h"
> -#include   "eventstr.h"
> -#include   "mi.h"
> -#include   "scrnintstr.h"
> -#include   "mipointer.h"
> -#include   "os.h"
> +#include <X11/X.h>
> +#include <X11/Xmd.h>
> +#include <X11/Xproto.h>
> +#include "misc.h"
> +#include "windowstr.h"
> +#include "pixmapstr.h"
> +#include "inputstr.h"
> +#include "inpututils.h"
> +#include "eventstr.h"
> +#include "mi.h"
> +#include "scrnintstr.h"
> +#include "mipointer.h"
> +#include "os.h"
> +#include "exglobals.h"
> 
> #include "darwin.h"
> #include "quartz.h"
> @@ -442,56 +443,6 @@ DarwinPokeEQ(void)
>     write(darwinEventWriteFD, &nullbyte, sizeof(nullbyte));
> }
> 
> -/* Convert from Appkit pointer input values to X input values:
> - * Note: pointer_x and pointer_y are relative to the upper-left of primary
> - *       display.
> - */
> -static void
> -DarwinPrepareValuators(DeviceIntPtr pDev, ValuatorMask *pmask,
> -                       ScreenPtr screen,
> -                       double pointer_x, double pointer_y,
> -                       double pressure, double tilt_x,
> -                       double tilt_y)
> -{
> -
> -    valuator_mask_zero(pmask);
> -
> -    /* Fix offset between darwin and X screens */
> -    pointer_x -= darwinMainScreenX + screen->x;
> -    pointer_y -= darwinMainScreenY + screen->y;
> -
> -    if (pointer_x < 0.0)
> -        pointer_x = 0.0;
> -
> -    if (pointer_y < 0.0)
> -        pointer_y = 0.0;
> -
> -    if (pDev == darwinPointer) {
> -        valuator_mask_set_double(pmask, 0, pointer_x);
> -        valuator_mask_set_double(pmask, 1, pointer_y);
> -    }
> -    else {
> -        valuator_mask_set_double(pmask, 0, XQUARTZ_VALUATOR_LIMIT *
> -                                 (pointer_x /
> -                                  (double)screenInfo.screens[0]->width));
> -        valuator_mask_set_double(pmask, 1, XQUARTZ_VALUATOR_LIMIT *
> -                                 (pointer_y /
> -                                  (double)screenInfo.screens[0]->height));
> -        valuator_mask_set_double(pmask, 2, XQUARTZ_VALUATOR_LIMIT * pressure);
> -        valuator_mask_set_double(pmask, 3, XQUARTZ_VALUATOR_LIMIT * tilt_x);
> -        valuator_mask_set_double(pmask, 4, XQUARTZ_VALUATOR_LIMIT * tilt_y);
> -        DEBUG_LOG("Pointer (%lf, %lf), Valuators: {%lf,%lf,%lf,%lf,%lf}\n",
> -                  pointer_x, pointer_y,
> -                  valuator_mask_get_double(pmask,
> -                                           0),
> -                  valuator_mask_get_double(pmask, 1),
> -                  valuator_mask_get_double(pmask,
> -                                           2),
> -                  valuator_mask_get_double(pmask, 3),
> -                  valuator_mask_get_double(pmask, 4));
> -    }
> -}
> -
> void
> DarwinInputReleaseButtonsAndKeys(DeviceIntPtr pDev)
> {
> @@ -521,27 +472,78 @@ DarwinInputReleaseButtonsAndKeys(DeviceIntPtr pDev)
> }
> 
> void
> +DarwinSendTabletEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
> +                       double pointer_x, double pointer_y,
> +                       double pressure, double tilt_x,
> +                       double tilt_y)
> +{
> +    ScreenPtr screen;
> +    ValuatorMask valuators;
> +
> +    if (!darwinEvents) {
> +        DEBUG_LOG("%s called before darwinEvents was initialized\n",
> +                  __FUNCTION__);
> +        return;
> +    }
> +
> +    screen = miPointerGetScreen(pDev);
> +    if (!screen) {
> +        DEBUG_LOG("%s called before screen was initialized\n",
> +                  __FUNCTION__);
> +        return;
> +    }
> +
> +    /* Fix offset between darwin and X screens */
> +    pointer_x -= darwinMainScreenX + screen->x;
> +    pointer_y -= darwinMainScreenY + screen->y;
> +
> +    if (pointer_x < 0.0)
> +        pointer_x = 0.0;
> +
> +    if (pointer_y < 0.0)
> +        pointer_y = 0.0;
> +    
> +    /* Adjust our pointer location to the [0,1] range */
> +    pointer_x = pointer_x / (double)screenInfo.screens[0]->width;
> +    pointer_y = pointer_y / (double)screenInfo.screens[0]->height;
> +
> +    valuator_mask_zero(&valuators);
> +    valuator_mask_set_double(&valuators, 0, XQUARTZ_VALUATOR_LIMIT * pointer_x);
> +    valuator_mask_set_double(&valuators, 1, XQUARTZ_VALUATOR_LIMIT * pointer_y);
> +    valuator_mask_set_double(&valuators, 2, XQUARTZ_VALUATOR_LIMIT * pressure);
> +    valuator_mask_set_double(&valuators, 3, XQUARTZ_VALUATOR_LIMIT * tilt_x);
> +    valuator_mask_set_double(&valuators, 4, XQUARTZ_VALUATOR_LIMIT * tilt_y);
> +
> +    darwinEvents_lock();
> +    {
> +        if (ev_type == ProximityIn || ev_type == ProximityOut) {
> +            QueueProximityEvents(pDev, ev_type, &valuators);
> +        } else {
> +            QueuePointerEvents(pDev, ev_type, ev_button, POINTER_ABSOLUTE,
> +                               &valuators);
> +        }
> +        DarwinPokeEQ();
> +    } darwinEvents_unlock();
> +}
> +
> +void
> DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
> -                        double pointer_x, double pointer_y,
> -                        double pressure, double tilt_x,
> -                        double tilt_y)
> +                        double pointer_x, double pointer_y)
> {
>     static int darwinFakeMouseButtonDown = 0;
>     ScreenPtr screen;
>     ValuatorMask valuators;
> 
> -    //DEBUG_LOG("x=%f, y=%f, p=%f, tx=%f, ty=%f\n", pointer_x, pointer_y, pressure, tilt_x, tilt_y);
> -
>     if (!darwinEvents) {
> -        DEBUG_LOG(
> -            "DarwinSendPointerEvents called before darwinEvents was initialized\n");
> +        DEBUG_LOG("%s called before darwinEvents was initialized\n",
> +                  __FUNCTION__);
>         return;
>     }
> 
>     screen = miPointerGetScreen(pDev);
>     if (!screen) {
> -        DEBUG_LOG(
> -            "DarwinSendPointerEvents called before screen was initialized\n");
> +        DEBUG_LOG("%s called before screen was initialized\n",
> +                  __FUNCTION__);
>         return;
>     }
> 
> @@ -550,9 +552,8 @@ DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
>         if (darwinFakeMouseButtonDown != 0) {
>             /* We're currently "down" with another button, so release it first */
>             DarwinSendPointerEvents(pDev, ButtonRelease,
> -                                    darwinFakeMouseButtonDown, pointer_x,
> -                                    pointer_y, pressure, tilt_x,
> -                                    tilt_y);
> +                                    darwinFakeMouseButtonDown,
> +                                    pointer_x, pointer_y);
>             darwinFakeMouseButtonDown = 0;
>         }
>         if (darwin_all_modifier_flags & darwinFakeMouse2Mask) {
> @@ -586,9 +587,20 @@ DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
>         darwinFakeMouseButtonDown = 0;
>     }
> 
> -    DarwinPrepareValuators(pDev, &valuators, screen, pointer_x, pointer_y,
> -                           pressure, tilt_x,
> -                           tilt_y);
> +    /* Fix offset between darwin and X screens */
> +    pointer_x -= darwinMainScreenX + screen->x;
> +    pointer_y -= darwinMainScreenY + screen->y;
> +
> +    if (pointer_x < 0.0)
> +        pointer_x = 0.0;
> +
> +    if (pointer_y < 0.0)
> +        pointer_y = 0.0;
> +
> +    valuator_mask_zero(&valuators);
> +    valuator_mask_set_double(&valuators, 0, pointer_x);
> +    valuator_mask_set_double(&valuators, 1, pointer_y);
> +
>     darwinEvents_lock();
>     {
>         QueuePointerEvents(pDev, ev_type, ev_button, POINTER_ABSOLUTE,
> @@ -615,42 +627,6 @@ DarwinSendKeyboardEvents(int ev_type, int keycode)
>     } darwinEvents_unlock();
> }
> 
> -void
> -DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, double pointer_x,
> -                          double pointer_y,
> -                          double pressure, double tilt_x,
> -                          double tilt_y)
> -{
> -    ScreenPtr screen;
> -    ValuatorMask valuators;
> -
> -    DEBUG_LOG("DarwinSendProximityEvents: %d l:%f,%f p:%f t:%f,%f\n", ev_type,
> -              pointer_x, pointer_y, pressure, tilt_x,
> -              tilt_y);
> -
> -    if (!darwinEvents) {
> -        DEBUG_LOG(
> -            "DarwinSendProximityEvents called before darwinEvents was initialized\n");
> -        return;
> -    }
> -
> -    screen = miPointerGetScreen(pDev);
> -    if (!screen) {
> -        DEBUG_LOG(
> -            "DarwinSendPointerEvents called before screen was initialized\n");
> -        return;
> -    }
> -
> -    DarwinPrepareValuators(pDev, &valuators, screen, pointer_x, pointer_y,
> -                           pressure, tilt_x,
> -                           tilt_y);
> -    darwinEvents_lock();
> -    {
> -        QueueProximityEvents(pDev, ev_type, &valuators);
> -        DarwinPokeEQ();
> -    } darwinEvents_unlock();
> -}
> -
> /* Send the appropriate number of button clicks to emulate scroll wheel */
> void
> DarwinSendScrollEvents(double scroll_x, double scroll_y) {
> diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
> index 61ace6e..812a5dc 100644
> --- a/hw/xquartz/darwinEvents.h
> +++ b/hw/xquartz/darwinEvents.h
> @@ -44,14 +44,12 @@ DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
> void
> DarwinInputReleaseButtonsAndKeys(DeviceIntPtr pDev);
> void
> -DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
> -                        double pointer_x, double pointer_y, double pressure,
> -                        double tilt_x,
> -                        double tilt_y);
> +DarwinSendTabletEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
> +                       double pointer_x, double pointer_y, double pressure,
> +                       double tilt_x, double tilt_y);
> void
> -DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, double pointer_x,
> -                          double pointer_y, double pressure, double tilt_x,
> -                          double tilt_y);
> +DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
> +                        double pointer_x, double pointer_y);
> void
> DarwinSendKeyboardEvents(int ev_type, int keycode);
> void
> commit 4cb519dd1d4acfe4bb920b8558452152ece9724a
> Author: Jeremy Huddleston <jeremyhu at apple.com>
> Date:   Thu Apr 19 16:06:45 2012 -0700
> 
>    XQuartz: Correct calculation of the size of our file descriptor array in console_redirect
> 
>    Reported-by: Joe Rohde <joer at valvesoftware.com>
>    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
> 
> diff --git a/hw/xquartz/console_redirect.c b/hw/xquartz/console_redirect.c
> index 7b92eca..1e0e56b 100644
> --- a/hw/xquartz/console_redirect.c
> +++ b/hw/xquartz/console_redirect.c
> @@ -336,7 +336,7 @@ xq_asl_log_fd(aslclient asl, aslmsg msg, int level, int fd)
>                   {
>                       /* Reallocate if we need more space */
>                       if (fd >= n_redirect_fds) {
> -                          size_t new_n = 1 << (ffs(fd) + 1);
> +                          size_t new_n = 1 << (fls(fd) + 1);
>                           asl_redirect *new_array =
>                               realloc(redirect_fds, new_n *
>                                       sizeof(*redirect_fds));
> commit 4c44bcbf6208df1de93206f5cb1bdf4eba5b0f72
> Author: Jeremy Huddleston <jeremyhu at apple.com>
> Date:   Wed Apr 18 01:01:44 2012 -0700
> 
>    XQuartz: Fix a deadlock in pre-dispatch code
> 
>    The fact that this has been in place so long makes me really wonder if
>    anybody cares about this running in Tiger or Leopard.
> 
>    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
> 
> diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
> index 4c7aac4..01f1def 100644
> --- a/hw/xquartz/xpr/xprFrame.c
> +++ b/hw/xquartz/xpr/xprFrame.c
> @@ -212,7 +212,7 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
> #else
>     pthread_rwlock_wrlock(&window_hash_rwlock);
>     x_hash_table_insert(window_hash, pFrame->wid, pFrame);
> -    pthread_rwlock_wrlock(&window_hash_rwlock);
> +    pthread_rwlock_unlock(&window_hash_rwlock);
> #endif
> 
>     xprSetNativeProperty(pFrame);
> commit 4ce2be2ed0860ecfa9d7019957ae64dabe2a5ee3
> Author: Jeremy Huddleston <jeremyhu at apple.com>
> Date:   Sat Apr 7 15:26:53 2012 -0700
> 
>    test: Fix make dist
> 
>    It seems like make dist should be doing te right thing without this commit,
>    but it's not in some cases.  Don't ask me to explain why.
> 
>    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
> 
> diff --git a/test/Makefile.am b/test/Makefile.am
> index 8c7e412..8582397 100644
> --- a/test/Makefile.am
> +++ b/test/Makefile.am
> @@ -54,8 +54,6 @@ libxservertest_la_LIBADD += \
>             $(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la \
>             @XORG_LIBS@
> 
> -EXTRA_DIST = ddxstubs.c
> -
> else
> nodist_libxservertest_la_SOURCES = \
>             ddxstubs.c \
> @@ -111,3 +109,6 @@ endif
> 
> libxservertest_la_DEPENDENCIES = $(libxservertest_la_LIBADD)
> endif
> +
> +EXTRA_DIST = ddxstubs.c
> +
> commit fc8983279ca06da385d8ce741eeeddd35b3ada9f
> Author: Jeremy Huddleston <jeremyhu at apple.com>
> Date:   Thu Apr 19 16:39:23 2012 -0700
> 
>    os: Annotate OsVendorFatalError as _X_ATTRIBUTE_PRINTF
> 
>    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
> 
> diff --git a/include/os.h b/include/os.h
> index 166c60c..276eb52 100644
> --- a/include/os.h
> +++ b/include/os.h
> @@ -321,7 +321,8 @@ extern _X_EXPORT void
> OsCleanup(Bool);
> 
> extern _X_EXPORT void
> -OsVendorFatalError(const char *f, va_list args);
> +OsVendorFatalError(const char *f, va_list args)
> +_X_ATTRIBUTE_PRINTF(1, 0);
> 
> extern _X_EXPORT void
> OsVendorInit(void);
> commit 319841fcaaa6e0491658b4b4940bac86ee51ac1a
> Author: Jeremy Huddleston <jeremyhu at apple.com>
> Date:   Thu Apr 19 16:51:46 2012 -0700
> 
>    xres: Fix build without composite
> 
>    Regression from: b8d0d19a6d410776b53a41e7cae90f68d4b22bb7
>    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
> 
> diff --git a/Xext/xres.c b/Xext/xres.c
> index ecef0c0..dbefeeb 100644
> --- a/Xext/xres.c
> +++ b/Xext/xres.c
> @@ -29,7 +29,10 @@
> #include <string.h>
> #include "hashtable.h"
> #include "picturestr.h"
> +
> +#ifdef COMPOSITE
> #include "compint.h"
> +#endif
> 
> /** @brief Holds fragments of responses for ConstructClientIds.
>  *
> _______________________________________________
> xorg-commit mailing list
> xorg-commit at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-commit
> 



More information about the xorg-devel mailing list