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