Allow for sticky keys to be used with combo keys
This commit is contained in:
parent
34de0948da
commit
9cbb053d50
1 changed files with 19 additions and 11 deletions
22
menelaus.scm
22
menelaus.scm
|
@ -275,10 +275,8 @@
|
||||||
(and slot (vector-set! keycodes-down slot keycode))
|
(and slot (vector-set! keycodes-down slot keycode))
|
||||||
(and slot (vector-set! keys-for-frame slot key))))
|
(and slot (vector-set! keys-for-frame slot key))))
|
||||||
|
|
||||||
;; Record a key press in the modifiers/keycodes-down vectors for the layout.
|
(define (press-key-aux keycode key)
|
||||||
(define (press-key key)
|
(let ((original-keycode (lookup key)))
|
||||||
(let ((keycode (lookup key))
|
|
||||||
(sticky (find sticky-modifiers 1)))
|
|
||||||
;; Sometimes "keycodes" are procedures; in that case we call them with
|
;; Sometimes "keycodes" are procedures; in that case we call them with
|
||||||
;; true when the key is pressed and false when it's released.
|
;; true when the key is pressed and false when it's released.
|
||||||
(if (procedure? keycode)
|
(if (procedure? keycode)
|
||||||
|
@ -289,14 +287,22 @@
|
||||||
(press-sticky-modifier (unmodify keycode))
|
(press-sticky-modifier (unmodify keycode))
|
||||||
(begin
|
(begin
|
||||||
(press-modifier (unmodify keycode) key)
|
(press-modifier (unmodify keycode) key)
|
||||||
(press-normal-key (uncombo keycode) key)))
|
(press-key-aux (uncombo keycode) key)))
|
||||||
(press-modifier (unmodify keycode) key))
|
(press-modifier (unmodify keycode) key))
|
||||||
|
(let ((sticky (find sticky-modifiers 1)))
|
||||||
(if sticky
|
(if sticky
|
||||||
(begin (press-modifier (+ sticky 1) key)
|
(begin
|
||||||
(press-normal-key keycode key)
|
(press-modifier (+ sticky 1) key)
|
||||||
(release-sticky-modifier (+ sticky 1)))
|
(release-sticky-modifier (+ sticky 1)))
|
||||||
|
#f)
|
||||||
(press-normal-key keycode key))))))
|
(press-normal-key keycode key))))))
|
||||||
|
|
||||||
|
|
||||||
|
;; Record a key press in the modifiers/keycodes-down vectors for the layout.
|
||||||
|
(define (press-key key)
|
||||||
|
(let ((keycode (lookup key)))
|
||||||
|
(press-key-aux keycode key)))
|
||||||
|
|
||||||
;; Record that a given key being released resulted in a modifier release.
|
;; Record that a given key being released resulted in a modifier release.
|
||||||
(define (release-modifier keycode key n)
|
(define (release-modifier keycode key n)
|
||||||
(if (= (or (vector-ref keys-for-modifiers n) (- 0 1)) key)
|
(if (= (or (vector-ref keys-for-modifiers n) (- 0 1)) key)
|
||||||
|
@ -321,7 +327,9 @@
|
||||||
(vector-set! keys-for-frame slot #f))
|
(vector-set! keys-for-frame slot #f))
|
||||||
#f)
|
#f)
|
||||||
(if modifier-slot
|
(if modifier-slot
|
||||||
|
(begin
|
||||||
(release-modifier modifier-slot key 0)
|
(release-modifier modifier-slot key 0)
|
||||||
|
(release-key key))
|
||||||
#f)))))
|
#f)))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Send USB
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Send USB
|
||||||
|
|
Loading…
Reference in a new issue