private void AttachContextMethods(IInputContext context) { ProtectedIBusInvoke(() => { context.CommitText += OnCommitText; context.UpdatePreeditText += OnUpdatePreeditText; context.HidePreeditText += OnHidePreeditText; context.ForwardKeyEvent += OnKeyEvent; context.DeleteSurroundingText += OnDeleteSurroundingText; context.SetCapabilities(Capabilities.Focus | Capabilities.PreeditText | Capabilities.SurroundingText); context.Enable(); // not needed for IBus 1.5, but doesn't hurt. }); }