Use gobject:with-foreign-boxed-array in Gdk
[cl-gtk2.git] / gdk / gdk.display.lisp
blob2d773f65388a6365cf7b1ee1832ef2d24771502c
1 (in-package :gdk)
3 (defcfun (display-open "gdk_display_open") (g-object display)
4 (display-name :string))
5 (export 'display-open)
7 (defcfun (default-display "gdk_display_get_default") (g-object display))
8 (export 'default-display)
10 (defcfun (display-get-screen "gdk_display_get_screen") (g-object screen)
11 (display (g-object display))
12 (screen-num :int))
13 (export 'display-get-screen)
15 (defcfun (display-pointer-ungrab "gdk_display_pointer_ungrab") :void
16 (display (g-object display))
17 (time :uint32))
18 (export 'display-pointer-ungrab)
20 (defcfun (display-keyboard-ungrab "gdk_display_keyboard_ungrab") :void
21 (display (g-object display))
22 (time :uint32))
23 (export 'display-keyboard-ungrab)
25 (defcfun (display-pointer-is-grabbed "gdk_display_pointer_is_grabbed") :boolean
26 (display (g-object display)))
27 (export 'display-pointer-is-grabbed)
29 (defcfun (display-beep "gdk_display_beep") :void
30 (display (g-object display)))
31 (export 'display-beep)
33 (defcfun (display-sync "gdk_display_sync") :void
34 (display (g-object display)))
35 (export 'display-sync)
37 (defcfun (display-flush "gdk_display_flush") :void
38 (display (g-object display)))
39 (export 'display-flush)
41 (defcfun (display-close "gdk_display_close") :void
42 (display (g-object display)))
43 (export 'display-close)
45 (defcfun (display-get-event "gdk_display_get_event") (g-boxed-foreign event :return)
46 (display (g-object display)))
47 (export 'display-get-event)
49 (defcfun (display-peek-event "gdk_display_peek_event") (g-boxed-foreign event :return)
50 (display (g-object display)))
51 (export 'display-peek-event)
53 (defcfun (display-put-event "gdk_display_put_event") :void
54 (display (g-object display))
55 (event (g-boxed-foreign event)))
56 (export 'display-put-event)
58 ;void gdk_display_add_client_message_filter
59 ; (GdkDisplay *display,
60 ; GdkAtom message_type,
61 ; GdkFilterFunc func,
62 ; gpointer data);
64 (defcfun (display-set-double-click-time "gdk_display_set_double_click_time") :void
65 (display (g-object display))
66 (msec :uint))
67 (export 'display-set-double-click-time)
69 (defcfun (display-set-double-click-distance "gdk_display_set_double_click_distance") :void
70 (display (g-object display))
71 (distance :uint))
72 (export 'display-set-double-click-distance)
74 (defcfun gdk-display-get-pointer :void
75 (display (g-object display))
76 (screen :pointer)
77 (x :pointer)
78 (y :pointer)
79 (mask :pointer))
81 (defun display-get-pointer (display)
82 (with-foreign-objects ((screen :pointer) (x :int) (y :int) (mask 'modifier-type))
83 (gdk-display-get-pointer display screen x y mask)
84 (values (mem-ref screen '(g-object screen))
85 (mem-ref x :int)
86 (mem-ref y :int)
87 (mem-ref mask :int))))
88 (export 'display-get-pointer)
90 (defcfun gdk-display-get-window-at-pointer (g-object gdk-window)
91 (display (g-object display))
92 (win-x :pointer)
93 (win-y :pointer))
95 (defun display-get-window-at-pointer (display)
96 (with-foreign-objects ((win-x :int) (win-y :int))
97 (let ((win (gdk-display-get-window-at-pointer display win-x win-y)))
98 (values win (mem-ref win-x :int) (mem-ref win-y :int)))))
100 (export 'display-get-window-at-pointer)
102 ;GdkDisplayPointerHooks * gdk_display_set_pointer_hooks (GdkDisplay *display,
103 ; const GdkDisplayPointerHooks *new_hooks);
105 (defcfun (display-warp-pointer "gdk_display_warp_pointer") :void
106 (display (g-object display))
107 (screen (g-object screen))
108 (x :int)
109 (y :int))
110 (export 'display-warp-pointer)
112 (defcfun gdk-display-get-maximal-cursor-size :void
113 (display (g-object display))
114 (width :pointer)
115 (height :pointer))
117 (defun display-get-maximal-cursor-size (display)
118 (with-foreign-objects ((width :uint) (height :uint))
119 (gdk-display-get-maximal-cursor-size display width height)
120 (values (mem-ref width :uint) (mem-ref height :uint))))
121 (export 'display-get-maximal-cursor-size)
123 (defcfun (display-request-selection-notification "gdk_display_request_selection_notification") :boolean
124 (display (g-object display))
125 (selection gdk-atom-as-string))
126 (export 'display-request-selection-notification)
128 (defcfun gdk-display-store-clipboard :void
129 (display (g-object display))
130 (clipboard-window (g-object gdk-window))
131 (time :uint32)
132 (targets :pointer)
133 (n-targets :int))
135 (defun display-store-clipboard (display clipboard-window time targets)
136 (let ((n-targets (length targets)))
137 (with-foreign-object (targets-ptr 'gdk-atom-as-string n-targets)
138 (loop
139 for str in targets
140 for i from 0
141 do (setf (mem-aref targets-ptr 'gdk-atom-as-string i) str))
142 (gdk-display-store-clipboard display clipboard-window time targets-ptr n-targets))))
143 (export 'display-store-clipboard)
145 (defcfun (display-manager-get "gdk_display_manager_get") (g-object display-manager))
146 (export 'display-manager-get)