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
30
menelaus.scm
30
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,13 +287,21 @@
|
||||||
(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))
|
||||||
(if sticky
|
(let ((sticky (find sticky-modifiers 1)))
|
||||||
(begin (press-modifier (+ sticky 1) key)
|
(if sticky
|
||||||
(press-normal-key keycode key)
|
(begin
|
||||||
(release-sticky-modifier (+ sticky 1)))
|
(press-modifier (+ sticky 1) key)
|
||||||
(press-normal-key keycode key))))))
|
(release-sticky-modifier (+ sticky 1)))
|
||||||
|
#f)
|
||||||
|
(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)
|
||||||
|
@ -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
|
||||||
(release-modifier modifier-slot key 0)
|
(begin
|
||||||
|
(release-modifier modifier-slot key 0)
|
||||||
|
(release-key key))
|
||||||
#f)))))
|
#f)))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Send USB
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Send USB
|
||||||
|
|
Loading…
Reference in a new issue