void HandleCommandManagerKeyPressed (object sender, KeyPressArgs e) { events.Add (new KeyPressEvent () { Key = e.Key, Modifiers = e.Modifiers }); }
void HandleCommandManagerKeyPressed (object sender, KeyPressArgs e) { uint unicode = Gdk.Keyval.ToUnicode (e.KeyValue); if (pendingText != null) { if (pendingModifiers != e.Modifiers || unicode == 0) { CompleteStringEvent (pendingText.ToString (), pendingModifiers); } else { pendingText.Append ((char)unicode); return; } // If text event has been completed, then we need to reset the pending events if (unicode != 0) { pendingText = new StringBuilder (); pendingText.Append ((char)unicode); pendingModifiers = e.Modifiers; } else { // Don't have a unicode key, so just issue a standard key event events.Add (new KeyPressEvent { Key = e.Key, Modifiers = e.Modifiers }); pendingText = null; pendingModifiers = Gdk.ModifierType.None; } } else { if (unicode == 0) { events.Add (new KeyPressEvent () { Key = e.Key, Modifiers = e.Modifiers }); return; } pendingText = new StringBuilder (); pendingText.Append ((char)unicode); pendingModifiers = e.Modifiers; } }
static void HandleKeyPressed (object sender, KeyPressArgs e) { if (e.Key == Gdk.Key.Escape) { DestroyWindow (); } }