[Xquartz-changes] xserver: Branch 'master' - 5 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Fri Mar 23 18:58:46 PDT 2012


Rebased ref, commits from common ancestor:
commit 7794aea2af59bd1f8d4a23aebfc715808e2f59d8
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Feb 17 13:15:12 2012 -0800

    XQuartz: Detect FatalErrors on startup to prevent tight crash loops
    
    If a FatalError occurs before the server finishes launching, it will
    not have drained the launchd-owned DISPLAY socket, so launchd will
    just relaunch it.  This can cause the server to crash in a tight loop
    which will spam the user with CrashReporter windows that claim focus on
    appearance.
    
    This allows users stuck in this loop to "deal" with the problem without
    popping up a crash report every 10 seconds.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index 5680686..a20c13e 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -108,6 +108,9 @@ X11ApplicationCanEnterRandR(void);
 void
 X11ApplicationMain(int argc, char **argv, char **envp);
 
+void
+X11ApplicationFatalError(const char *f, va_list args) __printflike(1, 0);
+
 #define PREFS_APPSMENU              "apps_menu"
 #define PREFS_FAKEBUTTONS           "enable_fake_buttons"
 #define PREFS_KEYEQUIVS             "enable_key_equivalents"
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index d01f341..1629301 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -70,6 +70,7 @@ static dispatch_queue_t eventTranslationQueue;
 
 extern Bool noTestExtensions;
 extern Bool noRenderExtension;
+extern BOOL serverRunning;
 
 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 static TISInputSourceRef last_key_layout;
@@ -1067,8 +1068,52 @@ NO] || XQuartzShieldingWindowLevel != 0)
     }
 }
 
+void
+X11ApplicationFatalError(const char *f, va_list args)
+{
+#ifdef HAVE_LIBDISPATCH
+    NSString *title, *msg;
+    char *error_msg;
+
+    /* This is called by FatalError() in the server thread just before
+     * we would abort.  If the server never got off the ground, We should
+     * inform the user of the error rather than letting the ever-so-friendly
+     * CrashReporter do it for us.
+     *
+     * This also has the benefit of forcing user interaction rather than
+     * allowing an infinite throttled-restart if the crash occurs before
+     * we can drain the launchd socket.
+     */
+
+    if (serverRunning) {
+        return;
+    }
+
+    title = NSLocalizedString(@"The application X11 could not be opened.",
+                              @"Dialog title when encountering a fatal error");
+    msg = NSLocalizedString(@"An error occurred while starting the X11 server: \"%s\"\n\nClick Quit to quit X11. Click Report to see more details or send a report to Apple.",
+                            @"Dialog when encountering a fatal error");
+
+    vasprintf(&error_msg, f, args);
+    msg = [NSString stringWithFormat:msg, error_msg];
+
+    /* We want the AppKit thread to actually service the alert or we will race [NSApp run] and create an
+     * 'NSInternalInconsistencyException', reason: 'NSApp with wrong _running count'
+     */
+    dispatch_sync(dispatch_get_main_queue(), ^{
+        if (NSAlertDefaultReturn == NSRunAlertPanel(title, msg, NSLocalizedString(@"Quit", @""),
+                                                    NSLocalizedString (@"Report...", @""), nil)) {
+            exit(EXIT_FAILURE);
+        }
+    });
+
+    /* fall back to caller to do the abort() in the DIX */
+#endif
+}
+
+
 static void
-check_xinitrc(void)
+check_xinitrc (void)
 {
     char *tem, buf[1024];
     NSString *msg;
diff --git a/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings
index bf2089c..36ae0ff 100644
Binary files a/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings and b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings differ
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 3dd41cb..f9acf90 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -78,6 +78,8 @@
 #include "quartzKeyboard.h"
 #include "quartz.h"
 
+#include "X11Application.h"
+
 aslclient aslc;
 
 void
@@ -636,7 +638,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
 void
 OsVendorFatalError(const char *f, va_list args)
 {
-    ErrorF("   OsVendorFatalError\n");
+    X11ApplicationFatalError(f, args);
 }
 
 /*
commit ac4b1665e859fe0a41e7d6207969f2373da4c2dc
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Feb 17 12:35:02 2012 -0800

    os: Pass the FatalError message to OsVendorFatalError
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 09e3d74..5804353 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -905,7 +905,7 @@ OsVendorInit(void)
  * two routines mentioned here, as well as by others) to use the
  * referenced routine instead of \a vfprintf().) */
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 }
 
diff --git a/hw/dmx/dmxlog.c b/hw/dmx/dmxlog.c
index b56bb93..33aee59 100644
--- a/hw/dmx/dmxlog.c
+++ b/hw/dmx/dmxlog.c
@@ -110,9 +110,6 @@ VFatalError(const char *format, va_list args)
 {
     VErrorF(format, args);
     ErrorF("\n");
-#ifdef DDXOSFATALERROR
-    OsVendorFatalError();
-#endif
     AbortServer();
  /*NOTREACHED*/}
 #endif
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index f65ab96..ecdae19 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -1104,7 +1104,7 @@ KdInitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 }
 
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index 2d679a5..e2cd96c 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -219,7 +219,7 @@ OsVendorInit(void)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 }
 
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 0974893..2a7d0a3 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1053,7 +1053,7 @@ AbortDDX(enum ExitCode error)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 #ifdef VENDORSUPPORT
     ErrorF("\nPlease refer to your Operating System Vendor support pages\n"
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index 0909826..330b8ca 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -142,7 +142,7 @@ OsVendorInit(void)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
     return;
 }
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 29036fc..3dd41cb 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -634,7 +634,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
  * OsVendorFatalError
  */
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
     ErrorF("   OsVendorFatalError\n");
 }
diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c
index 4049e97..a25307c 100644
--- a/hw/xwin/winerror.c
+++ b/hw/xwin/winerror.c
@@ -70,7 +70,7 @@ OsVendorVErrorF(const char *pszFormat, va_list va_args)
  * Attempt to do last-ditch, safe, important cleanup here.
  */
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
     /* Don't give duplicate warning if UseMsg was called */
     if (g_fSilentFatalError)
diff --git a/include/os.h b/include/os.h
index dd06a85..166c60c 100644
--- a/include/os.h
+++ b/include/os.h
@@ -321,7 +321,7 @@ extern _X_EXPORT void
 OsCleanup(Bool);
 
 extern _X_EXPORT void
-OsVendorFatalError(void);
+OsVendorFatalError(const char *f, va_list args);
 
 extern _X_EXPORT void
 OsVendorInit(void);
diff --git a/os/log.c b/os/log.c
index 1b1b285..d6ebbbd 100644
--- a/os/log.c
+++ b/os/log.c
@@ -593,6 +593,7 @@ void
 FatalError(const char *f, ...)
 {
     va_list args;
+    va_list args2;
     static Bool beenhere = FALSE;
 
     if (beenhere)
@@ -600,22 +601,25 @@ FatalError(const char *f, ...)
     else
         ErrorF("\nFatal server error:\n");
 
-    va_start(args, f);
+    /* Make a copy for OsVendorFatalError */
+    va_copy(args2, args);
+
 #ifdef __APPLE__
     {
-        va_list args2;
+        va_list apple_args;
 
-        va_copy(args2, args);
-        (void) vsnprintf(__crashreporter_info_buff__,
-                         sizeof(__crashreporter_info_buff__), f, args2);
-        va_end(args2);
+        va_copy(apple_args, args);
+        (void)vsnprintf(__crashreporter_info_buff__,
+                        sizeof(__crashreporter_info_buff__), f, apple_args);
+        va_end(apple_args);
     }
 #endif
     VErrorF(f, args);
     va_end(args);
     ErrorF("\n");
     if (!beenhere)
-        OsVendorFatalError();
+	OsVendorFatalError(f, args2);
+    va_end(args2);
     if (!beenhere) {
         beenhere = TRUE;
         AbortServer();
diff --git a/test/ddxstubs.c b/test/ddxstubs.c
index a214b96..3647dc5 100644
--- a/test/ddxstubs.c
+++ b/test/ddxstubs.c
@@ -50,7 +50,7 @@ OsVendorInit(void)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 }
 
commit 15208f13f427a0406b57d216ea5c98e79871cd6c
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue Mar 13 00:15:55 2012 -0700

    XQuartz: Add a defaults option to disable the RENDER extension
    
    RENDER has some ugly issues on XQuartz, so add an option to disable RENDER.
    
    Enables workaround for: https://bugs.freedesktop.org/show_bug.cgi?id=26124
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index bdbe6ac..5680686 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -126,6 +126,7 @@ X11ApplicationMain(int argc, char **argv, char **envp);
 #define PREFS_APPKIT_MODIFIERS      "appkit_modifiers"
 #define PREFS_WINDOW_ITEM_MODIFIERS "window_item_modifiers"
 #define PREFS_ROOTLESS              "rootless"
+#define PREFS_RENDER_EXTENSION      "enable_render_extension"
 #define PREFS_TEST_EXTENSIONS       "enable_test_extensions"
 #define PREFS_XP_OPTIONS            "xp_options"
 #define PREFS_LOGIN_SHELL           "login_shell"
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index e091fbb..d01f341 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -69,6 +69,7 @@ static dispatch_queue_t eventTranslationQueue;
 #endif
 
 extern Bool noTestExtensions;
+extern Bool noRenderExtension;
 
 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 static TISInputSourceRef last_key_layout;
@@ -877,20 +878,23 @@ NULL];
         }
     }
 
-XQuartzEnableKeyEquivalents =[self prefs_get_boolean: @PREFS_KEYEQUIVS default:
-XQuartzEnableKeyEquivalents];
-
-darwinSyncKeymap =[self prefs_get_boolean: @PREFS_SYNC_KEYMAP default:
-darwinSyncKeymap];
-
-darwinDesiredDepth =[self prefs_get_integer: @PREFS_DEPTH default:
-darwinDesiredDepth];
-
-noTestExtensions = ![self prefs_get_boolean: @PREFS_TEST_EXTENSIONS default:
-FALSE];
-
-XQuartzScrollInDeviceDirection =[self prefs_get_boolean: @PREFS_SCROLL_IN_DEV_DIRECTION default:
-XQuartzScrollInDeviceDirection];
+    XQuartzEnableKeyEquivalents = [self prefs_get_boolean:@PREFS_KEYEQUIVS
+                                              default:XQuartzEnableKeyEquivalents];
+	
+    darwinSyncKeymap = [self prefs_get_boolean:@PREFS_SYNC_KEYMAP
+                                       default:darwinSyncKeymap];
+		
+    darwinDesiredDepth = [self prefs_get_integer:@PREFS_DEPTH
+                                         default:darwinDesiredDepth];
+    
+    noTestExtensions = ![self prefs_get_boolean:@PREFS_TEST_EXTENSIONS
+                                        default:FALSE];
+    
+    noRenderExtension = ![self prefs_get_boolean:@PREFS_RENDER_EXTENSION
+                                        default:TRUE];
+    
+    XQuartzScrollInDeviceDirection = [self prefs_get_boolean:@PREFS_SCROLL_IN_DEV_DIRECTION
+                                                     default:XQuartzScrollInDeviceDirection];
 
 #if XQUARTZ_SPARKLE
 NSURL *url =[self prefs_copy_url: @PREFS_UPDATE_FEED default:
commit 83d357bc9330227ac6f3c6d8dd0efb084786b8b0
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Mar 17 00:04:27 2012 -0700

    XQuartz: Use doubles for input valuators
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index cf29a7b..053f404 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -430,10 +430,12 @@ DarwinPokeEQ(void)
  *       display.
  */
 static void
-DarwinPrepareValuators(DeviceIntPtr pDev, int *valuators, ScreenPtr screen,
-                       float pointer_x, float pointer_y,
-                       float pressure, float tilt_x, float tilt_y)
+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;
@@ -445,26 +447,19 @@ DarwinPrepareValuators(DeviceIntPtr pDev, int *valuators, ScreenPtr screen,
         pointer_y = 0.0;
 
     if (pDev == darwinPointer) {
-        valuators[0] = pointer_x;
-        valuators[1] = pointer_y;
-        valuators[2] = 0;
-        valuators[3] = 0;
-        valuators[4] = 0;
-    }
-    else {
-        /* Setup our array of values */
-        valuators[0] =
-            XQUARTZ_VALUATOR_LIMIT * (pointer_x /
-                                      (float) screenInfo.screens[0]->width);
-        valuators[1] =
-            XQUARTZ_VALUATOR_LIMIT * (pointer_y /
-                                      (float) screenInfo.screens[0]->height);
-        valuators[2] = XQUARTZ_VALUATOR_LIMIT * pressure;
-        valuators[3] = XQUARTZ_VALUATOR_LIMIT * tilt_x;
-        valuators[4] = XQUARTZ_VALUATOR_LIMIT * tilt_y;
+        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 (%f, %f), Valuators: {%d,%d,%d,%d,%d}\n", pointer_x, pointer_y,
-    //          valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]);
+    //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
@@ -497,12 +492,12 @@ DarwinInputReleaseButtonsAndKeys(DeviceIntPtr pDev)
 
 void
 DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
-                        float pointer_x, float pointer_y, float pressure,
-                        float tilt_x, float tilt_y)
+                        double pointer_x, double pointer_y, double pressure,
+                        double tilt_x, double tilt_y)
 {
     static int darwinFakeMouseButtonDown = 0;
     ScreenPtr screen;
-    int valuators[5];
+    ValuatorMask valuators;
 
     //DEBUG_LOG("x=%f, y=%f, p=%f, tx=%f, ty=%f\n", pointer_x, pointer_y, pressure, tilt_x, tilt_y);
 
@@ -559,14 +554,10 @@ DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
         darwinFakeMouseButtonDown = 0;
     }
 
-    DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y,
+    DarwinPrepareValuators(pDev, &valuators, screen, pointer_x, pointer_y,
                            pressure, tilt_x, tilt_y);
     darwinEvents_lock(); {
-        ValuatorMask mask;
-
-        valuator_mask_set_range(&mask, 0, (pDev == darwinPointer) ? 2 : 5,
-                                valuators);
-        QueuePointerEvents(pDev, ev_type, ev_button, POINTER_ABSOLUTE, &mask);
+        QueuePointerEvents(pDev, ev_type, ev_button, POINTER_ABSOLUTE, &valuators);
         DarwinPokeEQ();
     } darwinEvents_unlock();
 }
@@ -590,12 +581,12 @@ DarwinSendKeyboardEvents(int ev_type, int keycode)
 }
 
 void
-DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, float pointer_x,
-                          float pointer_y, float pressure, float tilt_x,
-                          float tilt_y)
+DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, double pointer_x,
+                          double pointer_y, double pressure, double tilt_x,
+                          double tilt_y)
 {
     ScreenPtr screen;
-    int valuators[5];
+    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);
@@ -613,54 +604,50 @@ DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, float pointer_x,
         return;
     }
 
-    DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y,
+    DarwinPrepareValuators(pDev, &valuators, screen, pointer_x, pointer_y,
                            pressure, tilt_x, tilt_y);
     darwinEvents_lock(); {
-        ValuatorMask mask;
-
-        valuator_mask_set_range(&mask, 0, 5, valuators);
-        QueueProximityEvents(pDev, ev_type, &mask);
+        QueueProximityEvents(pDev, ev_type, &valuators);
         DarwinPokeEQ();
     } darwinEvents_unlock();
 }
 
 /* Send the appropriate number of button clicks to emulate scroll wheel */
 void
-DarwinSendScrollEvents(float count_x, float count_y,
-                       float pointer_x, float pointer_y,
-                       float pressure, float tilt_x, float tilt_y)
+DarwinSendScrollEvents(double scroll_x, double scroll_y, double pointer_x,
+                       double pointer_y, double pressure, double tilt_x,
+                       double tilt_y)
 {
     int sign_x, sign_y;
-
     if (!darwinEvents) {
-        DEBUG_LOG
-            ("DarwinSendScrollEvents called before darwinEvents was initialized\n");
+        DEBUG_LOG("DarwinSendScrollEvents called before darwinEvents was initialized\n");
         return;
     }
 
-    sign_x = count_x > 0.0f ? SCROLLWHEELLEFTFAKE : SCROLLWHEELRIGHTFAKE;
-    sign_y = count_y > 0.0f ? SCROLLWHEELUPFAKE : SCROLLWHEELDOWNFAKE;
-    count_x = fabs(count_x);
-    count_y = fabs(count_y);
+    sign_x = scroll_x > 0.0f ? SCROLLWHEELLEFTFAKE : SCROLLWHEELRIGHTFAKE;
+    sign_y = scroll_y > 0.0f ? SCROLLWHEELUPFAKE : SCROLLWHEELDOWNFAKE;
+    scroll_x = fabs(scroll_x);
+    scroll_y = fabs(scroll_y);
 
-    while ((count_x > 0.0f) || (count_y > 0.0f)) {
-        if (count_x > 0.0f) {
+    while ((scroll_x > 0.0f) || (scroll_y > 0.0f)) {
+        if (scroll_x > 0.0f) {
             DarwinSendPointerEvents(darwinPointer, ButtonPress, sign_x,
-                                    pointer_x, pointer_y, pressure, tilt_x,
-                                    tilt_y);
+                                    pointer_x, pointer_y, pressure,
+                                    tilt_x, tilt_y);
             DarwinSendPointerEvents(darwinPointer, ButtonRelease, sign_x,
-                                    pointer_x, pointer_y, pressure, tilt_x,
-                                    tilt_y);
-            count_x = count_x - 1.0f;
+                                    pointer_x, pointer_y, pressure,
+                                    tilt_x, tilt_y);
+            scroll_x = scroll_x - 1.0f;
         }
-        if (count_y > 0.0f) {
-            DarwinSendPointerEvents(darwinPointer, ButtonPress, sign_y,
-                                    pointer_x, pointer_y, pressure, tilt_x,
-                                    tilt_y);
+
+        if (scroll_y > 0.0f) {
+            DarwinSendPointerEvents(darwinPointer, ButtonPress, sign_y, 
+                                    pointer_x, pointer_y, pressure,
+                                    tilt_x, tilt_y);
             DarwinSendPointerEvents(darwinPointer, ButtonRelease, sign_y,
-                                    pointer_x, pointer_y, pressure, tilt_x,
-                                    tilt_y);
-            count_y = count_y - 1.0f;
+                                    pointer_x, pointer_y, pressure,
+                                    tilt_x, tilt_y);
+            scroll_y = scroll_y - 1.0f;
         }
     }
 }
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 515dd30..b8660a6 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -38,15 +38,15 @@ void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
 void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
 void DarwinInputReleaseButtonsAndKeys(DeviceIntPtr pDev);
 void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
-                             float pointer_x, float pointer_y, float pressure,
-                             float tilt_x, float tilt_y);
-void DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, float pointer_x,
-                               float pointer_y, float pressure, float tilt_x,
-                               float tilt_y);
+                             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);
 void DarwinSendKeyboardEvents(int ev_type, int keycode);
-void DarwinSendScrollEvents(float count_x, float count_y, float pointer_x,
-                            float pointer_y, float pressure, float tilt_x,
-                            float tilt_y);
+void DarwinSendScrollEvents(double scroll_x, double scroll_y, double pointer_x,
+                            double pointer_y, double pressure, double tilt_x,
+                            double tilt_y);
 void DarwinUpdateModKeys(int flags);
 void DarwinListenOnOpenFD(int fd);
 
commit cea9ea43f4e90b2974a179b8f18217034ff848ed
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Mar 17 00:08:19 2012 -0700

    XQuartz: Xi: darwinPointer is now Relative
    
    There is really no real reason why this should be necessary, but wine
    developers are stuborn, so doing this to try to work around this wine
    issue:
    
    http://bugs.winehq.org/show_bug.cgi?id=29732
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 2e5285a..29036fc 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -336,9 +336,9 @@ DarwinMouseProc(DeviceIntPtr pPointer, int what)
                                 (PtrCtrlProcPtr) NoopDDA,
                                 GetMotionHistorySize(), NAXES, axes_labels);
         InitValuatorAxisStruct(pPointer, 0, axes_labels[0], NO_AXIS_LIMITS,
-                               NO_AXIS_LIMITS, 0, 0, 0, Absolute);
+                               NO_AXIS_LIMITS, 1, 0, 1, Relative);
         InitValuatorAxisStruct(pPointer, 1, axes_labels[1], NO_AXIS_LIMITS,
-                               NO_AXIS_LIMITS, 0, 0, 0, Absolute);
+                               NO_AXIS_LIMITS, 1, 0, 1, Relative);
         break;
     case DEVICE_ON:
         pPointer->public.on = TRUE;


More information about the Xquartz-changes mailing list