context: // Permission is hereby granted, free of charge, to any person obtaining
  // a copy of this software and associated documentation files (the
  // "Software"), to deal in the Software without restriction, including
  // without limitation the rights to use, copy, modify, merge, publish,
  // distribute, sublicense, and/or sell copies of the Software, and to
  // permit persons to whom the Software is furnished to do so, subject to
  // the following conditions:
  // 
  // The above copyright notice and this permission notice shall be
  // included in all copies or substantial portions of the Software.
  // 
  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  //
  // Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
  //
  //
  
  using System;
  using System.Text;
  using System.Runtime.InteropServices;
  
  namespace System.Windows.Forms.X11Internal {
  
  	internal class Xlib {
  		const string libX11 = "X11";
  
  		[DllImport (libX11)]
  		public extern static IntPtr XOpenDisplay(IntPtr display);
  
  		[DllImport (libX11)]
  		public extern static int XCloseDisplay(IntPtr display);
  
  		[DllImport (libX11)]
  		public extern static IntPtr XSynchronize(IntPtr display, bool onoff);
  
  		[DllImport (libX11)]
  		public extern static IntPtr XCreateWindow(IntPtr display, IntPtr parent, int x, int y, int width, int height, int border_width, int depth, int xclass, IntPtr visual, UIntPtr valuemask, ref XSetWindowAttributes attributes);
  
  		[DllImport (libX11)]
  		public extern static IntPtr XCreateSimpleWindow(IntPtr display, IntPtr parent, int x, int y, int width, int height, int border_width, UIntPtr border, UIntPtr background);
  
  		[DllImport (libX11)]
  		public extern static int XMapWindow(IntPtr display, IntPtr window);
  
  		[DllImport (libX11)]
  		public extern static int XUnmapWindow(IntPtr display, IntPtr window);
  
  		[DllImport (libX11)]
  		public extern static int XMapSubindows(IntPtr display, IntPtr window);
  
  		[DllImport (libX11)]
  		public extern static int XUnmapSubwindows(IntPtr display, IntPtr window);
  
  		[DllImport (libX11)]
  		public extern static IntPtr XRootWindow(IntPtr display, int screen_number);
  
  		[DllImport (libX11)]
  		public extern static IntPtr XNextEvent(IntPtr display, ref XEvent xevent);
  
  		[DllImport (libX11)]
  		public extern static int XConnectionNumber (IntPtr diplay);
  
  		[DllImport (libX11)]
  		public extern static int XPending (IntPtr diplay);
  
  		[DllImport (libX11)]
  		public extern static IntPtr XSelectInput(IntPtr display, IntPtr window, IntPtr mask);
  
  		[DllImport (libX11)]
  		public extern static int XDestroyWindow(IntPtr display, IntPtr window);
  
  		[DllImport (libX11)]
  		public extern static int XReparentWindow(IntPtr display, IntPtr window, IntPtr parent, int x, int y);
  
  		[DllImport (libX11)]
  		public extern static int XMoveResizeWindow(IntPtr display, IntPtr window, int x, int y, int width, int height);
  
  		[DllImport (libX11)]
  		public extern static int XResizeWindow(IntPtr display, IntPtr window, int width, int height);
  
  		[DllImport (libX11)]
  		public extern static int XGetWindowAttributes(IntPtr display, IntPtr window, ref XWindowAttributes attributes);
  
  		[DllImport (libX11)]
  		public extern static int XFlush(IntPtr display);
  
  		[DllImport (libX11)]
  		public extern static int XSetWMName(IntPtr display, IntPtr window, ref XTextProperty text_prop);
  
  		[DllImport (libX11)]
  		public extern static int XStoreName(IntPtr display, IntPtr window, string window_name);
  
  		[DllImport (libX11)]
  		public extern static int XFetchName(IntPtr display, IntPtr window, ref IntPtr window_name);
  
  		[DllImport (libX11)]
  		public extern static int XSendEvent(IntPtr display, IntPtr window, bool propagate, IntPtr event_mask, ref XEvent send_event);
  
  		[DllImport (libX11)]
  		public extern static int XQueryTree(IntPtr display, IntPtr window, out IntPtr root_return, out IntPtr parent_return, out IntPtr children_return, out int nchildren_return);
  
  		[DllImport (libX11)]
  		public extern static int XFree(IntPtr data);
  
  		[DllImport (libX11)]
  		public extern static int XRaiseWindow(IntPtr display, IntPtr window);
  
  		[DllImport (libX11)]
  		public extern static uint XLowerWindow(IntPtr display, IntPtr window);
  
  		[DllImport (libX11)]
  		public extern static uint XConfigureWindow(IntPtr display, IntPtr window, ChangeWindowFlags value_mask, ref XWindowChanges values);
  
  		[DllImport (libX11)]
  		public extern static IntPtr XInternAtom(IntPtr display, string atom_name, bool only_if_exists);
  
  		[DllImport (libX11)]
  		public extern static int XInternAtoms(IntPtr display, string[] atom_names, int atom_count, bool only_if_exists, IntPtr[] atoms);
  
  		[DllImport (libX11)]
  		public extern static int XSetWMProtocols(IntPtr display, IntPtr window, IntPtr[] protocols, int count);
  
  		[DllImport (libX11)]
  		public extern static int XGrabPointer(IntPtr display, IntPtr window, bool owner_events, EventMask event_mask, GrabMode pointer_mode, GrabMode keyboard_mode, IntPtr confine_to, IntPtr cursor, IntPtr timestamp);
  
  		[DllImport (libX11)]
  		public extern static int XUngrabPointer(IntPtr display, IntPtr timestamp);
  
  		[DllImport (libX11)]
  		public extern static bool XQueryPointer(IntPtr display, IntPtr window, out IntPtr root, out IntPtr child, out int root_x, out int root_y, out int win_x, out int win_y, out int keys_buttons);
  
  		[DllImport (libX11)]
  		public extern static bool XTranslateCoordinates (IntPtr display, IntPtr src_w, IntPtr dest_w, int src_x, int src_y, out int intdest_x_return,	 out int dest_y_return, out IntPtr child_return);
  
  		[DllImport (libX11)]
  		public extern static bool XGetGeometry(IntPtr display, IntPtr window, out IntPtr root, out int x, out int y, out int width, out int height, out int border_width, out int depth);
  
  		[DllImport (libX11)]
  		public extern static bool XGetGeometry(IntPtr display, IntPtr window, IntPtr root, out int x, out int y, out int width, out int height, IntPtr border_width, IntPtr depth);
  
  		[DllImport (libX11)]
  		public extern static bool XGetGeometry(IntPtr display, IntPtr window, IntPtr root, out int x, out int y, IntPtr width, IntPtr height, IntPtr border_width, IntPtr depth);
  
  		[DllImport (libX11)]
  		public extern static bool XGetGeometry(IntPtr display, IntPtr window, IntPtr root, IntPtr x, IntPtr y, out int width, out int height, IntPtr border_width, IntPtr depth);
  
  		[DllImport (libX11)]
  		public extern static uint XWarpPointer(IntPtr display, IntPtr src_w, IntPtr dest_w, int src_x, int src_y, uint src_width, uint src_height, int dest_x, int dest_y);
  
  		[DllImport (libX11)]
  		public extern static int XClearWindow(IntPtr display, IntPtr window);
  
  		[DllImport (libX11)]
  		public extern static int XClearArea(IntPtr display, IntPtr window, int x, int y, int width, int height, bool exposures);
  
  		// Colormaps
  		[DllImport (libX11)]
  		public extern static IntPtr XDefaultScreenOfDisplay(IntPtr display);
  
  		[DllImport (libX11)]
  		public extern static int XScreenNumberOfScreen(IntPtr display, IntPtr Screen);
  
  		[DllImport (libX11)]
  		public extern static IntPtr XDefaultVisual(IntPtr display, int screen_number);
  
  		[DllImport (libX11)]
  		public extern static uint XDefaultDepth(IntPtr display, int screen_number);
  
  		[DllImport (libX11)]
  		public extern static int XDefaultScreen(IntPtr display);
  
  		[DllImport (libX11)]
  		public extern static IntPtr XDefaultColormap(IntPtr display, int screen_number);
  
  		[DllImport (libX11)]
  		public extern static int XLookupColor(IntPtr display, IntPtr Colormap, string Coloranem, ref XColor exact_def_color, ref XColor screen_def_color);
  
  		[DllImport (libX11)]
  		public extern static int XAllocColor(IntPtr display, IntPtr Colormap, ref XColor colorcell_def);
  
  		[DllImport (libX11)]
  		public extern static int XSetTransientForHint(IntPtr display, IntPtr window, IntPtr prop_window);
  
  		[DllImport (libX11)]
  		public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, ref MotifWmHints data, int nelements);
  
  		[DllImport (libX11)]
  		public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, ref uint value, int nelements);
  
  		[DllImport (libX11)]
  		public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, ref IntPtr value, int nelements);
  
  		[DllImport (libX11)]
  		public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, uint[] data, int nelements);
  
  		[DllImport (libX11)]
  		public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, int[] data, int nelements);
  
  		[DllImport (libX11)]
  		public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, IntPtr[] data, int nelements);
  
  		[DllImport (libX11)]
  		public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, IntPtr atoms, int nelements);
  
  
gt: 		[DllImport (libX11, CharSet=CharSet.Ansi)]