1 /*
2  * Copyright (c) 2003 by the gtk2-perl team (see the file AUTHORS)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA  02110-1301  USA.
18  *
19  * $Id$
20  */
21 #include "gtk2perl.h"
22 
23 MODULE = Gtk2::Gdk	PACKAGE = Gtk2::Gdk	PREFIX = gdk_
24 
25 ##  void gdk_init (gint *argc, gchar ***argv)
26 gboolean
27 gdk_init (class=NULL)
28     ALIAS:
29 	Gtk2::Gdk::init_check = 1
30     PREINIT:
31 	GPerlArgv *pargv;
32     CODE:
33 	pargv = gperl_argv_new ();
34 
35 	if (ix == 1) {
36 		RETVAL = gdk_init_check (&pargv->argc, &pargv->argv);
37 	} else {
38 		gdk_init (&pargv->argc, &pargv->argv);
39 		/* gdk_init() either succeeds or does not return. */
40 		RETVAL = TRUE;
41 	}
42 
43 	gperl_argv_update (pargv);
44 	gperl_argv_free (pargv);
45     OUTPUT:
46 	RETVAL
47 
48 #if GTK_CHECK_VERSION(2,2,0)
49 
50 ##  void gdk_parse_args (gint *argc, gchar ***argv)
51 void
52 gdk_parse_args (class=NULL)
53     PREINIT:
54 	GPerlArgv *pargv;
55     CODE:
56 	pargv = gperl_argv_new ();
57 
58 	gdk_parse_args (&pargv->argc, &pargv->argv);
59 
60 	gperl_argv_update (pargv);
61 	gperl_argv_free (pargv);
62 
63 const gchar *
64 gdk_get_display_arg_name (class)
65     C_ARGS:
66 	/* void */
67 
68 
69 #endif /* >= 2.2.0 */
70 
71 ### deprecated
72 
73 
74 ##  gchar* gdk_set_locale (void)
75 gchar*
76 gdk_set_locale (class)
77     C_ARGS:
78 	/* void */
79 
80 
81 ## allow NULL to remove the property
82 void
83 gdk_set_sm_client_id (class, sm_client_id=NULL)
84 	const gchar_ornull * sm_client_id
85     C_ARGS:
86 	sm_client_id
87 
88 #if GTK_CHECK_VERSION(2,2,0)
89 
90 ##  void gdk_notify_startup_complete (void)
91 void
92 gdk_notify_startup_complete (class)
93     C_ARGS:
94 	/* void */
95 
96 #endif /* 2.2.0 */
97 
98 #if GTK_CHECK_VERSION(2, 12, 0)
99 
100 void gdk_notify_startup_complete_with_id (class, const gchar* startup_id)
101     C_ARGS:
102 	startup_id
103 
104 #endif
105 
106 const char *
107 gdk_get_program_class (class)
108     C_ARGS:
109 	/* void */
110 
111 void
112 gdk_set_program_class (class, program_class)
113 	const char *program_class
114     C_ARGS:
115 	program_class
116 
117 ##  gchar* gdk_get_display (void)
118 gchar *
119 gdk_get_display (class)
120     C_ARGS:
121 	/* void */
122     CLEANUP:
123 	/* in versions later than 2.2.0, this string is malloc'd. */
124 	if (NULL == gtk_check_version (2, 2, 0))
125 		g_free (RETVAL);
126 
127 ##  void gdk_flush (void)
128 void
129 gdk_flush (class)
130     C_ARGS:
131 	/* void */
132 
133 
134 gint
135 screen_width (class)
136     ALIAS:
137 	Gtk2::Gdk::screen_height = 1
138 	Gtk2::Gdk::screen_width_mm = 2
139 	Gtk2::Gdk::screen_height_mm = 3
140     CODE:
141 	switch (ix) {
142 		case 0: RETVAL = gdk_screen_width (); break;
143 		case 1: RETVAL = gdk_screen_height (); break;
144 		case 2: RETVAL = gdk_screen_width_mm (); break;
145 		case 3: RETVAL = gdk_screen_height_mm (); break;
146 		default:
147 			RETVAL = 0;
148 			g_assert_not_reached ();
149 	}
150     OUTPUT:
151 	RETVAL
152 
153 ##  GdkGrabStatus gdk_pointer_grab (GdkWindow *window, gboolean owner_events, GdkEventMask event_mask, GdkWindow *confine_to, GdkCursor *cursor, guint32 time_)
154 GdkGrabStatus
155 gdk_pointer_grab (class, window, owner_events, event_mask, confine_to, cursor, time_)
156 	GdkWindow        * window
157 	gboolean           owner_events
158 	GdkEventMask       event_mask
159 	GdkWindow_ornull * confine_to
160 	GdkCursor_ornull * cursor
161 	guint32            time_
162     C_ARGS:
163 	window, owner_events, event_mask, confine_to, cursor, time_
164 
165 ##  void gdk_pointer_ungrab (guint32 time_)
166 void
167 gdk_pointer_ungrab (class, time_)
168 	guint32 time_
169     C_ARGS:
170 	time_
171 
172 ##  gboolean gdk_pointer_is_grabbed (void)
173 gboolean
174 gdk_pointer_is_grabbed (class)
175     C_ARGS:
176 	/* void */
177 
178 ##  GdkGrabStatus gdk_keyboard_grab (GdkWindow *window, gboolean owner_events, guint32 time_)
179 GdkGrabStatus
180 gdk_keyboard_grab (class, window, owner_events, time_)
181 	GdkWindow *window
182 	gboolean owner_events
183 	guint32 time_
184     C_ARGS:
185 	window, owner_events, time_
186 
187 ##  void gdk_keyboard_ungrab (guint32 time_)
188 void
189 gdk_keyboard_ungrab (class, time_)
190 	guint32 time_
191     C_ARGS:
192 	time_
193 
194 ##  void gdk_beep (void)
195 void
196 gdk_beep (class)
197     C_ARGS:
198 	/* void */
199 
200 ### deprecated
201 ##  gboolean gdk_get_use_xshm (void)
202 ##  void gdk_set_use_xshm (gboolean use_xshm)
203 
204 
205 ##  void gdk_error_trap_push (void)
206 void
207 gdk_error_trap_push (class)
208     C_ARGS:
209 	/* void */
210 
211 ##  gint gdk_error_trap_pop (void)
212 gint
213 gdk_error_trap_pop (class)
214     C_ARGS:
215 	/* void */
216 
217 ### deprecated in favor of Glib::IO::add_watch etc
218 ##  gint gdk_input_add_full (gint source, GdkInputCondition condition, GdkInputFunction function, gpointer data, GdkDestroyNotify destroy)
219 ##  gint gdk_input_add (gint source, GdkInputCondition condition, GdkInputFunction function, gpointer data)
220 ##  void gdk_input_remove (gint tag)
221 
222 ### applications should not set this.
223 ##  void gdk_set_double_click_time (guint msec)
224 
225 MODULE = Gtk2::Gdk	PACKAGE = Gtk2::Gdk::Rectangle	PREFIX = gdk_rectangle_
226 
227 ##  gboolean gdk_rectangle_intersect (GdkRectangle *src1, GdkRectangle *src2, GdkRectangle *dest)
228 GdkRectangle_copy *
229 gdk_rectangle_intersect (src1, src2)
230 	GdkRectangle *src1
231 	GdkRectangle *src2
232     PREINIT:
233 	GdkRectangle dest;
234     CODE:
235 	if (!gdk_rectangle_intersect (src1, src2, &dest))
236 		XSRETURN_UNDEF;
237 	RETVAL = &dest;
238     OUTPUT:
239 	RETVAL
240 
241 ##  void gdk_rectangle_union (GdkRectangle *src1, GdkRectangle *src2, GdkRectangle *dest)
242 GdkRectangle_copy *
243 gdk_rectangle_union (src1, src2)
244 	GdkRectangle *src1
245 	GdkRectangle *src2
246     PREINIT:
247 	GdkRectangle dest;
248     CODE:
249 	gdk_rectangle_union (src1, src2, &dest);
250 	RETVAL = &dest;
251     OUTPUT:
252 	RETVAL
253 
254 MODULE = Gtk2::Gdk	PACKAGE = Gtk2::Gdk	PREFIX = gdk_
255 
256 ### not bound, in favor of native perl support for unicode and utf8.
257 ##  gchar *gdk_wcstombs (const GdkWChar *src)
258 ##  gint gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max)
259 
260 MODULE = Gtk2::Gdk	PACKAGE = Gtk2::Gdk::Event	PREFIX = gdk_event_
261 
262 ##  gboolean gdk_event_send_client_message (GdkEvent *event, GdkNativeWindow winid)
263 gboolean
264 gdk_event_send_client_message (class, event, winid)
265 	GdkEvent *event
266 	GdkNativeWindow winid
267     C_ARGS:
268 	event, winid
269 
270 ##  void gdk_event_send_clientmessage_toall (GdkEvent *event)
271 void
272 gdk_event_send_clientmessage_toall (class, event)
273 	GdkEvent *event
274     C_ARGS:
275 	event
276 
277 #if GTK_CHECK_VERSION (2, 2, 0)
278 
279 ##  gboolean gdk_event_send_client_message_for_display (GdkDisplay *display, GdkEvent *event, GdkNativeWindow winid)
280 gboolean
281 gdk_event_send_client_message_for_display (class, display, event, winid)
282 	GdkDisplay *display
283 	GdkEvent *event
284 	GdkNativeWindow winid
285     C_ARGS:
286 	display, event, winid
287 
288 #endif
289 
290 MODULE = Gtk2::Gdk	PACKAGE = Gtk2::Gdk::Threads	PREFIX = gdk_threads_
291 
292 ###  void gdk_threads_enter (void)
293 ###  void gdk_threads_leave (void)
294 ###  void gdk_threads_init (void)
295 
296 void
297 gdk_threads_init (class)
298     ALIAS:
299 	enter = 1
300 	leave = 2
301     CODE:
302 	switch (ix) {
303 		case 0: gdk_threads_init (); break;
304 		case 1: gdk_threads_enter (); break;
305 		case 2: gdk_threads_leave (); break;
306 		default:
307 			g_assert_not_reached ();
308 	}
309