private bool PassKeyEventToIbus(Control control, int keySym, Keys modifierKeys, bool resetIfUnhandled) { if (!_ibusComm.Connected) { return(false); } int scancode = X11KeyConverter.GetScanCode(keySym); if (scancode > -1) { if (_ibusComm.ProcessKeyEvent(keySym, scancode, modifierKeys)) { return(true); } } if (resetIfUnhandled) { // If ProcessKeyEvent doesn't consume the key, we need to kill any preedits and // sync before continuing processing the keypress. We return false so that the // control can process the character. ResetAndWaitForCommit(control); } return(false); }
/// <summary> /// Gets the X11 scan code for the passed in X11 key symbol, or -1 if we don't know /// the scan code. /// </summary> internal static int GetScanCode(int keySym) { if (Instance == null) Instance = new X11KeyConverter(); return Instance.Convert(keySym); }
/// <summary> /// Passes the key event to ibus. This method deals with the special keys (Cursor up/down, /// backspace etc) that usually shouldn't cause a commit. /// </summary> private bool PassSpecialKeyEventToIbus(Control control, Keys keyChar, Keys modifierKeys) { var keySym = X11KeyConverter.GetKeySym(keyChar); return(PassKeyEventToIbus(control, keySym, modifierKeys, false)); }