diff options
author | David Thompson <dthompson2@worcester.edu> | 2015-12-21 15:53:01 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2015-12-21 15:53:01 -0500 |
commit | 984ff2f35e3e34f0ebd64b54f582ceaeaf2624df (patch) | |
tree | 9a79d46c41ed9c2aa87b27fb4c7795e75c507beb /sdl2/events.scm | |
parent | 3bac7c76c894fd39721c16d5005dbc7d23fda8d6 (diff) |
events: window: Add additional predicates.
* sdl2/events.scm (window-shown-event?, window-hidden-event?,
window-exposed-event?, window-moved-event?, window-resized-event?,
window-size-changed-event?, window-minimized-event?,
window-maximized-event?, window-restored-event?, window-enter-event?,
window-leave-event?, window-focus-gained-event?,
window-focus-lost-event?, window-closed-event?): New procedures.
Diffstat (limited to 'sdl2/events.scm')
-rw-r--r-- | sdl2/events.scm | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/sdl2/events.scm b/sdl2/events.scm index 282fc34..f02490b 100644 --- a/sdl2/events.scm +++ b/sdl2/events.scm @@ -39,6 +39,20 @@ make-window-event window-event? + window-shown-event? + window-hidden-event? + window-exposed-event? + window-moved-event? + window-resized-event? + window-size-changed-event? + window-minimized-event? + window-maximized-event? + window-restored-event? + window-enter-event? + window-leave-event? + window-focus-gained-event? + window-focus-lost-event? + window-closed-event? window-event-timestamp window-event-window-id window-event-type @@ -132,6 +146,76 @@ (type window-event-type) (vector window-event-vector)) +(define (window-shown-event? e) + "Return #t if E is a window shown event." + (and (window-event? e) + (eq? 'shown (window-event-type e)))) + +(define (window-hidden-event? e) + "Return #t if E is a window hidden event." + (and (window-event? e) + (eq? 'hidden (window-event-type e)))) + +(define (window-exposed-event? e) + "Return #t if E is a window exposed event." + (and (window-event? e) + (eq? 'exposed (window-event-type e)))) + +(define (window-moved-event? e) + "Return #t if E is a window moved event." + (and (window-event? e) + (eq? 'moved (window-event-type e)))) + +(define (window-resized-event? e) + "Return #t if E is a window resized event." + (and (window-event? e) + (eq? 'resized (window-event-type e)))) + +(define (window-size-changed-event? e) + "Return #t if E is a window size changed event." + (and (window-event? e) + (eq? 'size-changed (window-event-type e)))) + +(define (window-minimized-event? e) + "Return #t if E is a window minimized event." + (and (window-event? e) + (eq? 'minimized (window-event-type e)))) + +(define (window-maximized-event? e) + "Return #t if E is a window maximized event." + (and (window-event? e) + (eq? 'maximized (window-event-type e)))) + +(define (window-restored-event? e) + "Return #t if E is a window restored event." + (and (window-event? e) + (eq? 'restored (window-event-type e)))) + +(define (window-enter-event? e) + "Return #t if E is a window enter event." + (and (window-event? e) + (eq? 'enter (window-event-type e)))) + +(define (window-leave-event? e) + "Return #t if E is a window leave event." + (and (window-event? e) + (eq? 'leave (window-event-type e)))) + +(define (window-focus-gained-event? e) + "Return #t if E is a window focus gained event." + (and (window-event? e) + (eq? 'focus-gained (window-event-type e)))) + +(define (window-focus-lost-event? e) + "Return #t if E is a window focus lost event." + (and (window-event? e) + (eq? 'focus-lost (window-event-type e)))) + +(define (window-closed-event? e) + "Return #t if E is a window closed event." + (and (window-event? e) + (eq? 'close (window-event-type e)))) + (define (parse-window-event ptr) (define (type-symbol n) (list-ref '(none |