From 858a890046718bc5387f4f2d8597cc28f4b2c899 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 14 Jul 2013 17:11:20 -0600 Subject: [PATCH] fix for `get-current-mouse-state' on Mac OS X 10.5 and earlier It looks like button-press information is not available on 10.5 and earlier, so so try to report it in that case. Closes PR 13780 original commit: d695e8a15afff1da7c3306a717ef7d102483873f --- .../gui-doc/scribblings/gui/miscwin-funcs.scrbl | 10 +++++++--- pkgs/gui-pkgs/gui-lib/mred/private/wx/cocoa/procs.rkt | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pkgs/gui-pkgs/gui-doc/scribblings/gui/miscwin-funcs.scrbl b/pkgs/gui-pkgs/gui-doc/scribblings/gui/miscwin-funcs.scrbl index a777274f..6dfa5163 100644 --- a/pkgs/gui-pkgs/gui-doc/scribblings/gui/miscwin-funcs.scrbl +++ b/pkgs/gui-pkgs/gui-doc/scribblings/gui/miscwin-funcs.scrbl @@ -198,9 +198,13 @@ break is sent (via @racket[break-thread]) to the created eventspace's (listof (or/c 'left 'middle 'right 'shift 'control 'alt 'meta 'caps)))]{ -Returns the current location of the mouse in screen coordinates, -and returns a list of symbols for mouse buttons and modifier keys -that are currently pressed.} +@margin-note{On Mac OS X 10.5 and earlier, mouse-button information is +not available, so the second result includes only symbols for modifier +keys.} + +Returns the current location of the mouse in screen coordinates, and +returns a list of symbols for mouse buttons and modifier keys that are +currently pressed.} @defproc[(hide-cursor-until-moved) void?]{ diff --git a/pkgs/gui-pkgs/gui-lib/mred/private/wx/cocoa/procs.rkt b/pkgs/gui-pkgs/gui-lib/mred/private/wx/cocoa/procs.rkt index 63a656ec..30643555 100644 --- a/pkgs/gui-pkgs/gui-lib/mred/private/wx/cocoa/procs.rkt +++ b/pkgs/gui-pkgs/gui-lib/mred/private/wx/cocoa/procs.rkt @@ -200,7 +200,9 @@ (define (get-current-mouse-state) (define posn (tell #:type _NSPoint NSEvent mouseLocation)) - (define buttons (tell #:type _NSUInteger NSEvent pressedMouseButtons)) + (define buttons (if (version-10.6-or-later?) + (tell #:type _NSUInteger NSEvent pressedMouseButtons) + 0)) (define mods (tell #:type _NSUInteger NSEvent modifierFlags)) (define (maybe v mask sym) (if (zero? (bitwise-and v mask))