mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
io/key: implement key.Release state
Implement key state for the following platforms: js, wayland, windows, x11. Unsupported platforms will continue to function as before, sending key.Press for all key events. Signed-off-by: Josiah Niedrauer <josiah@niedrauer.com>
This commit is contained in:
committed by
Elias Naur
parent
ef652f4922
commit
42e568775c
@@ -305,12 +305,15 @@ func (h *x11EventHandler) handleEvents() bool {
|
||||
h.w.xkb.UpdateMask(uint32(state.base_mods), uint32(state.latched_mods), uint32(state.locked_mods),
|
||||
uint32(state.base_group), uint32(state.latched_group), uint32(state.locked_group))
|
||||
}
|
||||
case C.KeyPress:
|
||||
case C.KeyPress, C.KeyRelease:
|
||||
ks := key.Press
|
||||
if _type == C.KeyRelease {
|
||||
ks = key.Release
|
||||
}
|
||||
kevt := (*C.XKeyPressedEvent)(unsafe.Pointer(xev))
|
||||
for _, e := range h.w.xkb.DispatchKey(uint32(kevt.keycode)) {
|
||||
for _, e := range h.w.xkb.DispatchKey(uint32(kevt.keycode), ks) {
|
||||
w.w.Event(e)
|
||||
}
|
||||
case C.KeyRelease:
|
||||
case C.ButtonPress, C.ButtonRelease:
|
||||
bevt := (*C.XButtonEvent)(unsafe.Pointer(xev))
|
||||
ev := pointer.Event{
|
||||
|
||||
Reference in New Issue
Block a user