340fff9814fcda3b5a42cd76713aea105d37694a — Elias Naur a month ago 2a41ff9
ui/key: rename ChordEvent to just Event

Event is like pointer.Event and we don't want the stuttering of
key.KeyEvent.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
M ui/app/internal/input/router.go => ui/app/internal/input/router.go +1 -1
@@ 61,7 61,7 @@ switch e := e.(type) {
  	case pointer.Event:
  		q.pqueue.Push(e, &q.handlers)
- 	case key.EditEvent, key.ChordEvent, key.FocusEvent:
+ 	case key.EditEvent, key.Event, key.FocusEvent:
  		q.kqueue.Push(e, &q.handlers)
  	}
  	return q.handlers.Updated()

M ui/app/os_android.go => ui/app/os_android.go +1 -1
@@ 365,7 365,7 @@ func onKeyEvent(env *C.JNIEnv, class C.jclass, handle C.jlong, keyCode, r C.jint, t C.jlong) {
  	w := views[handle]
  	if n, ok := convertKeyCode(keyCode); ok {
- 		w.event(key.ChordEvent{Name: n})
+ 		w.event(key.Event{Name: n})
  	}
  	if r != 0 {
  		w.event(key.EditEvent{Text: string(rune(r))})

M ui/app/os_ios.go => ui/app/os_ios.go +1 -1
@@ 202,7 202,7 @@ }
  
  func (w *window) onKeyCommand(name rune) {
- 	w.w.event(key.ChordEvent{
+ 	w.w.event(key.Event{
  		Name: name,
  	})
  }

M ui/app/os_js.go => ui/app/os_js.go +1 -1
@@ 208,7 208,7 @@ func (w *window) keyEvent(e js.Value) {
  	k := e.Get("key").String()
  	if n, ok := translateKey(k); ok {
- 		cmd := key.ChordEvent{Name: n}
+ 		cmd := key.Event{Name: n}
  		if e.Call("getModifierState", "Control").Bool() {
  			cmd.Modifiers |= key.ModCommand
  		}

M ui/app/os_macos.go => ui/app/os_macos.go +1 -1
@@ 127,7 127,7 @@ w := views[view]
  		for _, k := range str {
  			if n, ok := convertKey(k); ok {
- 				w.w.event(key.ChordEvent{Name: n, Modifiers: kmods})
+ 				w.w.event(key.Event{Name: n, Modifiers: kmods})
  			}
  		}
  	})

M ui/app/os_wayland.go => ui/app/os_wayland.go +1 -1
@@ 856,7 856,7 @@ }
  	sym := C.xkb_state_key_get_one_sym(conn.xkbState, C.xkb_keycode_t(keyCode))
  	if n, ok := convertKeysym(sym); ok {
- 		cmd := key.ChordEvent{Name: n}
+ 		cmd := key.Event{Name: n}
  		if C.xkb_state_mod_name_is_active(conn.xkbState, (*C.char)(unsafe.Pointer(&_XKB_MOD_NAME_CTRL[0])), C.XKB_STATE_MODS_EFFECTIVE) == 1 {
  			cmd.Modifiers |= key.ModCommand
  		}

M ui/app/os_windows.go => ui/app/os_windows.go +1 -1
@@ 269,7 269,7 @@ return 1
  	case _WM_KEYDOWN, _WM_SYSKEYDOWN:
  		if n, ok := convertKeyCode(wParam); ok {
- 			cmd := key.ChordEvent{Name: n}
+ 			cmd := key.Event{Name: n}
  			if getKeyState(_VK_CONTROL)&0x1000 != 0 {
  				cmd.Modifiers |= key.ModCommand
  			}

M ui/key/key.go => ui/key/key.go +2 -2
@@ 34,7 34,7 @@ Focus bool
  }
  
- type ChordEvent struct {
+ type Event struct {
  	Name      rune
  	Modifiers Modifiers
  }


@@ 86,5 86,5 @@ }
  
  func (EditEvent) ImplementsEvent()  {}
- func (ChordEvent) ImplementsEvent() {}
+ func (Event) ImplementsEvent()      {}
  func (FocusEvent) ImplementsEvent() {}

M ui/text/editor.go => ui/text/editor.go +3 -3
@@ 14,8 14,8 @@ "gioui.org/ui/input"
  	"gioui.org/ui/key"
  	"gioui.org/ui/layout"
- 	"gioui.org/ui/pointer"
  	"gioui.org/ui/paint"
+ 	"gioui.org/ui/pointer"
  
  	"golang.org/x/image/math/fixed"
  )


@@ 118,7 118,7 @@ switch ke := ke.(type) {
  		case key.FocusEvent:
  			e.focused = ke.Focus
- 		case key.ChordEvent:
+ 		case key.Event:
  			if !e.focused {
  				break
  			}


@@ 559,7 559,7 @@ }
  }
  
- func (e *Editor) command(k key.ChordEvent) bool {
+ func (e *Editor) command(k key.Event) bool {
  	switch k.Name {
  	case key.NameReturn, key.NameEnter:
  		e.append("\n")