Correct the DEFPACKAGE for GOBJECT to work with recent closer-mop (0.60)
[cl-gtk2.git] / gdk / gdk.events.lisp
blobd3d2b6a0d22e27a5717cd9aa99dd8518cae9dc67
1 (in-package :gdk)
3 (defconstant +gdk-current-time+ 0)
5 (export '+gdk-current-time+)
7 (defconstant +gdk-priority-redraw+ (+ glib:+g-priority-high-idle+ 20))
9 (export '+gdk-priority-redraw+)
11 (defcfun (events-pending "gdk_events_pending") :boolean)
13 (export 'events-pending)
15 (defcfun (event-peek "gdk_event_peek") (g-boxed-foreign event :return))
17 (export 'event-peek)
19 (defcfun (event-get "gdk_event_get") (g-boxed-foreign event :return))
21 ;; ignored
22 ;; GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window);
24 (defcfun (event-put "gdk_event_put") :void
25 (event (g-boxed-foreign event)))
27 (export 'event-put)
29 (defcfun (event-get-time "gdk_event_get_time") :uint32
30 (event (g-boxed-foreign event)))
32 (export 'event-get-time)
34 (defcfun gdk_event_get_state :boolean
35 (event (g-boxed-foreign event))
36 (state (:pointer modifier-type)))
38 (defun event-get-state (event)
39 (with-foreign-object (state 'modifier-type)
40 (when (gdk_event_get_state event state)
41 (mem-ref state 'modifier-type))))
43 (export 'event-get-state)
45 (defcfun gdk_event_get_axis :boolean
46 (event (g-boxed-foreign event))
47 (axis-use axis-use)
48 (value (:pointer :double)))
50 (defun event-get-axis (event axis)
51 (with-foreign-object (value :double)
52 (when (gdk_event_get_axis event axis value)
53 (mem-ref value :double))))
55 (export 'event-get-axis)
57 (defcfun gdk_event_get_coords :boolean
58 (event (g-boxed-foreign event))
59 (x-win (:pointer :double))
60 (y-win (:pointer :double)))
62 (defun event-get-coords (event)
63 (with-foreign-objects ((x :double) (y :double))
64 (when (gdk_event_get_coords event x y)
65 (values (mem-ref x :double) (mem-ref y :double)))))
67 (export 'event-get-coords)
69 (defcfun gdk_event_get_root_coords :boolean
70 (event (g-boxed-foreign event))
71 (x-win (:pointer :double))
72 (y-win (:pointer :double)))
74 (defun event-get-root-coords (event)
75 (with-foreign-objects ((x :double) (y :double))
76 (when (gdk_event_get_root_coords event x y)
77 (values (mem-ref x :double) (mem-ref y :double)))))
79 (export 'event-get-root-coords)
81 (defcfun (event-request-motions "gdk_event_request_motions") :void
82 (event (g-boxed-foreign event)))
84 (export 'event-request-motions)
86 (defcallback gdk-event-func-callback :void
87 ((event (g-boxed-foreign event)) (user-data :pointer))
88 (restart-case
89 (funcall (get-stable-pointer-value user-data) event)
90 (return-from-callback () nil)))
92 (defcfun gdk_event_handler_set :void
93 (func :pointer)
94 (data :pointer)
95 (destroy-notify :pointer))
97 (defun event-handler-set (fn)
98 (gdk_event_handler_set (callback gdk-event-func-callback)
99 (allocate-stable-pointer fn)
100 (callback stable-pointer-free-destroy-notify-callback)))
102 (export 'event-handler-set)
104 (defcfun (event-send-client-message "gdk_event_send_client_message") :boolean
105 (event (g-boxed-foreign event))
106 (window-id native-window))
108 (export 'event-send-client-message)
110 (defcfun (event-send-client-message-for-display "gdk_event_send_client_message_for_display") :boolean
111 (display (g-object display))
112 (event (g-boxed-foreign event))
113 (window-id native-window))
115 (export 'event-send-client-message-for-display)
117 (defcfun (event-send-client-message-to-all "gdk_event_send_clientmessage_toall") :void
118 (event (g-boxed-foreign event)))
120 (export 'event-send-client-message-to-all)
122 (defcallback gdk-client-message-filter-func gdk-filter-return
123 ((xevent :pointer) (event :pointer) (data :pointer))
124 (multiple-value-bind (return-value translated-event) (funcall (stable-pointer-value data) xevent)
125 (when (eq return-value :translate)
126 (gobject:copy-boxed-slots-to-foreign translated-event event))
127 return-value))
129 (defcfun gdk_add_client_message_filter :void
130 (message-type gdk-atom-as-string)
131 (func :pointer)
132 (data :pointer))
134 (defun gdk-add-client-message-filter (message-type fn)
135 (gdk_add_client_message_filter message-type (callback gdk-client-message-filter-func) (allocate-stable-pointer fn)))
137 (export 'gdk-add-client-message-filter)
139 (defcfun gdk-get-show-events :boolean)
141 (export 'gdk-get-show-events)
143 (defcfun gdk-set-show-events :void
144 (show-events :boolean))
146 (export 'gdk-set-show-events)
148 ;; ignored:
149 ;; void gdk_event_set_screen (GdkEvent *event,
150 ;; GdkScreen *screen);
151 ;; GdkScreen * gdk_event_get_screen (const GdkEvent *event);
153 (defcfun gdk_setting_get :boolean
154 (name :string)
155 (value (:pointer g-value)))
157 (defun gdk-get-setting (name)
158 (with-foreign-object (value 'g-value)
159 (g-value-zero value)
160 (when (gdk_setting_get name value)
161 (prog1 (parse-g-value value)
162 (g-value-unset value)))))
164 (export 'gdk-get-setting)