From 0853ce59958e1662ad6594eb7e52fdbc416f09cb Mon Sep 17 00:00:00 2001 From: zsien Date: Thu, 11 Apr 2024 16:41:17 +0800 Subject: [PATCH] feat: add GrabCheckedV2 Issues: linuxdeepin/developer-center#5989 --- util/keybind/keybind.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util/keybind/keybind.go b/util/keybind/keybind.go index 5f63907..8fe71aa 100644 --- a/util/keybind/keybind.go +++ b/util/keybind/keybind.go @@ -30,9 +30,13 @@ func Ungrab(conn *x.Conn, win x.Window, mods uint16, key x.Keycode) { } func GrabChecked(conn *x.Conn, win x.Window, mods uint16, key x.Keycode) error { + return GrabCheckedV2(conn, win, mods, key, x.GrabModeAsync, x.GrabModeAsync) +} + +func GrabCheckedV2(conn *x.Conn, win x.Window, mods uint16, key x.Keycode, pointerMode uint8, keyboardMode uint8) error { for _, m := range grabMods { err := x.GrabKeyChecked(conn, true, win, mods|m, - key, x.GrabModeAsync, x.GrabModeAsync).Check(conn) + key, pointerMode, keyboardMode).Check(conn) if err != nil { return err }