Add HID keyboard functionality
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29433 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -124,6 +124,10 @@ public:
|
|||||||
static bool s_macHasDialogManager ;
|
static bool s_macHasDialogManager ;
|
||||||
static long s_macDialogManagerVersion ;
|
static long s_macDialogManagerVersion ;
|
||||||
|
|
||||||
|
#ifdef __DARWIN__
|
||||||
|
static class wxHIDKeyboard* s_macHIDKeyboard;
|
||||||
|
#endif
|
||||||
|
|
||||||
WXHRGN m_macCursorRgn ;
|
WXHRGN m_macCursorRgn ;
|
||||||
WXHRGN m_macSleepRgn ;
|
WXHRGN m_macSleepRgn ;
|
||||||
WXHRGN m_macHelpRgn ;
|
WXHRGN m_macHelpRgn ;
|
||||||
|
@@ -59,6 +59,8 @@
|
|||||||
# if defined(WXMAKINGDLL_CORE)
|
# if defined(WXMAKINGDLL_CORE)
|
||||||
# include <mach-o/dyld.h>
|
# include <mach-o/dyld.h>
|
||||||
# endif
|
# endif
|
||||||
|
// include hid keyboard
|
||||||
|
# include "wx/mac/carbon/private/hid.h"
|
||||||
#else
|
#else
|
||||||
# include <Sound.h>
|
# include <Sound.h>
|
||||||
# include <Threads.h>
|
# include <Threads.h>
|
||||||
@@ -119,6 +121,10 @@ long wxApp::s_macPreferencesMenuItemId = wxID_PREFERENCES ;
|
|||||||
long wxApp::s_macExitMenuItemId = wxID_EXIT ;
|
long wxApp::s_macExitMenuItemId = wxID_EXIT ;
|
||||||
wxString wxApp::s_macHelpMenuTitleName = wxT("&Help") ;
|
wxString wxApp::s_macHelpMenuTitleName = wxT("&Help") ;
|
||||||
|
|
||||||
|
#ifdef __DARWIN__
|
||||||
|
wxHIDKeyboard* wxApp::s_macHIDKeyboard = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Normally we're not a plugin
|
// Normally we're not a plugin
|
||||||
bool wxApp::sm_isEmbedded = false;
|
bool wxApp::sm_isEmbedded = false;
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -717,6 +723,10 @@ void wxApp::CleanUp()
|
|||||||
ProfilerDump( (StringPtr)"\papp.prof" ) ;
|
ProfilerDump( (StringPtr)"\papp.prof" ) ;
|
||||||
ProfilerTerm() ;
|
ProfilerTerm() ;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
// clean up HID Keyboard
|
||||||
|
if (s_macHIDKeyboard)
|
||||||
|
delete s_macHIDKeyboard;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UMACleanupToolbox() ;
|
UMACleanupToolbox() ;
|
||||||
@@ -1169,11 +1179,16 @@ int wxMacKeyCodeToModifier(wxKeyCode key)
|
|||||||
|
|
||||||
bool wxGetKeyState(wxKeyCode key) //virtual key code if < 10.2.x, else see below
|
bool wxGetKeyState(wxKeyCode key) //virtual key code if < 10.2.x, else see below
|
||||||
{
|
{
|
||||||
//#ifdef __DARWIN__
|
#ifdef __DARWIN__
|
||||||
// wxHIDKeyboard keyboard;
|
// Startup HID keyboard for getting key codes on DARWIN
|
||||||
// return keyboard.IsActive(key);
|
if (!wxApp::s_macHIDKeyboard)
|
||||||
//#else
|
{
|
||||||
// TODO: Have it use HID Manager on OSX...
|
wxApp::s_macHIDKeyboard = new wxHIDKeyboard();
|
||||||
|
wxApp::s_macHIDKeyboard->Create();
|
||||||
|
}
|
||||||
|
|
||||||
|
return wxApp::s_macHIDKeyboard->IsActive(key);
|
||||||
|
#else
|
||||||
//if OS X > 10.2 (i.e. 10.2.x)
|
//if OS X > 10.2 (i.e. 10.2.x)
|
||||||
//a known apple bug prevents the system from determining led
|
//a known apple bug prevents the system from determining led
|
||||||
//states with GetKeys... can only determine caps lock led
|
//states with GetKeys... can only determine caps lock led
|
||||||
@@ -1182,7 +1197,7 @@ bool wxGetKeyState(wxKeyCode key) //virtual key code if < 10.2.x, else see below
|
|||||||
// KeyMapByteArray keymap;
|
// KeyMapByteArray keymap;
|
||||||
// GetKeys((BigEndianLong*)keymap);
|
// GetKeys((BigEndianLong*)keymap);
|
||||||
// return !!(BitTst(keymap, (sizeof(KeyMapByteArray)*8) - iKey));
|
// return !!(BitTst(keymap, (sizeof(KeyMapByteArray)*8) - iKey));
|
||||||
//#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user