From 864207be5414659dedd55f94b77c34b771466920 Mon Sep 17 00:00:00 2001 From: cxxxr Date: Mon, 22 May 2023 18:47:26 +0900 Subject: [PATCH] fix get-modifier --- frontends/sdl2/keyboard.lisp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontends/sdl2/keyboard.lisp b/frontends/sdl2/keyboard.lisp index 097d5a643..e8209ad81 100644 --- a/frontends/sdl2/keyboard.lisp +++ b/frontends/sdl2/keyboard.lisp @@ -86,11 +86,17 @@ (modifier (lem-sdl2/keyboard::get-modifier keysym))) (make-key-event code modifier))) +(defun mod-p (mod value) + (= value (logand value mod))) + (defun get-modifier (keysym) (let* ((mod (sdl2:mod-value keysym)) - (shift (= 1 (logand 1 mod))) - (ctrl (= 64 (logand 64 mod))) - (meta (= 256 (logand 256 mod)))) + (shift (or (mod-p mod sdl2-ffi:+kmod-lshift+) + (mod-p mod sdl2-ffi:+kmod-rshift+))) + (ctrl (or (mod-p mod sdl2-ffi:+kmod-lctrl+) + (mod-p mod sdl2-ffi:+kmod-rctrl+))) + (meta (or (mod-p mod sdl2-ffi:+kmod-lalt+) + (mod-p mod sdl2-ffi:+kmod-ralt+)))) (make-modifier :shift shift :ctrl ctrl :meta meta))) (defun update-modifier (modifier new-modifier)