1/* x11.vapi
2 *
3 * Copyright (C) 2009  Jürg Billeter
4 * Copyright (C) 2011  Alexander Kurtz
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
19 *
20 * Authors:
21 * 	Jürg Billeter <j@bitron.ch>
22 *  Alexander Kurtz <kurtz.alex@googlemail.com>
23 */
24
25[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "X11/Xlib.h,X11/Xatom.h,X11/Xutil.h,X11/Xregion.h")]
26namespace X {
27	// Note: must be called before opening a display or calling any other Xlib function,
28	// see http://tronche.com/gui/x/xlib/display/XInitThreads.html
29	[CCode (cname = "XInitThreads")]
30	public Status init_threads ();
31
32	[Compact]
33	[CCode (cname = "Display", ref_function = "", unref_function = "")]
34	public class Display {
35		[CCode (cname = "XOpenDisplay")]
36		public Display (string? name = null);
37
38		[CCode (cname = "XAllPlanes")]
39		public static ulong get_all_planes ();
40
41		[CCode (cname = "XActivateScreenSaver")]
42		public void activate_screensaver ();
43
44		[CCode (cname = "XAddToSaveSet")]
45		public int add_to_save_set (Window w);
46
47		[CCode (cname = "XAllowEvents")]
48		public int allow_events (int event_mode, int time);
49
50		[CCode (cname = "XBitmapBitOrder")]
51		public int bitmap_bit_order ();
52
53		[CCode (cname = "XBitmapUnit")]
54		public int bitmap_scanline_unit ();
55
56		[CCode (cname = "XBitmapPad")]
57		public int bitmap_scanline_padding ();
58
59		[CCode (cname = "XChangeProperty")]
60		public int change_property (Window w, Atom property, Atom type, int format, int mode, [CCode (array_length = false)] uchar[] data, int nelements);
61
62		[CCode (cname = "XChangeWindowAttributes")]
63		public int change_window_attributes (Window w, ulong valuemask, SetWindowAttributes attributes);
64
65		[CCode (cname = "XConfigureWindow")]
66		public int configure_window (Window w, uint value_mask, WindowChanges values);
67
68		[CCode (cname = "ConnectionNumber")]
69		public int connection_number ();
70
71		[CCode (cname = "DefaultRootWindow")]
72		public Window default_root_window ();
73
74		[CCode (cname = "XDefaultScreenOfDisplay")]
75		public unowned Screen default_screen ();
76
77		[CCode (cname = "XScreenOfDisplay")]
78		public unowned Screen screen_by_id (int screen_number);
79
80		[CCode (cname = "DisplayString")]
81		public string display_string ();
82
83		[CCode (cname = "XQLength")]
84		public int event_queue_length ();
85
86		[CCode (cname = "XFlush")]
87		public int flush ();
88
89		[CCode (cname = "XForceScreenSaver")]
90		public void force_screensaver (int mode);
91
92		[CCode (cname = "XGetKeyboardMapping", array_length = false)]
93		public unowned uint[] get_keyboard_mapping (uint first_keycode, int keycode_count, ref int keysyms_per_keycode_return);
94
95		[CCode (cname = "XGetModifierMapping")]
96		public ModifierKeymap get_modifier_mapping ();
97
98		[CCode (cname = "XGetScreenSaver")]
99		public void get_screensaver (out int timeout, out int interval, out int prefer_blanking, out int allow_exposures);
100
101		[CCode (cname = "XGetSelectionOwner")]
102		public Window get_selection_owner (Atom selection);
103
104		[CCode (cname = "XGetWindowAttributes")]
105		public void get_window_attributes (Window w, out WindowAttributes window_attributes_return);
106
107		[CCode (cname = "XGetWindowProperty")]
108		public int get_window_property (Window w, Atom property, long long_offset, long long_length, bool delete, Atom req_type, out Atom actual_type_return, out int actual_format_return, out ulong nitems_return, out ulong bytes_after_return, [CCode (type = "unsigned char **")] out void* prop_return);
109
110		[CCode (cname = "XGrabButton")]
111		public int grab_button (uint button, uint modifiers, Window grab_window, bool owner_events, uint event_mask, int pointer_mode, int keyboard_mode, Window confine_to, uint cursor);
112
113		[CCode (cname = "XGrabKey")]
114		public int grab_key (int keycode, uint modifiers, Window grab_window, bool owner_events, int pointer_mode, int keyboard_mode);
115
116		[CCode (cname = "XGrabPointer")]
117		public int grab_pointer (Window grab_window, bool owner_events, uint event_mask, int pointer_mode, int keyboard_mode, Window confine_to, uint cursor, int time);
118
119		[CCode (cname = "XGrabServer")]
120		public int grab_server ();
121
122		[CCode (cname = "XImageByteOrder")]
123		public int image_byte_order ();
124
125		[CCode (cname = "XInternAtom")]
126		public Atom intern_atom (string atom_name, bool only_if_exists);
127
128		[CCode (cname = "XInternAtoms")]
129		public void intern_atoms (string[] names, bool only_if_exists, [CCode (array_length = false)] Atom[] atoms_return);
130
131		[CCode (cname = "XInternalConnectionNumbers")]
132		public Status internal_connection_numbers (ref int[] fd_return);
133
134		[CCode (cname = "XDisplayKeycodes")]
135		public int keycodes (ref int min_keycodes_return, ref int max_keycodes_return);
136
137		[CCode (cname = "XKeysymToKeycode")]
138		public int keysym_to_keycode (uint keysym);
139
140		[CCode (cname = "XLastKnownRequestProcessed")]
141		public ulong last_known_request_processed ();
142
143		[CCode (cname = "XLockDisplay")]
144		public void lock_display ();
145
146		[CCode (cname = "XMapWindow")]
147		public int map_window (Window w);
148
149		[CCode (cname = "XMaxRequestSize")]
150		public long max_request_size ();
151
152		[CCode (cname = "XExtendedMaxRequestSize")]
153		public long max_extended_request_size ();
154
155		[CCode (cname = "XEventsQueued")]
156		public int events_queued (int mode);
157
158		[CCode (cname = "XNextEvent")]
159		public int next_event (ref Event event_return);
160
161		[CCode (cname = "XNextRequest")]
162		public ulong next_request ();
163
164		[CCode (cname = "XNoOp")]
165		public void no_operation ();
166
167		[CCode (cname = "XScreenCount")]
168		public int number_of_screens ();
169
170		[CCode (cname = "XPending")]
171		public int pending ();
172
173		[CCode (cname = "XProcessInternalConnection")]
174		public void process_internal_connection (int fd);
175
176		[CCode (cname = "XProtocolVersion")]
177		public int protocol_version ();
178
179		[CCode (cname = "XProtocolRevision")]
180		public int protocol_revision ();
181
182		[CCode (cname = "XRaiseWindow")]
183		public int raise_window (Window w);
184
185		[CCode (cname = "XReparentWindow")]
186		public int reparent_window (Window w, Window parent, int x, int y);
187
188		[CCode (cname = "XResetScreenSaver")]
189		public void reset_screensaver ();
190
191		[CCode (cname = "XResizeWindow")]
192		public int resize_window (Window w, uint width, uint height);
193
194		[CCode (cname = "XRootWindow")]
195		public Window root_window (int screen_number);
196
197		[CCode (cname = "ScreenCount")]
198		public int screen_count ();
199
200		[CCode (cname = "XScreenOfDisplay")]
201		public unowned Screen screen_of_display (int screen_number);
202
203		[CCode (cname = "XSelectInput")]
204		public int select_input (Window w, long event_mask);
205
206		[CCode (cname = "XSendEvent")]
207		public void send_event (Window w, bool propagate, long event_mask, ref Event event_send);
208
209		[CCode (cname = "XSetCloseDownMode")]
210		public void set_close_down_mode (int close_mode);
211
212		[CCode (cname = "XSetScreenSaver")]
213		public void set_screensaver (int timeout, int interval, int prefer_blanking, int allow_exposures);
214
215		[CCode (cname = "XSetSelectionOwner")]
216		public Window set_selection_owner (Atom selection, Window owner, int time);
217
218		[CCode (cname = "XSetInputFocus")]
219		public int set_input_focus (Window focus, int revert_to, int time);
220
221		[CCode (cname = "XUngrabButton")]
222		public int ungrab_button (uint button, uint modifiers, Window grab_window);
223
224		[CCode (cname = "XUngrabKey")]
225		public int ungrab_key (int keycode, uint modifiers, Window grab_window);
226
227		[CCode (cname = "XUngrabPointer")]
228		public int ungrab_pointer (int time);
229
230		[CCode (cname = "XUngrabServer")]
231		public int ungrab_server ();
232
233		[CCode (cname = "XUnlockDisplay")]
234		public void unlock_display ();
235
236		[CCode (cname = "XUnmapWindow")]
237		public int unmap_window (Window w);
238
239		[CCode (cname = "XQueryTree")]
240		public void query_tree (Window w, out Window root_return, out Window parent_return, out Window[] children_return);
241
242		[CCode (cname = "XWindowEvent")]
243		public int window_event (Window w, EventMask event_mask, out Event event_return);
244
245		[CCode (cname = "XServerVendor")]
246		public string xserver_vendor_name ();
247
248		[CCode (cname = "XVendorRelease")]
249		public string xserver_vendor_release ();
250
251		[CCode (cname = "XMoveWindow")]
252		public void move_window (Window window, int x, int y);
253	}
254
255	[Compact]
256	[CCode (cname = "XModifierKeymap", free_function = "XFreeModifiermap")]
257	public class ModifierKeymap {
258		// The server's max # of keys per modifier
259		public int max_keypermod;
260		// An 8 by max_keypermod array of modifiers
261		public uchar[] modifiermap;
262	}
263
264	[SimpleType]
265	[IntegerType (rank = 9)]
266	[CCode (cname = "Atom")]
267	public struct Atom {
268	}
269
270	[SimpleType]
271	[IntegerType (rank = 9)]
272	[CCode (cname = "Colormap")]
273	public struct Colormap {
274	}
275
276	[SimpleType]
277	[CCode (cname = "GC")]
278	public struct GC {
279	}
280
281	[SimpleType]
282	[IntegerType (rank = 9)]
283	[CCode (cname = "Status")]
284	public struct Status {
285	}
286
287	[SimpleType]
288	[IntegerType (rank = 9)]
289	[CCode (cname = "XID", type_id = "G_TYPE_INT",
290		marshaller_type_name = "INT",
291		get_value_function = "g_value_get_int",
292		set_value_function = "g_value_set_int", default_value = "0",
293		type_signature = "i")]
294	public struct ID {
295	}
296
297	[SimpleType]
298	[IntegerType (rank = 9)]
299	[CCode (cname = "Drawable", type_id = "G_TYPE_INT",
300		marshaller_type_name = "INT",
301		get_value_function = "g_value_get_int",
302		set_value_function = "g_value_set_int", default_value = "0",
303		type_signature = "i")]
304	public struct Drawable : ID
305	{
306	}
307
308	[SimpleType]
309	[IntegerType (rank = 9)]
310	[CCode (cname = "Window", type_id = "G_TYPE_INT",
311		marshaller_type_name = "INT",
312		get_value_function = "g_value_get_int",
313		set_value_function = "g_value_set_int", default_value = "0",
314		type_signature = "i")]
315	public struct Window : Drawable {
316	}
317
318
319	[SimpleType]
320	[IntegerType (rank = 9)]
321	[CCode (cname = "Pixmap", type_id = "G_TYPE_INT",
322		marshaller_type_name = "INT",
323		get_value_function = "g_value_get_int",
324		set_value_function = "g_value_set_int", default_value = "0",
325		type_signature = "i")]
326	public struct Pixmap : Drawable	{
327	}
328
329	[SimpleType]
330	[IntegerType (rank = 9)]
331	[CCode (cname = "Mask")]
332	public struct Mask {
333	}
334
335	[SimpleType]
336	[IntegerType (rank = 9)]
337	[CCode (cname = "VisualID")]
338	public struct VisualID {
339	}
340
341	[SimpleType]
342	[IntegerType (rank = 9)]
343	[CCode (cname = "Time")]
344	public struct Time {
345	}
346
347	[SimpleType]
348	[IntegerType (rank = 9)]
349	[CCode (cname = "Cursor")]
350	public struct Cursor {
351	}
352
353	[SimpleType]
354	[IntegerType (rank = 9)]
355	[CCode (cname = "GContext")]
356	public struct GContext {
357	}
358
359	[SimpleType]
360	[IntegerType (rank = 9)]
361	[CCode (cname = "KeySym")]
362	public struct KeySym {
363	}
364
365	[SimpleType]
366	[IntegerType (rank = 9)]
367	[CCode (cname = "KeyCode")]
368	public struct KeyCode {
369	}
370
371	public struct Visual {
372	}
373
374	public struct WindowChanges {
375		public int x;
376		public int y;
377		public int width;
378		public int height;
379		public int border_width;
380		public Window sibling;
381		public int stack_mode;
382	}
383	public struct SizeHints {
384		public long @flags;
385		public int x;
386		public int y;
387		public int width;
388		public int height;
389	}
390
391	[CCode (cname = "XCreateWindow")]
392	public Window create_window (Display display, Window parent, int x, int y, uint width, uint height, uint border_width, int depth, uint @class, Visual? visual, X.CW valuemask, ref SetWindowAttributes attributes);
393
394	[CCode (cname = "XSetWindowAttributes")]
395	public struct SetWindowAttributes {
396		// public Pixmap background_pixmap;	/* background or None or ParentRelative */
397		public ulong background_pixel;	/* background pixel */
398		// public Pixmap border_pixmap;	/* border of the window */
399		public ulong border_pixel;	/* border pixel value */
400		public int bit_gravity;		/* one of bit gravity values */
401		public int win_gravity;		/* one of the window gravity values */
402		public int backing_store;		/* NotUseful, WhenMapped, Always */
403		public ulong backing_planes;/* planes to be preseved if possible */
404		public ulong backing_pixel;/* value to use in restoring planes */
405		public bool save_under;		/* should bits under be saved? (popups) */
406		public long event_mask;		/* set of events that should be saved */
407		public long do_not_propagate_mask;	/* set of events that should not propagate */
408		public bool override_redirect;	/* boolean value for override-redirect */
409		// public Colormap colormap;		/* color map to be associated with window */
410		// public Cursor cursor;		/* cursor to be displayed (or None) */
411	}
412
413	[CCode(cname = "XWindowAttributes",
414	       cheader_filename = "X11/Xlib.h,X11/Xatom.h,X11/Xutil.h")]
415	public struct WindowAttributes {
416		public int x;
417		public int y;			/* location of window */
418		public int width;
419		public int height;		/* width and height of window */
420		public int border_width;		/* border width of window */
421		public int depth;          	/* depth of window */
422		public Visual visual;		/* the associated visual structure */
423		public Window root;        	/* root of screen containing window */
424		public int @class;			/* InputOutput, InputOnly*/
425		public int bit_gravity;		/* one of bit gravity values */
426		public int win_gravity;		/* one of the window gravity values */
427		public int backing_store;		/* NotUseful, WhenMapped, Always */
428		public ulong backing_planes;/* planes to be preserved if possible */
429		public ulong backing_pixel;/* value to be used when restoring planes */
430		public bool save_under;		/* boolean, should bits under be saved? */
431		// public Colormap colormap;		/* color map to be associated with window */
432		public bool map_installed;		/* boolean, is color map currently installed*/
433		public int map_state;		/* IsUnmapped, IsUnviewable, IsViewable */
434		public long all_event_masks;	/* set of events all people have interest in*/
435		public long your_event_mask;	/* my event mask */
436		public long do_not_propagate_mask; /* set of events that should not propagate */
437		public bool override_redirect;	/* boolean value for override-redirect */
438		// public Screen screen;		/* back pointer to correct screen */
439	}
440
441	[CCode (cname = "CopyFromParent")]
442	public const int COPY_FROM_PARENT;
443
444	[CCode (cname = "CurrentTime")]
445	public const ulong CURRENT_TIME;
446
447	[CCode (cname = "Success")]
448	public int Success;
449
450	[CCode (cname = "XFree")]
451	public int free (void* data);
452
453	[CCode (cprefix = "CW", cname = "int")]
454	public enum CW {
455		BackPixmap,
456		BackPixel,
457		BackingStore,
458		BackingPlanes,
459		BackingPixel,
460		BitGravity,
461		BorderPixmap,
462		BorderPixel,
463		BorderWidth,
464		Colormap,
465		Cursor,
466		DontPropagate,
467		EventMask,
468		Height,
469		OverrideRedirect,
470		SaveUnder,
471		Sibling,
472		StackMode,
473		X,
474		Y,
475		Width,
476		WinGravity
477	}
478
479	[CCode (cprefix = "GrabMode")]
480	public enum GrabMode {
481		Sync,
482		Async
483	}
484
485	[CCode (cprefix = "")]
486	public enum EventMask {
487		NoEventMask,
488		KeyPressMask,
489		KeyReleaseMask,
490		ButtonPressMask,
491		ButtonReleaseMask,
492		EnterWindowMask,
493		LeaveWindowMask,
494		PointerMotionMask,
495		PointerMotionHintMask,
496		Button1MotionMask,
497		Button2MotionMask,
498		Button3MotionMask,
499		Button4MotionMask,
500		Button5MotionMask,
501		ButtonMotionMask,
502		KeymapStateMask,
503		ExposureMask,
504		VisibilityChangeMask,
505		StructureNotifyMask,
506		ResizeRedirectMask,
507		SubstructureNotifyMask,
508		SubstructureRedirectMask,
509		FocusChangeMask,
510		PropertyChangeMask,
511		ColormapChangeMask,
512		OwnerGrabButtonMask
513	}
514
515	[CCode (cprefix = "")]
516	public enum KeyMask {
517		ShiftMask,
518		LockMask,
519		ControlMask,
520		Mod1Mask,
521		Mod2Mask,
522		Mod3Mask,
523		Mod4Mask,
524		Mod5Mask
525	}
526
527	[CCode (cprefix = "")]
528	public enum EventType {
529		KeyPress,
530		KeyRelease,
531		ButtonPress,
532		ButtonRelease,
533		MotionNotify,
534		EnterNotify,
535		LeaveNotify,
536		FocusIn,
537		FocusOut,
538		KeymapNotify,
539		Expose,
540		GraphicsExpose,
541		NoExpose,
542		VisibilityNotify,
543		CreateNotify,
544		DestroyNotify,
545		UnmapNotify,
546		MapNotify,
547		MapRequest,
548		ReparentNotify,
549		ConfigureNotify,
550		ConfigureRequest,
551		GravityNotify,
552		ResizeRequest,
553		CirculateNotify,
554		CirculateRequest,
555		PropertyNotify,
556		SelectionClear,
557		SelectionRequest,
558		SelectionNotify,
559		ColormapNotify,
560		ClientMessage,
561		MappingNotify
562	}
563
564	// union
565	[CCode (cname = "XEvent")]
566	public struct Event {
567		public int type;
568		public AnyEvent xany;
569		public KeyEvent xkey;
570		public ButtonEvent xbutton;
571		public MotionEvent xmotion;
572		public CrossingEvent xcrossing;
573		public CreateWindowEvent xcreatewindow;
574		public DestroyWindowEvent xdestroywindow;
575		public UnmapEvent xunmap;
576		public MapEvent xmap;
577		public MapRequestEvent xmaprequest;
578		public ReparentEvent xreparent;
579		public ConfigureEvent xconfigure;
580		public GravityEvent xgravity;
581		public ConfigureRequestEvent xconfigurerequest;
582		public CirculateEvent xcirculate;
583		public CirculateRequestEvent xcirculaterequest;
584		public PropertyEvent xproperty;
585		public SelectionEvent xselection;
586		public ClientMessageEvent xclient;
587	}
588
589	[CCode (cname = "XAnyEvent")]
590	public struct AnyEvent {
591		public int type;
592		public ulong serial;
593		public bool send_event;
594		public unowned Display display;
595		public Window window;
596	}
597
598	[CCode (cname = "XKeyEvent")]
599	public struct KeyEvent {
600		public int type;
601		public ulong serial;
602		public bool send_event;
603		public unowned Display display;
604		public Window window;
605		public Window root;
606		public Window subwindow;
607		public ulong time;
608		public int x;
609		public int y;
610		public int x_root;
611		public int y_root;
612		public uint state;
613		public uint keycode;
614		public bool same_screen;
615	}
616
617	[CCode (cname = "XButtonEvent")]
618	public struct ButtonEvent {
619		public int type;
620		public ulong serial;
621		public bool send_event;
622		public unowned Display display;
623		public Window window;
624		public Window subwindow;
625		public ulong time;
626		public int x;
627		public int y;
628		public int x_root;
629		public int y_root;
630		public uint state;
631		public uint button;
632		public bool same_screen;
633	}
634
635	[CCode (cname = "XMotionEvent")]
636	public struct MotionEvent {
637		public int type;
638		public ulong serial;
639		public bool send_event;
640		public unowned Display display;
641		public Window window;
642		public Window subwindow;
643		public ulong time;
644		public int x;
645		public int y;
646		public int x_root;
647		public int y_root;
648		public uint state;
649		public char is_hint;
650		public bool same_screen;
651	}
652
653	[CCode (cname = "XCrossingEvent")]
654	public struct CrossingEvent {
655		public int type;
656		public ulong serial;
657		public bool send_event;
658		public unowned Display display;
659		public Window window;
660		public Window root;
661		public Window subwindow;
662		public ulong time;
663		public int x;
664		public int y;
665		public int x_root;
666		public int y_root;
667		public int mode;
668		public int detail;
669		public bool same_screen;
670		public bool focus;
671		public uint state;
672	}
673
674	[CCode (cname = "XCreateWindowEvent")]
675	public struct CreateWindowEvent {
676		public int type;
677		public ulong serial;
678		public bool send_event;
679		public unowned Display display;
680		public Window parent;
681		public Window window;
682		public int x;
683		public int y;
684		public int width;
685		public int height;
686		public int border_width;
687		public bool override_redirect;
688	}
689
690	[CCode (cname = "XDestroyWindowEvent")]
691	public struct DestroyWindowEvent {
692		public int type;
693		public ulong serial;
694		public bool send_event;
695		public unowned Display display;
696		public Window event;
697		public Window window;
698	}
699
700	[CCode (cname = "XUnmapEvent")]
701	public struct UnmapEvent {
702		public int type;
703		public ulong serial;
704		public bool send_event;
705		public unowned Display display;
706		public Window event;
707		public Window window;
708		public bool from_configure;
709	}
710
711	[CCode (cname = "XMapEvent")]
712	public struct MapEvent {
713		public int type;
714		public ulong serial;
715		public bool send_event;
716		public unowned Display display;
717		public Window event;
718		public Window window;
719		public bool override_redirect;
720	}
721
722	[CCode (cname = "XMapRequestEvent")]
723	public struct MapRequestEvent {
724		public int type;
725		public ulong serial;
726		public bool send_event;
727		public unowned Display display;
728		public Window parent;
729		public Window window;
730	}
731
732	[CCode (cname = "XReparentEvent")]
733	public struct ReparentEvent {
734		public int type;
735		public ulong serial;
736		public bool send_event;
737		public unowned Display display;
738		public Window event;
739		public Window window;
740		public Window parent;
741		public int x;
742		public int y;
743		public bool override_redirect;
744	}
745
746	[CCode (cname = "XConfigureEvent")]
747	public struct ConfigureEvent {
748		public int type;
749		public ulong serial;
750		public bool send_event;
751		public unowned Display display;
752		public Window event;
753		public Window window;
754		public int x;
755		public int y;
756		public int width;
757		public int height;
758		public int border_width;
759		public Window above;
760		public bool override_redirect;
761	}
762
763	[CCode (cname = "XGravityEvent")]
764	public struct GravityEvent {
765		public int type;
766		public ulong serial;
767		public bool send_event;
768		public unowned Display display;
769		public Window event;
770		public Window window;
771		public int x;
772		public int y;
773	}
774
775	[CCode (cname = "XConfigureRequestEvent")]
776	public struct ConfigureRequestEvent {
777		public int type;
778		public ulong serial;
779		public bool send_event;
780		public unowned Display display;
781		public Window parent;
782		public Window window;
783		public int x;
784		public int y;
785		public int width;
786		public int height;
787		public int border_width;
788		public Window above;
789		public int detail;
790		public ulong value_mask;
791	}
792
793	[CCode (cname = "XCirculateEvent")]
794	public struct CirculateEvent {
795		public int type;
796		public ulong serial;
797		public bool send_event;
798		public unowned Display display;
799		public Window event;
800		public Window window;
801		public int place;
802	}
803
804	[CCode (cname = "XCirculateRequestEvent")]
805	public struct CirculateRequestEvent {
806		public int type;
807		public ulong serial;
808		public bool send_event;
809		public unowned Display display;
810		public Window parent;
811		public Window window;
812		public int place;
813	}
814
815	[CCode (cname = "XPropertyEvent")]
816	public struct PropertyEvent {
817		public int type;
818		public ulong serial;
819		public bool send_event;
820		public unowned Display display;
821		public Window window;
822		public Atom atom;
823		public ulong time;
824		public int state;
825	}
826
827	[CCode (cname = "XSelectionEvent")]
828	public struct SelectionEvent {
829		public int type;
830		public ulong serial;
831		public bool send_event;
832		public unowned Display display;
833		public Window requestor;
834		public Atom selection;
835		public Atom target;
836		public Atom property;
837		public ulong time;
838	}
839
840	[CCode (cname = "XClientMessageEvent")]
841	public struct ClientMessageEvent {
842		public int type;
843		public ulong serial;	/* # of last request processed by server */
844		public bool send_event;	/* true if this came from a SendEvent request */
845		public unowned Display display;	/* Display the event was read from */
846		public Window window;
847		public Atom message_type;
848		public int format;
849		public ClientMessageEventData data;
850	}
851
852	[CCode (cname = "RECTANGLE", has_type_id = false)]
853	public struct Rectangle {
854		public short x;
855		public short y;
856		public short width;
857		public short height;
858	}
859
860	// union
861	public struct ClientMessageEventData {
862		public unowned char[] b;
863		public unowned short[] s;
864		public unowned long[] l;
865	}
866
867	[CCode (cprefix = "Queued")]
868	public enum QueuedMode {
869		Already,
870		AfterFlush,
871		AfterReading
872	}
873
874	[CCode (cprefix = "PropMode")]
875	public enum PropMode {
876		Replace,
877		Prepend,
878		Append
879	}
880
881	[CCode (cprefix = "")]
882	public enum AllowEventsMode {
883		AsyncPointer,
884		SyncPointer,
885		ReplayPointer,
886		AsyncKeyboard,
887		SyncKeyboard,
888		ReplayKeyboard,
889		AsyncBoth,
890		SyncBoth
891	}
892
893	[CCode (cprefix = "")]
894	public enum MapState {
895		IsUnmapped,
896		IsUnviewable,
897		IsViewable
898	}
899
900	[CCode (cprefix = "RevertTo")]
901	public enum RevertTo {
902		None,
903		PointerRoot,
904		Parent
905	}
906
907	[Compact]
908	[CCode (cname = "Screen")]
909	public class Screen {
910		public Display display;
911		public Window root;
912		public int width;
913		public int height;
914
915		[CCode (cname = "XScreenOfDisplay")]
916		public static unowned Screen get_screen (Display disp, int screen_number);
917
918		[CCode (cname = "XBlackPixelOfScreen")]
919		public ulong black_pixel_of_screen ();
920
921		[CCode (cname = "XCellsOfScreen")]
922		public int cells_of_screen ();
923
924		[CCode (cname = "XDefaultColormapOfScreen")]
925		public Colormap default_colormap_of_screen ();
926
927		[CCode (cname = "XDefaultDepthOfScreen")]
928		public int default_depth_of_screen ();
929
930		[CCode (cname = "XDefaultGCOfScreen")]
931		public GC default_gc_of_screen ();
932
933		[CCode (cname = "XDefaultVisualOfScreen")]
934		public Visual default_visual_of_screen ();
935
936		[CCode (cname = "XDisplayOfScreen")]
937		public unowned Display display_of_screen ();
938
939		[CCode (cname = "XDoesBackingStore")]
940		public int does_backing_store ();
941
942		[CCode (cname = "XDoesSaveUnders")]
943		public bool does_save_unders ();
944
945		[CCode (cname = "XEventMaskOfScreen")]
946		public long event_mask_of_Screen ();
947
948		[CCode (cname = "XHeightMMOfScreen")]
949		public int height_in_mm_of_screen ();
950
951		[CCode (cname = "XHeightOfScreen")]
952		public int height_of_screen ();
953
954		[CCode (cname = "XMaxCmapsOfScreen")]
955		public int max_colormaps_of_screen ();
956
957		[CCode (cname = "XMinCmapsOfScreen")]
958		public int min_colormaps_of_screen ();
959
960		[CCode (cname = "XPlanesOfScreen")]
961		public int planes_of_screen ();
962
963		[CCode (cname = "XRootWindowOfScreen")]
964		public Window root_window_of_screen ();
965
966		[CCode (cname = "XScreenNumberOfScreen")]
967		public int screen_number_of_screen ();
968
969		[CCode (cname = "XWhitePixelOfScreen")]
970		public ulong white_pixel_of_screen ();
971
972		[CCode (cname = "XWidthMMOfScreen")]
973		public int width_in_mm_of_screen ();
974
975		[CCode (cname = "XWidthOfScreen")]
976		public int width_of_screen ();
977	}
978
979	public const X.ID None;
980
981	public const X.Atom XA_ATOM;
982	public const X.Atom XA_CARDINAL;
983	public const X.Atom XA_WINDOW;
984	public const X.Atom XA_WM_CLASS;
985	public const X.Atom XA_WM_HINTS;
986	public const X.Atom XA_WM_ICON_NAME;
987	public const X.Atom XA_WM_NAME;
988	public const X.Atom XA_WM_NORMAL_HINTS;
989	public const X.Atom XA_WM_TRANSIENT_FOR;
990
991	public const uint XK_Num_Lock;
992	public const uint XK_Scroll_Lock;
993	public const uint XK_Super_L;
994	public const uint XK_Super_R;
995}
996
997