racket/gui: internal cleanup
As suggested by Robby.
This commit is contained in:
parent
32ae484c72
commit
0648556bea
|
@ -7,7 +7,7 @@
|
|||
"../common/event.rkt")
|
||||
|
||||
(provide
|
||||
(protect-out make-key-event
|
||||
(protect-out maybe-make-key-event
|
||||
generates-key-event?
|
||||
reset-key-mapping
|
||||
key-symbol-to-menu-key))
|
||||
|
@ -18,15 +18,17 @@
|
|||
|
||||
(define (generates-key-event? msg)
|
||||
(let ([message (MSG-message msg)])
|
||||
(and (memq message (list WM_KEYDOWN WM_SYSKEYDOWN
|
||||
WM_KEYUP WM_SYSKEYUP))
|
||||
(make-key-event #t
|
||||
(MSG-wParam msg)
|
||||
(MSG-lParam msg)
|
||||
#f
|
||||
(or (= message WM_KEYUP)
|
||||
(= message WM_SYSKEYUP))
|
||||
(MSG-hwnd msg)))))
|
||||
(and (or (eq? message WM_KEYDOWN)
|
||||
(eq? message WM_SYSKEYDOWN)
|
||||
(eq? message WM_KEYUP)
|
||||
(eq? message WM_SYSKEYUP))
|
||||
(maybe-make-key-event #t
|
||||
(MSG-wParam msg)
|
||||
(MSG-lParam msg)
|
||||
#f
|
||||
(or (= message WM_KEYUP)
|
||||
(= message WM_SYSKEYUP))
|
||||
(MSG-hwnd msg)))))
|
||||
|
||||
(define (THE_SCAN_CODE lParam)
|
||||
(bitwise-and (arithmetic-shift lParam -16) #x1FF))
|
||||
|
@ -126,7 +128,7 @@
|
|||
VK_SCROLL 'scroll))
|
||||
|
||||
|
||||
(define (make-key-event just-check? wParam lParam is-char? is-up? hwnd)
|
||||
(define (maybe-make-key-event just-check? wParam lParam is-char? is-up? hwnd)
|
||||
(let* ([control-down? (not (zero? (arithmetic-shift (GetKeyState VK_CONTROL) -1)))]
|
||||
[rcontrol-down? (and control-down?
|
||||
(not (zero? (arithmetic-shift (GetKeyState VK_RCONTROL) -1))))]
|
||||
|
|
|
@ -523,7 +523,7 @@
|
|||
(loop (sub1 delta))))))
|
||||
|
||||
(define/private (do-key w msg wParam lParam is-char? is-up? default)
|
||||
(let ([e (make-key-event #f wParam lParam is-char? is-up? hwnd)])
|
||||
(let ([e (maybe-make-key-event #f wParam lParam is-char? is-up? hwnd)])
|
||||
(if (and e
|
||||
(if (definitely-wants-event? w msg wParam e)
|
||||
(begin
|
||||
|
|
Loading…
Reference in New Issue
Block a user