Resolved Workaround for [NSEvent eventRef] on Tiger

Discussion in 'Mac Programming' started by asiga, Dec 23, 2015.

  1. asiga macrumors 6502

    Joined:
    Nov 4, 2012
    #1
    Hi,

    I'm trying to correctly respond to both "traditional mouse wheel" events and Mighty Mouse ("scroll ball") events from an application that runs on 10.4 Tiger (yes, old, but it has to run on Tiger, sorry).

    By taking a look at how wxWidgets does it (lines 519-541 from http://trac.wxwidgets.org/browser/svn-wx/wxWidgets/trunk/src/osx/cocoa/window.mm?rev=63370 ), I see they get the Carbon event from the NSEvent by using its eventRef, and then they check it with kEventMouseScroll in order to see if it's a scroll wheel or a scroll ball.

    Unfortunately, eventRef was introduced in 10.5 Leopard. And, unfortunately, I get errors if I try to access deviceDeltaX and deviceDeltaY if the event didn't came from an scroll ball. So, I need to check whether the event came from a scroll wheel or a scroll ball, so that I know if I need to access deltaX/deltaY or deviceDeltaX/deviceDeltaY.

    Any suggestions on how can I achieve this on Tiger?

    Thanks a lot!
     
  2. asiga thread starter macrumors 6502

    Joined:
    Nov 4, 2012
    #2
    Nevermind, after deeper search, I found there's an undocumented '_eventRef' that works fine on 10.4. It was renamed to 'eventRef' on 10.5 (and turned to be documented too).
     

Share This Page