X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/571d991bb3232f0dcd3319dbdc9d35e5c80f4c71..cc721f7dd2bfe5917c7b857b7da13c2a79fec203:/src/osx/uiaction_osx.cpp diff --git a/src/osx/uiaction_osx.cpp b/src/osx/uiaction_osx.cpp index a1667c6bfb..7a537e1f3b 100644 --- a/src/osx/uiaction_osx.cpp +++ b/src/osx/uiaction_osx.cpp @@ -4,7 +4,7 @@ // Author: Kevin Ollivier, Steven Lamerton, Vadim Zeitlin // Modified by: // Created: 2010-03-06 -// RCS-ID: $Id: menu.cpp 54129 2008-06-11 19:30:52Z SC $ +// RCS-ID: $Id$ // Copyright: (c) Kevin Ollivier // (c) 2010 Steven Lamerton // (c) 2010 Vadim Zeitlin @@ -60,17 +60,6 @@ CGPoint GetMousePosition() return pos; } -bool SendCharCode(CGKeyCode keycode, bool isDown) -{ - wxCFRef - event(CGEventCreateKeyboardEvent(NULL, keycode, isDown)); - if ( !event ) - return false; - - CGEventPost(kCGHIDEventTap, event); - return true; -} - CGKeyCode wxCharCodeWXToOSX(wxKeyCode code) { CGKeyCode keycode; @@ -180,7 +169,9 @@ CGKeyCode wxCharCodeWXToOSX(wxKeyCode code) case WXK_NUMPAD_DECIMAL: keycode = kVK_ANSI_KeypadDecimal; break; case WXK_NUMPAD_DIVIDE: keycode = kVK_ANSI_KeypadDivide; break; - default: wxLogDebug( "Unrecognised keycode %d", code ); + default: + wxLogDebug( "Unrecognised keycode %d", code ); + keycode = -1; } return keycode; @@ -237,32 +228,17 @@ bool wxUIActionSimulator::MouseUp(int button) return true; } -bool wxUIActionSimulator::DoKey(int keycode, int modifiers, bool isDown) +bool +wxUIActionSimulator::DoKey(int keycode, int WXUNUSED(modifiers), bool isDown) { - if (isDown) - { - if (modifiers & wxMOD_SHIFT) - SendCharCode(kVK_Shift, true); - if (modifiers & wxMOD_ALT) - SendCharCode(kVK_Option, true); - if (modifiers & wxMOD_CMD) - SendCharCode(kVK_Command, true); - } - CGKeyCode cgcode = wxCharCodeWXToOSX((wxKeyCode)keycode); - if ( !SendCharCode(cgcode, isDown) ) - return false; - if(!isDown) - { - if (modifiers & wxMOD_SHIFT) - SendCharCode(kVK_Shift, false); - if (modifiers & wxMOD_ALT) - SendCharCode(kVK_Option, false); - if (modifiers & wxMOD_CMD) - SendCharCode(kVK_Command, false); - } + wxCFRef + event(CGEventCreateKeyboardEvent(NULL, cgcode, isDown)); + if ( !event ) + return false; + CGEventPost(kCGHIDEventTap, event); return true; }