changeset 950:73ff2daed8ca

Attempt at fixing mouse button detection on Leopard for Mac.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 01 May 2011 03:31:40 +0000
parents 451c71b7fdb1
children 7193401d139a
files mac/dw.m
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Sun May 01 01:10:44 2011 +0000
+++ b/mac/dw.m	Sun May 01 03:31:40 2011 +0000
@@ -119,6 +119,7 @@
 #endif
 pthread_key_t _dw_fg_color_key;
 pthread_key_t _dw_bg_color_key;
+SInt32 DWOSMajor, DWOSMinor, DWOSBuild;
 
 /* Create a default colors for a thread */
 void _init_colors(void)
@@ -280,9 +281,14 @@
             case 5:
             {
                 int (* API motionfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction;
-                int buttonmask = (int)[NSEvent pressedMouseButtons];
+                int buttonmask = DWOSMinor > 5 ? (int)[NSEvent pressedMouseButtons] : 0;
                 id view = [[[event window] contentView] superview];
                 NSPoint p = [view convertPoint:[event locationInWindow] toView:object];
+                
+                if(DWOSMinor < 6)
+                {
+                    buttonmask = (1 << [event buttonNumber]);
+                }
 
                 return motionfunc(object, (int)p.x, (int)[object frame].size.height - p.y, buttonmask, handler->data);
             }
@@ -429,7 +435,6 @@
 HMTX DWThreadMutex2;
 DWTID DWThread = (DWTID)-1;
 DWTID _dw_mutex_locked = (DWTID)-1;
-SInt32 DWOSMajor, DWOSMinor, DWOSBuild;
 
 /* Used for doing bitblts from the main thread */
 typedef struct _bitbltinfo