- if (shiftDown)
- SendCharCode((CGCharCode)56, true);
- if (altDown)
- SendCharCode((CGCharCode)58, true);
- if (cmdDown)
- SendCharCode((CGCharCode)55, true);
-
- SendCharCode((CGCharCode)keycode, isDown);
-
- if (shiftDown)
- SendCharCode((CGCharCode)56, false);
- if (altDown)
- SendCharCode((CGCharCode)58, false);
- if (cmdDown)
- SendCharCode((CGCharCode)55, false);
-
+ CGKeyCode cgcode = wxCharCodeWXToOSX((wxKeyCode)keycode);
+
+ wxCFRef<CGEventRef>
+ event(CGEventCreateKeyboardEvent(NULL, cgcode, isDown));
+ if ( !event )
+ return false;
+
+ CGEventPost(kCGHIDEventTap, event);