1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/corefoundation/joystick.cpp
3 // Purpose: wxJoystick class
8 // Copyright: (c) Ryan Norton
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 //===========================================================================
14 //===========================================================================
16 //---------------------------------------------------------------------------
17 // Pre-compiled header stuff
18 //---------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
23 //---------------------------------------------------------------------------
25 //---------------------------------------------------------------------------
27 //we only support HID on OSX (DARWIN), since it requires DARWIN...
28 #if wxUSE_JOYSTICK && wxUSE_THREADS
30 //---------------------------------------------------------------------------
32 //---------------------------------------------------------------------------
36 #include "wx/event.h" //joystick wxEvents
37 #include "wx/window.h" //for wxWindow to "capture" joystick
40 #include "wx/joystick.h" //...
41 #include "wx/thread.h" //wxThread for polling thread/ wxCriticalSection
44 #include "wx/osx/core/hid.h" //private mac hid stuff
47 #include <CoreServices/CoreServices.h>
48 #include <mach/mach.h>
49 #include <mach/mach_time.h>
52 //---------------------------------------------------------------------------
53 // Definitions/Enumerations
54 //---------------------------------------------------------------------------
56 #define wxJS_MAX_AXES 10 /*max number of axes*/
57 #define wxJS_MAX_BUTTONS 40 /*max number of buttons*/
61 //These are positions within the cookie array
62 //in wxHIDJoystick that the cookies that store the axis' are
71 //---------------------------------------------------------------------------
73 //---------------------------------------------------------------------------
74 class wxHIDJoystick
: public wxHIDDevice
78 virtual ~wxHIDJoystick();
80 bool Create(int nWhich
);
81 virtual void BuildCookies(CFArrayRef Array
);
82 void MakeCookies(CFArrayRef Array
);
83 IOHIDElementCookie
* GetCookies();
84 IOHIDQueueInterface
** GetQueue();
86 int m_nXMax
, m_nYMax
, m_nZMax
, m_nRudderMax
, m_nUMax
, m_nVMax
,
87 m_nXMin
, m_nYMin
, m_nZMin
, m_nRudderMin
, m_nUMin
, m_nVMin
;
89 friend class wxJoystick
;
92 //---------------------------------------------------------------------------
94 //---------------------------------------------------------------------------
95 class wxJoystickThread
: public wxThread
98 wxJoystickThread(wxHIDJoystick
* hid
, int joystick
);
100 static void HIDCallback(void* target
, IOReturn res
, void* context
, void* sender
);
103 wxHIDJoystick
* m_hid
;
105 wxPoint m_lastposition
;
106 int m_axe
[wxJS_MAX_AXES
];
108 wxWindow
* m_catchwin
;
111 friend class wxJoystick
;
114 //===========================================================================
116 //===========================================================================
118 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
119 // wxGetIntFromCFDictionary
121 // Helper function that gets a integer from a dictionary key
122 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
123 void wxGetIntFromCFDictionary(CFTypeRef cfDict
, CFStringRef key
, int* pOut
)
126 (CFNumberRef
) CFDictionaryGetValue((CFDictionaryRef
) cfDict
,
128 kCFNumberIntType
, pOut
);
131 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
135 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
137 IMPLEMENT_DYNAMIC_CLASS(wxJoystick
, wxObject
)
139 //---------------------------------------------------------------------------
140 // wxJoystick Constructor
142 // 1) Initializes member variables
143 // 2) Attempts to create the native HID joystick implementation - if none
144 // could be found (no joysticks, etc.) then it sets it to NULL
145 //---------------------------------------------------------------------------
146 wxJoystick::wxJoystick(int joystick
)
147 : m_joystick(joystick
),
150 m_hid
= new wxHIDJoystick();
152 if (m_hid
->Create(m_joystick
+1)) //wxHIDDevice is 1-based while this is 0
154 m_thread
= new wxJoystickThread(m_hid
, m_joystick
);
165 //---------------------------------------------------------------------------
166 // wxJoystick Destructor
168 // Releases the capture of the thread, deletes it, and deletes
169 // the native implementation.
170 //---------------------------------------------------------------------------
171 wxJoystick::~wxJoystick()
175 m_thread
->Delete(); // It's detached so it will delete itself
180 //---------------------------------------------------------------------------
181 // wxJoystick::Get[XXX]Position
183 // Returns the value of an axis that was polled from the thread. In the
184 // case of GetPosition returns the X and Y values in a wxPoint
185 //---------------------------------------------------------------------------
186 wxPoint
wxJoystick::GetPosition() const
188 wxPoint
pos(wxDefaultPosition
);
189 if (m_thread
) pos
= m_thread
->m_lastposition
;
192 int wxJoystick::GetZPosition() const
195 return m_thread
->m_axe
[wxJS_AXIS_Z
];
198 int wxJoystick::GetRudderPosition() const
201 return m_thread
->m_axe
[wxJS_AXIS_RUDDER
];
204 int wxJoystick::GetUPosition() const
207 return m_thread
->m_axe
[wxJS_AXIS_U
];
210 int wxJoystick::GetVPosition() const
213 return m_thread
->m_axe
[wxJS_AXIS_V
];
217 //---------------------------------------------------------------------------
218 // wxJoystick::GetButtonState
220 // Returns the state of the buttons in a bitmask as dictated by the
221 // wx manual (the real work takes place in the thread, as always)
222 //---------------------------------------------------------------------------
223 int wxJoystick::GetButtonState() const
226 return m_thread
->m_buttons
;
230 //---------------------------------------------------------------------------
233 // Returns whether the joystick initialized successfully - in this case
234 // if the native implementation doesn't exist (in constructor)
235 //---------------------------------------------------------------------------
236 bool wxJoystick::IsOk() const
238 return m_hid
!= NULL
;
241 //---------------------------------------------------------------------------
242 // wxJoystick::Get[XXX](Id/Name)
244 // Simple accessors to the native HID implementation
245 //---------------------------------------------------------------------------
246 int wxJoystick::GetManufacturerId() const
248 return m_hid
->m_nManufacturerId
;
251 int wxJoystick::GetProductId() const
253 return m_hid
->m_nProductId
;
256 wxString
wxJoystick::GetProductName() const
258 return m_hid
->m_szProductName
;
261 //---------------------------------------------------------------------------
262 // wxJoystick::GetNumberButtons
263 // wxJoystick::GetNumberAxes
265 // Queries the joystick for an active number of buttons/axes.
267 // In the native HID implementation, the cookies:
268 // 0-40 are the buttons of the joystick
269 // 40-50 are the axes of the joystick
271 // These just query the native HID implementation as above.
272 //---------------------------------------------------------------------------
273 int wxJoystick::GetNumberButtons() const
277 for(int nIndex
= 0; nIndex
< 40; ++nIndex
)
279 if(m_hid
->HasElement(nIndex
))
285 int wxJoystick::GetNumberAxes() const
289 for(int nIndex
= 40; nIndex
< 50; ++nIndex
)
291 if(m_hid
->HasElement(nIndex
))
298 //---------------------------------------------------------------------------
299 // wxJoystick::GetNumberJoysticks
301 // Gets the number of joysticks on the system. In HID that
302 // is all devices with the kHIDUsage_GD_Joystick or kHIDUsage_GD_GamePad
304 //---------------------------------------------------------------------------
305 int wxJoystick::GetNumberJoysticks()
308 wxHIDDevice::GetCount(kHIDPage_GenericDesktop
, kHIDUsage_GD_Joystick
) +
309 wxHIDDevice::GetCount(kHIDPage_GenericDesktop
, kHIDUsage_GD_GamePad
);
312 //---------------------------------------------------------------------------
313 // wxJoystick::SetCapture
315 // Stops sending events from the thread to the window set in
316 // SetCapture and stops polling the joystick
317 //---------------------------------------------------------------------------
318 bool wxJoystick::SetCapture(wxWindow
* win
, int pollingFreq
)
322 m_thread
->m_catchwin
= win
;
323 m_thread
->m_polling
= pollingFreq
;
329 //---------------------------------------------------------------------------
330 // wxJoystick::ReleaseCapture
332 // Stops sending events from the thread to the window set in
333 // SetCapture and stops polling the joystick
334 //---------------------------------------------------------------------------
335 bool wxJoystick::ReleaseCapture()
339 m_thread
->m_catchwin
= NULL
;
340 m_thread
->m_polling
= 0;
346 //---------------------------------------------------------------------------
347 // wxJoystick::Get[XXX]
349 // Gets the minimum and maximum values for each axis, returning 0 if the
350 // axis doesn't exist.
351 //---------------------------------------------------------------------------
352 int wxJoystick::GetXMin() const
354 return m_hid
->m_nXMin
;
357 int wxJoystick::GetYMin() const
359 return m_hid
->m_nYMin
;
362 int wxJoystick::GetZMin() const
364 return m_hid
->m_nZMin
;
367 int wxJoystick::GetRudderMin() const
369 return m_hid
->m_nRudderMin
;
372 int wxJoystick::GetUMin() const
374 return m_hid
->m_nUMin
;
377 int wxJoystick::GetVMin() const
379 return m_hid
->m_nVMin
;
382 int wxJoystick::GetXMax() const
384 return m_hid
->m_nXMax
;
387 int wxJoystick::GetYMax() const
389 return m_hid
->m_nYMax
;
392 int wxJoystick::GetZMax() const
394 return m_hid
->m_nZMax
;
397 int wxJoystick::GetRudderMax() const
399 return m_hid
->m_nRudderMax
;
402 int wxJoystick::GetUMax() const
404 return m_hid
->m_nUMax
;
407 int wxJoystick::GetVMax() const
409 return m_hid
->m_nVMax
;
412 //---------------------------------------------------------------------------
413 // wxJoystick::Get[XXX]
415 // Min/Max values for buttons, axes, etc.. Polling in this case is just
416 // what the linux port has.
417 //---------------------------------------------------------------------------
418 int wxJoystick::GetMaxButtons() const
420 return wxJS_MAX_BUTTONS
;
423 int wxJoystick::GetMaxAxes() const
425 return wxJS_MAX_AXES
;
428 int wxJoystick::GetPollingMin() const
433 int wxJoystick::GetPollingMax() const
438 //---------------------------------------------------------------------------
439 // wxJoystick::Has[XXX]
441 // Just queries the native hid implementation if the cookie was found
442 // when enumerating the cookies of the joystick device
443 //---------------------------------------------------------------------------
444 bool wxJoystick::HasZ() const
446 return m_hid
->HasElement(wxJS_AXIS_Z
);
449 bool wxJoystick::HasRudder() const
451 return m_hid
->HasElement(wxJS_AXIS_RUDDER
);
454 bool wxJoystick::HasU() const
456 return m_hid
->HasElement(wxJS_AXIS_U
);
459 bool wxJoystick::HasV() const
461 return m_hid
->HasElement(wxJS_AXIS_V
);
464 //---------------------------------------------------------------------------
466 //---------------------------------------------------------------------------
467 int wxJoystick::GetPOVPosition() const
472 int wxJoystick::GetPOVCTSPosition() const
477 int wxJoystick::GetMovementThreshold() const
482 void wxJoystick::SetMovementThreshold(int WXUNUSED(threshold
))
486 bool wxJoystick::HasPOV() const
491 bool wxJoystick::HasPOV4Dir() const
496 bool wxJoystick::HasPOVCTS() const
501 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
505 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
507 //---------------------------------------------------------------------------
508 // wxHIDJoystick ctor
510 // Initializes the min/max members
511 //---------------------------------------------------------------------------
512 wxHIDJoystick::wxHIDJoystick() :
513 m_nXMax(0), m_nYMax(0), m_nZMax(0), m_nRudderMax(0), m_nUMax(0), m_nVMax(0),
514 m_nXMin(0), m_nYMin(0), m_nZMin(0), m_nRudderMin(0), m_nUMin(0), m_nVMin(0)
518 //---------------------------------------------------------------------------
519 // wxHIDJoystick dtor
522 //---------------------------------------------------------------------------
523 wxHIDJoystick::~wxHIDJoystick()
527 //---------------------------------------------------------------------------
528 // wxHIDJoystick::Create
530 // Creates the native HID device (joysticks are of either
531 // kHIDUsage_GD_Joystick or kHIDUsage_GD_GamePad)
532 //---------------------------------------------------------------------------
533 bool wxHIDJoystick::Create(int nWhich
)
535 int nJoysticks
= GetCount(kHIDPage_GenericDesktop
, kHIDUsage_GD_Joystick
);
537 if (nWhich
<= nJoysticks
)
538 return wxHIDDevice::Create(kHIDPage_GenericDesktop
,
539 kHIDUsage_GD_Joystick
,
542 nWhich
-= nJoysticks
;
544 int nGamePads
= GetCount(kHIDPage_GenericDesktop
, kHIDUsage_GD_GamePad
);
546 if (nWhich
<= nGamePads
)
547 return wxHIDDevice::Create(kHIDPage_GenericDesktop
,
548 kHIDUsage_GD_GamePad
,
554 //---------------------------------------------------------------------------
555 // wxHIDJoystick::BuildCookies
556 // wxHIDJoystick::MakeCookies
558 // Sets up the cookies for the HID device (called from Create) - as
559 // mentioned 0-40 are the buttons and 40-50 are the axes.
561 // MakeCookies is just a recursive function for each array within
563 //---------------------------------------------------------------------------
564 void wxHIDJoystick::BuildCookies(CFArrayRef Array
)
566 InitCookies(50, true);
569 // I wasted two hours of my life on this line :(
570 // accidently removed it during some source cleaning...
574 //paranoid debugging stuff
576 for(int i
= 0; i
< 50; ++i
)
577 wxPrintf(wxT("\nVAL #%i:[%i]"), i
, m_pCookies
[i
]);
581 void wxHIDJoystick::MakeCookies(CFArrayRef Array
)
583 int i
, nUsage
, nPage
;
585 for (i
= 0; i
< CFArrayGetCount(Array
); ++i
)
587 const void* ref
= CFDictionaryGetValue(
588 (CFDictionaryRef
)CFArrayGetValueAtIndex(Array
, i
),
589 CFSTR(kIOHIDElementKey
)
594 MakeCookies((CFArrayRef
) ref
);
600 CFDictionaryGetValue(
601 (CFDictionaryRef
) CFArrayGetValueAtIndex(Array
, i
),
602 CFSTR(kIOHIDElementUsageKey
)
609 CFDictionaryGetValue(
610 (CFDictionaryRef
) CFArrayGetValueAtIndex(Array
, i
),
611 CFSTR(kIOHIDElementUsagePageKey
)
617 wxLogSysError(wxT("[%i][%i]"), nUsage
, nPage
);
619 if (nPage
== kHIDPage_Button
&& nUsage
<= 40)
620 AddCookieInQueue(CFArrayGetValueAtIndex(Array
, i
), nUsage
-1 );
621 else if (nPage
== kHIDPage_GenericDesktop
)
627 AddCookieInQueue(CFArrayGetValueAtIndex(Array
, i
), wxJS_AXIS_X
);
628 wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array
, i
),
629 CFSTR(kIOHIDElementMaxKey
),
631 wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array
, i
),
632 CFSTR(kIOHIDElementMinKey
),
636 AddCookieInQueue(CFArrayGetValueAtIndex(Array
, i
), wxJS_AXIS_Y
);
637 wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array
, i
),
638 CFSTR(kIOHIDElementMaxKey
),
640 wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array
, i
),
641 CFSTR(kIOHIDElementMinKey
),
645 AddCookieInQueue(CFArrayGetValueAtIndex(Array
, i
), wxJS_AXIS_Z
);
646 wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array
, i
),
647 CFSTR(kIOHIDElementMaxKey
),
649 wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array
, i
),
650 CFSTR(kIOHIDElementMinKey
),
657 else if (nPage
== kHIDPage_Simulation
&& nUsage
== kHIDUsage_Sim_Rudder
)
660 AddCookieInQueue(CFArrayGetValueAtIndex(Array
, i
), wxJS_AXIS_RUDDER
);
661 wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array
, i
),
662 CFSTR(kIOHIDElementMaxKey
),
664 wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array
, i
),
665 CFSTR(kIOHIDElementMinKey
),
672 //---------------------------------------------------------------------------
673 // wxHIDJoystick::Get[XXX]
675 // Simple accessors so that the HID callback and the thread procedure
676 // can access members from wxHIDDevice (our parent here).
677 //---------------------------------------------------------------------------
678 IOHIDElementCookie
* wxHIDJoystick::GetCookies()
679 { return m_pCookies
; }
680 IOHIDQueueInterface
** wxHIDJoystick::GetQueue()
681 { return m_ppQueue
; }
683 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
687 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
689 //---------------------------------------------------------------------------
690 // wxJoystickThread Constructor
692 // Just initializes members
693 //---------------------------------------------------------------------------
694 wxJoystickThread::wxJoystickThread(wxHIDJoystick
* hid
, int joystick
)
696 m_joystick(joystick
),
697 m_lastposition(127,127),
702 memset(m_axe
, 0, sizeof(int) * wxJS_MAX_AXES
);
705 //---------------------------------------------------------------------------
706 // wxJoystickThread::Entry
710 // Runs a CFRunLoop for polling. Basically, it sets the HID queue to
711 // call wxJoystickThread::HIDCallback in the context of this thread
712 // when something changes on the device. It polls as long as the user
713 // wants, or a certain amount if the user wants to "block". Note that
714 // we don't actually block here since this is in a secondary thread.
715 //---------------------------------------------------------------------------
716 void* wxJoystickThread::Entry()
718 CFRunLoopSourceRef pRLSource
= NULL
;
720 if ((*m_hid
->GetQueue())->createAsyncEventSource(
721 m_hid
->GetQueue(), &pRLSource
) != kIOReturnSuccess
)
723 wxLogSysError(wxT("Couldn't create async event source"));
727 wxASSERT(pRLSource
!= NULL
);
729 //attach runloop source to main run loop in thread
730 CFRunLoopRef pRL
= CFRunLoopGetCurrent();
731 CFRunLoopAddSource(pRL
, pRLSource
, kCFRunLoopDefaultMode
);
732 wxASSERT( CFRunLoopContainsSource(pRL
, pRLSource
, kCFRunLoopDefaultMode
) );
735 if( (*m_hid
->GetQueue())->setEventCallout(m_hid
->GetQueue(),
736 wxJoystickThread::HIDCallback
, this, this) != kIOReturnSuccess
)
738 wxLogSysError(wxT("Could not set event callout for queue"));
742 if( (*m_hid
->GetQueue())->start(m_hid
->GetQueue()) != kIOReturnSuccess
)
744 wxLogSysError(wxT("Could not start queue"));
756 dTime
= 0.0001 * m_polling
;
758 dTime
= 0.0001 * 10; // check at least every 10 msec in "blocking" case
760 //true just "handles and returns" - false forces it to stay the time
763 CFRunLoopRunInMode(kCFRunLoopDefaultMode
, dTime
, true);
766 HIDCallback(this, ret
, this, this);
771 wxASSERT( CFRunLoopContainsSource(pRL
, pRLSource
, kCFRunLoopDefaultMode
) );
773 CFRunLoopRemoveSource(pRL
, pRLSource
, kCFRunLoopDefaultMode
);
774 CFRelease(pRLSource
);
779 //---------------------------------------------------------------------------
780 // wxJoystickThread::HIDCallback (static)
782 // Callback for the native HID device when it recieves input.
784 // This is where the REAL dirty work gets done.
786 // 1) Loops through each event the queue has recieved
787 // 2) First, checks if the thread that is running the loop for
788 // the polling has ended - if so it breaks out
789 // 3) Next, it checks if there was an error getting this event from
790 // the HID queue, if there was, it logs an error and returns
791 // 4) Now it does the real dirty work by getting the button states
792 // from cookies 0-40 and axes positions/states from cookies 40-50
793 // in the native HID device by quering cookie values.
794 // 5) Sends the event to the polling window (if any)
795 // 6) Gets the next event and goes back to (1)
796 //---------------------------------------------------------------------------
797 /*static*/ void wxJoystickThread::HIDCallback(void* WXUNUSED(target
),
798 IOReturn
WXUNUSED(res
),
800 void* WXUNUSED(sender
))
802 IOHIDEventStruct hidevent
;
803 AbsoluteTime bogustime
= {0,0};
805 wxJoystickThread
* pThis
= (wxJoystickThread
*) context
;
806 wxHIDJoystick
* m_hid
= pThis
->m_hid
;
808 //Get the "first" event from the queue
809 //bogustime tells it we don't care at what time to start
810 //where it gets the next from
811 ret
= (*m_hid
->GetQueue())->getNextEvent(m_hid
->GetQueue(),
812 &hidevent
, bogustime
, 0);
814 while (ret
!= kIOReturnUnderrun
)
816 if (pThis
->TestDestroy())
819 if(ret
!= kIOReturnSuccess
)
821 wxLogSysError(wxString::Format(wxT("wxJoystick Error:[%i]"), ret
));
825 wxJoystickEvent wxevent
;
827 //Find the cookie that changed
829 IOHIDElementCookie
* pCookies
= m_hid
->GetCookies();
832 if(hidevent
.elementCookie
== pCookies
[nIndex
])
842 wxLogSysError(wxString::Format(wxT("wxJoystick Out Of Bounds Error")));
847 //is the cookie a button?
852 pThis
->m_buttons
|= (1 << nIndex
);
853 wxevent
.SetEventType(wxEVT_JOY_BUTTON_DOWN
);
857 pThis
->m_buttons
&= ~(1 << nIndex
);
858 wxevent
.SetEventType(wxEVT_JOY_BUTTON_UP
);
861 wxevent
.SetButtonChange(nIndex
+1);
863 else if (nIndex
== wxJS_AXIS_X
)
865 pThis
->m_lastposition
.x
= hidevent
.value
;
866 wxevent
.SetEventType(wxEVT_JOY_MOVE
);
867 pThis
->m_axe
[0] = hidevent
.value
;
869 else if (nIndex
== wxJS_AXIS_Y
)
871 pThis
->m_lastposition
.y
= hidevent
.value
;
872 wxevent
.SetEventType(wxEVT_JOY_MOVE
);
873 pThis
->m_axe
[1] = hidevent
.value
;
875 else if (nIndex
== wxJS_AXIS_Z
)
877 wxevent
.SetEventType(wxEVT_JOY_ZMOVE
);
878 pThis
->m_axe
[2] = hidevent
.value
;
881 wxevent
.SetEventType(wxEVT_JOY_MOVE
);
883 Nanoseconds timestamp
= AbsoluteToNanoseconds(hidevent
.timestamp
);
885 wxULongLong
llTime(timestamp
.hi
, timestamp
.lo
);
889 wxevent
.SetTimestamp(llTime
.GetValue());
890 wxevent
.SetJoystick(pThis
->m_joystick
);
891 wxevent
.SetButtonState(pThis
->m_buttons
);
892 wxevent
.SetPosition(pThis
->m_lastposition
);
893 wxevent
.SetZPosition(pThis
->m_axe
[2]);
894 wxevent
.SetEventObject(pThis
->m_catchwin
);
896 if (pThis
->m_catchwin
)
897 pThis
->m_catchwin
->GetEventHandler()->AddPendingEvent(wxevent
);
899 ret
= (*m_hid
->GetQueue())->getNextEvent(m_hid
->GetQueue(),
900 &hidevent
, bogustime
, 0);
904 #endif // wxUSE_JOYSTICK