From 618358e13607a523db9b9db8e01ea5fc677639a9 Mon Sep 17 00:00:00 2001 From: John Gebbie Date: Thu, 1 Jun 2023 16:33:44 +0100 Subject: [PATCH] xkb: use unsafe.Slice --- xkb/xkb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xkb/xkb.go b/xkb/xkb.go index 1e0e33f..fb2dfef 100644 --- a/xkb/xkb.go +++ b/xkb/xkb.go @@ -109,7 +109,7 @@ func (km *Keymap) KeyGetSymsByLevel(key, layout, level uint32) []uint32 { if n == 0 || syms == nil { return nil } - data := (*[1 << 30]C.xkb_keysym_t)(unsafe.Pointer(syms))[:n:n] + data := unsafe.Slice(syms, n) s := make([]uint32, n) for i := 0; i < n; i++ { s[i] = uint32(data[i])