Last active
August 29, 2015 14:05
-
-
Save AeroNotix/ff3d128c16b4abb31efd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LISPKIT> (macroexpand '(WITH-GDK-EVENT-SLOTS (window) (first (all-events)) | |
(print window))) | |
(LET ((WINDOW (FUNCALL #'|GDK:GDK-EVENT-KEY-WINDOW| (FIRST (ALL-EVENTS))))) | |
(PRINT WINDOW)) | |
T | |
LISPKIT> (eval (macroexpand '(WITH-GDK-EVENT-SLOTS (window) (first (all-events)) | |
(print window)))) | |
; in: | |
; LET ((WINDOW (FUNCALL #'|GDK:GDK-EVENT-KEY-WINDOW| (FIRST (ALL-EVENTS))))) | |
; (FUNCALL #'LISPKIT::|GDK:GDK-EVENT-KEY-WINDOW| (FIRST (LISPKIT::ALL-EVENTS))) | |
; ==> | |
; (SB-C::%FUNCALL #'LISPKIT::|GDK:GDK-EVENT-KEY-WINDOW| | |
; (FIRST (LISPKIT::ALL-EVENTS))) | |
; | |
; caught STYLE-WARNING: | |
; undefined function: |GDK:GDK-EVENT-KEY-WINDOW| | |
; | |
; compilation unit finished | |
; Undefined function: | |
; |GDK:GDK-EVENT-KEY-WINDOW| | |
; caught 1 STYLE-WARNING condition | |
; Evaluation aborted on #<UNDEFINED-FUNCTION GDK:GDK-EVENT-KEY-WINDOW {100862F1E3}>. | |
LISPKIT> (LET ((WINDOW (FUNCALL #'GDK:GDK-EVENT-KEY-WINDOW (FIRST (ALL-EVENTS))))) | |
(PRINT WINDOW)) | |
#<GDK-WINDOW {1009F60043}> | |
#<GDK-WINDOW {1009F60043}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun gdk-event-slot (slot) | |
(intern (format nil "GDK:GDK-EVENT-KEY-~a" slot))) | |
(defmacro with-gdk-event-slots (slots gdk-event &body body) | |
`(let (,@(mapcar #'(lambda (slot) | |
(let ((slot-name (gdk-event-slot slot))) | |
`(,slot (funcall #',slot-name ,gdk-event)))) | |
slots)) | |
,@body)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment