MCPcopy Index your code
hub / github.com/lxn/walk / handleKeyDown

Method handleKeyDown

window.go:2182–2213  ·  view source on GitHub ↗
(wParam, lParam uintptr)

Source from the content-addressed store, hash-verified

2180}
2181
2182func (wb *WindowBase) handleKeyDown(wParam, lParam uintptr) {
2183 key := Key(wParam)
2184
2185 if uint32(lParam)>>30 == 0 {
2186 wb.keyDownPublisher.Publish(key)
2187
2188 // Using TranslateAccelerators refused to work, so we handle them
2189 // ourselves, at least for now.
2190 shortcut := Shortcut{ModifiersDown(), key}
2191 if action, ok := shortcut2Action[shortcut]; ok {
2192 if action.Visible() && action.Enabled() {
2193 window := wb.window
2194
2195 if w, ok := window.(Widget); ok {
2196 window = ancestor(w)
2197 }
2198
2199 if m, ok := window.(menuer); ok && menuContainsAction(m.Menu(), action) {
2200 action.raiseTriggered()
2201 }
2202 }
2203 }
2204 }
2205
2206 switch key {
2207 case KeyAlt, KeyControl, KeyShift:
2208 // nop
2209
2210 default:
2211 wb.keyPressPublisher.Publish(key)
2212 }
2213}
2214
2215func (wb *WindowBase) handleKeyUp(wParam, lParam uintptr) {
2216 wb.keyUpPublisher.Publish(Key(wParam))

Callers 1

WndProcMethod · 0.95

Calls 9

KeyTypeAlias · 0.85
ModifiersDownFunction · 0.85
ancestorFunction · 0.85
menuContainsActionFunction · 0.85
raiseTriggeredMethod · 0.80
VisibleMethod · 0.65
EnabledMethod · 0.65
MenuMethod · 0.65
PublishMethod · 0.45

Tested by

no test coverage detected