Skip to content

Commit 864207b

Browse files
committed
fix get-modifier
1 parent b969ffb commit 864207b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

frontends/sdl2/keyboard.lisp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,17 @@
8686
(modifier (lem-sdl2/keyboard::get-modifier keysym)))
8787
(make-key-event code modifier)))
8888

89+
(defun mod-p (mod value)
90+
(= value (logand value mod)))
91+
8992
(defun get-modifier (keysym)
9093
(let* ((mod (sdl2:mod-value keysym))
91-
(shift (= 1 (logand 1 mod)))
92-
(ctrl (= 64 (logand 64 mod)))
93-
(meta (= 256 (logand 256 mod))))
94+
(shift (or (mod-p mod sdl2-ffi:+kmod-lshift+)
95+
(mod-p mod sdl2-ffi:+kmod-rshift+)))
96+
(ctrl (or (mod-p mod sdl2-ffi:+kmod-lctrl+)
97+
(mod-p mod sdl2-ffi:+kmod-rctrl+)))
98+
(meta (or (mod-p mod sdl2-ffi:+kmod-lalt+)
99+
(mod-p mod sdl2-ffi:+kmod-ralt+))))
94100
(make-modifier :shift shift :ctrl ctrl :meta meta)))
95101

96102
(defun update-modifier (modifier new-modifier)

0 commit comments

Comments
 (0)