Finish Gdk/Drawing-primitives and add sever Pango types
[cl-gtk2.git] / gdk / gdk.events.lisp
blob8fd27f6abae083c3d6a354cc2483564ae22ffbf0
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 ;; void gdk_add_client_message_filter (GdkAtom message_type,
123 ;; GdkFilterFunc func,
124 ;; gpointer data);
126 (defcfun gdk-get-show-events :boolean)
128 (export 'gdk-get-show-events)
130 (defcfun gdk-set-show-events :void
131 (show-events :boolean))
133 (export 'gdk-set-show-events)
135 ;; ignored:
136 ;; void gdk_event_set_screen (GdkEvent *event,
137 ;; GdkScreen *screen);
138 ;; GdkScreen * gdk_event_get_screen (const GdkEvent *event);
140 (defcfun gdk_setting_get :boolean
141 (name :string)
142 (value (:pointer g-value)))
144 (defun gdk-get-setting (name)
145 (with-foreign-object (value 'g-value)
146 (g-value-zero value)
147 (when (gdk_setting_get name value)
148 (prog1 (parse-g-value value)
149 (g-value-unset value)))))
151 (export 'gdk-get-setting)