2007-01-02 Chris Toshok <toshok@ximian.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / XplatUIX11.cs
index 7527cfe2e489ba7e02becdeec8476eb00a395d27..b306f4c5018d7edcde4628c13f1cac86f1a05810 100644 (file)
@@ -133,44 +133,44 @@ namespace System.Windows.Forms {
                private static IntPtr WM_PROTOCOLS;
                private static IntPtr WM_DELETE_WINDOW;
                private static IntPtr WM_TAKE_FOCUS;
-               private static IntPtr _NET_SUPPORTED;
-               private static IntPtr _NET_CLIENT_LIST;
-               private static IntPtr _NET_NUMBER_OF_DESKTOPS;
-               private static IntPtr _NET_DESKTOP_GEOMETRY;
-               private static IntPtr _NET_DESKTOP_VIEWPORT;
+               //private static IntPtr _NET_SUPPORTED;
+               //private static IntPtr _NET_CLIENT_LIST;
+               //private static IntPtr _NET_NUMBER_OF_DESKTOPS;
+               //private static IntPtr _NET_DESKTOP_GEOMETRY;
+               //private static IntPtr _NET_DESKTOP_VIEWPORT;
                private static IntPtr _NET_CURRENT_DESKTOP;
-               private static IntPtr _NET_DESKTOP_NAMES;
+               //private static IntPtr _NET_DESKTOP_NAMES;
                private static IntPtr _NET_ACTIVE_WINDOW;
                private static IntPtr _NET_WORKAREA;
-               private static IntPtr _NET_SUPPORTING_WM_CHECK;
-               private static IntPtr _NET_VIRTUAL_ROOTS;
-               private static IntPtr _NET_DESKTOP_LAYOUT;
-               private static IntPtr _NET_SHOWING_DESKTOP;
-               private static IntPtr _NET_CLOSE_WINDOW;
-               private static IntPtr _NET_MOVERESIZE_WINDOW;
-               private static IntPtr _NET_WM_MOVERESIZE;
-               private static IntPtr _NET_RESTACK_WINDOW;
-               private static IntPtr _NET_REQUEST_FRAME_EXTENTS;
+               //private static IntPtr _NET_SUPPORTING_WM_CHECK;
+               //private static IntPtr _NET_VIRTUAL_ROOTS;
+               //private static IntPtr _NET_DESKTOP_LAYOUT;
+               //private static IntPtr _NET_SHOWING_DESKTOP;
+               //private static IntPtr _NET_CLOSE_WINDOW;
+               //private static IntPtr _NET_MOVERESIZE_WINDOW;
+               //private static IntPtr _NET_WM_MOVERESIZE;
+               //private static IntPtr _NET_RESTACK_WINDOW;
+               //private static IntPtr _NET_REQUEST_FRAME_EXTENTS;
                private static IntPtr _NET_WM_NAME;
-               private static IntPtr _NET_WM_VISIBLE_NAME;
-               private static IntPtr _NET_WM_ICON_NAME;
-               private static IntPtr _NET_WM_VISIBLE_ICON_NAME;
-               private static IntPtr _NET_WM_DESKTOP;
+               //private static IntPtr _NET_WM_VISIBLE_NAME;
+               //private static IntPtr _NET_WM_ICON_NAME;
+               //private static IntPtr _NET_WM_VISIBLE_ICON_NAME;
+               //private static IntPtr _NET_WM_DESKTOP;
                private static IntPtr _NET_WM_WINDOW_TYPE;
                private static IntPtr _NET_WM_STATE;
-               private static IntPtr _NET_WM_ALLOWED_ACTIONS;
-               private static IntPtr _NET_WM_STRUT;
-               private static IntPtr _NET_WM_STRUT_PARTIAL;
-               private static IntPtr _NET_WM_ICON_GEOMETRY;
+               //private static IntPtr _NET_WM_ALLOWED_ACTIONS;
+               //private static IntPtr _NET_WM_STRUT;
+               //private static IntPtr _NET_WM_STRUT_PARTIAL;
+               //private static IntPtr _NET_WM_ICON_GEOMETRY;
                private static IntPtr _NET_WM_ICON;
-               private static IntPtr _NET_WM_PID;
-               private static IntPtr _NET_WM_HANDLED_ICONS;
+               //private static IntPtr _NET_WM_PID;
+               //private static IntPtr _NET_WM_HANDLED_ICONS;
                private static IntPtr _NET_WM_USER_TIME;
                private static IntPtr _NET_FRAME_EXTENTS;
-               private static IntPtr _NET_WM_PING;
-               private static IntPtr _NET_WM_SYNC_REQUEST;
+               //private static IntPtr _NET_WM_PING;
+               //private static IntPtr _NET_WM_SYNC_REQUEST;
                private static IntPtr _NET_SYSTEM_TRAY_S;
-               private static IntPtr _NET_SYSTEM_TRAY_ORIENTATION;
+               //private static IntPtr _NET_SYSTEM_TRAY_ORIENTATION;
                private static IntPtr _NET_SYSTEM_TRAY_OPCODE;
                private static IntPtr _NET_WM_STATE_MAXIMIZED_HORZ;
                private static IntPtr _NET_WM_STATE_MAXIMIZED_VERT;
@@ -178,22 +178,22 @@ namespace System.Windows.Forms {
                private static IntPtr _XEMBED_INFO;
                private static IntPtr _MOTIF_WM_HINTS;
                private static IntPtr _NET_WM_STATE_SKIP_TASKBAR;
-               private static IntPtr _NET_WM_STATE_ABOVE;
-               private static IntPtr _NET_WM_STATE_MODAL;
+               //private static IntPtr _NET_WM_STATE_ABOVE;
+               //private static IntPtr _NET_WM_STATE_MODAL;
                private static IntPtr _NET_WM_STATE_HIDDEN;
                private static IntPtr _NET_WM_CONTEXT_HELP;
                private static IntPtr _NET_WM_WINDOW_OPACITY;
-               private static IntPtr _NET_WM_WINDOW_TYPE_DESKTOP;
-               private static IntPtr _NET_WM_WINDOW_TYPE_DOCK;
-               private static IntPtr _NET_WM_WINDOW_TYPE_TOOLBAR;
-               private static IntPtr _NET_WM_WINDOW_TYPE_MENU;
+               //private static IntPtr _NET_WM_WINDOW_TYPE_DESKTOP;
+               //private static IntPtr _NET_WM_WINDOW_TYPE_DOCK;
+               //private static IntPtr _NET_WM_WINDOW_TYPE_TOOLBAR;
+               //private static IntPtr _NET_WM_WINDOW_TYPE_MENU;
                private static IntPtr _NET_WM_WINDOW_TYPE_UTILITY;
-               private static IntPtr _NET_WM_WINDOW_TYPE_SPLASH;
-               private static IntPtr _NET_WM_WINDOW_TYPE_DIALOG;
+               //private static IntPtr _NET_WM_WINDOW_TYPE_SPLASH;
+               //private static IntPtr _NET_WM_WINDOW_TYPE_DIALOG;
                private static IntPtr _NET_WM_WINDOW_TYPE_NORMAL;
                private static IntPtr CLIPBOARD;
                private static IntPtr PRIMARY;
-               private static IntPtr DIB;
+               //private static IntPtr DIB;
                private static IntPtr OEMTEXT;
                private static IntPtr UNICODETEXT;
                private static IntPtr TARGETS;
@@ -208,7 +208,7 @@ namespace System.Windows.Forms {
                private static GrabStruct       Grab;                   //
 
                // State
-               private static Point            MousePosition;          // Last position of mouse, in screen coords
+               Point           mouse_position;         // Last position of mouse, in screen coords
                internal static MouseButtons    MouseState;             // Last state of mouse buttons
 
                // 'Constants'
@@ -488,7 +488,7 @@ namespace System.Windows.Forms {
                                ModalWindows = new Stack(3);
 
                                MouseState = MouseButtons.None;
-                               MousePosition = new Point(0, 0);
+                               mouse_position = new Point(0, 0);
 
                                Caret.Timer = new Timer();
                                Caret.Timer.Interval = 500;             // FIXME - where should this number come from?
@@ -506,44 +506,6 @@ namespace System.Windows.Forms {
                                throw new ArgumentNullException("Display", "Could not open display (X-Server required. Check you DISPLAY environment variable)");
                        }
                }
-
-               internal static void Where() {
-                       Console.WriteLine("Here: {0}\n", WhereString());
-               }
-
-               internal static string WhereString() {
-                       StackTrace      stack;
-                       StackFrame      frame;
-                       string          newline;
-                       string          unknown;
-                       StringBuilder   sb;
-                       MethodBase      method;
-
-                       newline = String.Format("{0}\t {1} ", Environment.NewLine, Locale.GetText("at"));
-                       unknown = Locale.GetText("<unknown method>");
-                       sb = new StringBuilder();
-                       stack = new StackTrace(true);
-
-                       for (int i = 0; i < stack.FrameCount; i++) {
-                               frame = stack.GetFrame(i);
-                               sb.Append(newline);
-
-                               method = frame.GetMethod();
-                               if (method != null) {
-                                       #if not
-                                               sb.AppendFormat(frame.ToString());
-                                       #endif
-                                       if (frame.GetFileLineNumber() != 0) {
-                                               sb.AppendFormat("{0}.{1} () [{2}:{3}]", method.DeclaringType.FullName, method.Name, Path.GetFileName(frame.GetFileName()), frame.GetFileLineNumber());
-                                       } else {
-                                               sb.AppendFormat("{0}.{1} ()", method.DeclaringType.FullName, method.Name);
-                                       }
-                               } else { 
-                                       sb.Append(unknown);
-                               }
-                       }
-                       return sb.ToString();
-               }
                #endregion      // Internal Methods
 
                #region Private Methods
@@ -559,44 +521,44 @@ namespace System.Windows.Forms {
                                "WM_PROTOCOLS",
                                "WM_DELETE_WINDOW",
                                "WM_TAKE_FOCUS",
-                               "_NET_SUPPORTED",
-                               "_NET_CLIENT_LIST",
-                               "_NET_NUMBER_OF_DESKTOPS",
-                               "_NET_DESKTOP_GEOMETRY",
-                               "_NET_DESKTOP_VIEWPORT",
+                               //"_NET_SUPPORTED",
+                               //"_NET_CLIENT_LIST",
+                               //"_NET_NUMBER_OF_DESKTOPS",
+                               //"_NET_DESKTOP_GEOMETRY",
+                               //"_NET_DESKTOP_VIEWPORT",
                                "_NET_CURRENT_DESKTOP",
-                               "_NET_DESKTOP_NAMES",
+                               //"_NET_DESKTOP_NAMES",
                                "_NET_ACTIVE_WINDOW",
                                "_NET_WORKAREA",
-                               "_NET_SUPPORTING_WM_CHECK",
-                               "_NET_VIRTUAL_ROOTS",
-                               "_NET_DESKTOP_LAYOUT",
-                               "_NET_SHOWING_DESKTOP",
-                               "_NET_CLOSE_WINDOW",
-                               "_NET_MOVERESIZE_WINDOW",
-                               "_NET_WM_MOVERESIZE",
-                               "_NET_RESTACK_WINDOW",
-                               "_NET_REQUEST_FRAME_EXTENTS",
+                               //"_NET_SUPPORTING_WM_CHECK",
+                               //"_NET_VIRTUAL_ROOTS",
+                               //"_NET_DESKTOP_LAYOUT",
+                               //"_NET_SHOWING_DESKTOP",
+                               //"_NET_CLOSE_WINDOW",
+                               //"_NET_MOVERESIZE_WINDOW",
+                               //"_NET_WM_MOVERESIZE",
+                               //"_NET_RESTACK_WINDOW",
+                               //"_NET_REQUEST_FRAME_EXTENTS",
                                "_NET_WM_NAME",
-                               "_NET_WM_VISIBLE_NAME",
-                               "_NET_WM_ICON_NAME",
-                               "_NET_WM_VISIBLE_ICON_NAME",
-                               "_NET_WM_DESKTOP",
+                               //"_NET_WM_VISIBLE_NAME",
+                               //"_NET_WM_ICON_NAME",
+                               //"_NET_WM_VISIBLE_ICON_NAME",
+                               //"_NET_WM_DESKTOP",
                                "_NET_WM_WINDOW_TYPE",
                                "_NET_WM_STATE",
-                               "_NET_WM_ALLOWED_ACTIONS",
-                               "_NET_WM_STRUT",
-                               "_NET_WM_STRUT_PARTIAL",
-                               "_NET_WM_ICON_GEOMETRY",
+                               //"_NET_WM_ALLOWED_ACTIONS",
+                               //"_NET_WM_STRUT",
+                               //"_NET_WM_STRUT_PARTIAL",
+                               //"_NET_WM_ICON_GEOMETRY",
                                "_NET_WM_ICON",
-                               "_NET_WM_PID",
-                               "_NET_WM_HANDLED_ICONS",
+                               //"_NET_WM_PID",
+                               //"_NET_WM_HANDLED_ICONS",
                                "_NET_WM_USER_TIME",
                                "_NET_FRAME_EXTENTS",
-                               "_NET_WM_PING",
-                               "_NET_WM_SYNC_REQUEST",
+                               //"_NET_WM_PING",
+                               //"_NET_WM_SYNC_REQUEST",
                                "_NET_SYSTEM_TRAY_OPCODE",
-                               "_NET_SYSTEM_TRAY_ORIENTATION",
+                               //"_NET_SYSTEM_TRAY_ORIENTATION",
                                "_NET_WM_STATE_MAXIMIZED_HORZ",
                                "_NET_WM_STATE_MAXIMIZED_VERT",
                                "_NET_WM_STATE_HIDDEN",
@@ -604,17 +566,17 @@ namespace System.Windows.Forms {
                                "_XEMBED_INFO",
                                "_MOTIF_WM_HINTS",
                                "_NET_WM_STATE_SKIP_TASKBAR",
-                               "_NET_WM_STATE_ABOVE",
-                               "_NET_WM_STATE_MODAL",
+                               //"_NET_WM_STATE_ABOVE",
+                               //"_NET_WM_STATE_MODAL",
                                "_NET_WM_CONTEXT_HELP",
                                "_NET_WM_WINDOW_OPACITY",
-                               "_NET_WM_WINDOW_TYPE_DESKTOP",
-                               "_NET_WM_WINDOW_TYPE_DOCK",
-                               "_NET_WM_WINDOW_TYPE_TOOLBAR",
-                               "_NET_WM_WINDOW_TYPE_MENU",
+                               //"_NET_WM_WINDOW_TYPE_DESKTOP",
+                               //"_NET_WM_WINDOW_TYPE_DOCK",
+                               //"_NET_WM_WINDOW_TYPE_TOOLBAR",
+                               //"_NET_WM_WINDOW_TYPE_MENU",
                                "_NET_WM_WINDOW_TYPE_UTILITY",
-                               "_NET_WM_WINDOW_TYPE_DIALOG",
-                               "_NET_WM_WINDOW_TYPE_SPLASH",
+                               //"_NET_WM_WINDOW_TYPE_DIALOG",
+                               //"_NET_WM_WINDOW_TYPE_SPLASH",
                                "_NET_WM_WINDOW_TYPE_NORMAL",
                                "CLIPBOARD",
                                "PRIMARY",
@@ -633,44 +595,44 @@ namespace System.Windows.Forms {
                        WM_PROTOCOLS = atoms [off++];
                        WM_DELETE_WINDOW = atoms [off++];
                        WM_TAKE_FOCUS = atoms [off++];
-                       _NET_SUPPORTED = atoms [off++];
-                       _NET_CLIENT_LIST = atoms [off++];
-                       _NET_NUMBER_OF_DESKTOPS = atoms [off++];
-                       _NET_DESKTOP_GEOMETRY = atoms [off++];
-                       _NET_DESKTOP_VIEWPORT = atoms [off++];
+                       //_NET_SUPPORTED = atoms [off++];
+                       //_NET_CLIENT_LIST = atoms [off++];
+                       //_NET_NUMBER_OF_DESKTOPS = atoms [off++];
+                       //_NET_DESKTOP_GEOMETRY = atoms [off++];
+                       //_NET_DESKTOP_VIEWPORT = atoms [off++];
                        _NET_CURRENT_DESKTOP = atoms [off++];
-                       _NET_DESKTOP_NAMES = atoms [off++];
+                       //_NET_DESKTOP_NAMES = atoms [off++];
                        _NET_ACTIVE_WINDOW = atoms [off++];
                        _NET_WORKAREA = atoms [off++];
-                       _NET_SUPPORTING_WM_CHECK = atoms [off++];
-                       _NET_VIRTUAL_ROOTS = atoms [off++];
-                       _NET_DESKTOP_LAYOUT = atoms [off++];
-                       _NET_SHOWING_DESKTOP = atoms [off++];
-                       _NET_CLOSE_WINDOW = atoms [off++];
-                       _NET_MOVERESIZE_WINDOW = atoms [off++];
-                       _NET_WM_MOVERESIZE = atoms [off++];
-                       _NET_RESTACK_WINDOW = atoms [off++];
-                       _NET_REQUEST_FRAME_EXTENTS = atoms [off++];
+                       //_NET_SUPPORTING_WM_CHECK = atoms [off++];
+                       //_NET_VIRTUAL_ROOTS = atoms [off++];
+                       //_NET_DESKTOP_LAYOUT = atoms [off++];
+                       //_NET_SHOWING_DESKTOP = atoms [off++];
+                       //_NET_CLOSE_WINDOW = atoms [off++];
+                       //_NET_MOVERESIZE_WINDOW = atoms [off++];
+                       //_NET_WM_MOVERESIZE = atoms [off++];
+                       //_NET_RESTACK_WINDOW = atoms [off++];
+                       //_NET_REQUEST_FRAME_EXTENTS = atoms [off++];
                        _NET_WM_NAME = atoms [off++];
-                       _NET_WM_VISIBLE_NAME = atoms [off++];
-                       _NET_WM_ICON_NAME = atoms [off++];
-                       _NET_WM_VISIBLE_ICON_NAME = atoms [off++];
-                       _NET_WM_DESKTOP = atoms [off++];
+                       //_NET_WM_VISIBLE_NAME = atoms [off++];
+                       //_NET_WM_ICON_NAME = atoms [off++];
+                       //_NET_WM_VISIBLE_ICON_NAME = atoms [off++];
+                       //_NET_WM_DESKTOP = atoms [off++];
                        _NET_WM_WINDOW_TYPE = atoms [off++];
                        _NET_WM_STATE = atoms [off++];
-                       _NET_WM_ALLOWED_ACTIONS = atoms [off++];
-                       _NET_WM_STRUT = atoms [off++];
-                       _NET_WM_STRUT_PARTIAL = atoms [off++];
-                       _NET_WM_ICON_GEOMETRY = atoms [off++];
+                       //_NET_WM_ALLOWED_ACTIONS = atoms [off++];
+                       //_NET_WM_STRUT = atoms [off++];
+                       //_NET_WM_STRUT_PARTIAL = atoms [off++];
+                       //_NET_WM_ICON_GEOMETRY = atoms [off++];
                        _NET_WM_ICON = atoms [off++];
-                       _NET_WM_PID = atoms [off++];
-                       _NET_WM_HANDLED_ICONS = atoms [off++];
+                       //_NET_WM_PID = atoms [off++];
+                       //_NET_WM_HANDLED_ICONS = atoms [off++];
                        _NET_WM_USER_TIME = atoms [off++];
                        _NET_FRAME_EXTENTS = atoms [off++];
-                       _NET_WM_PING = atoms [off++];
-                       _NET_WM_SYNC_REQUEST = atoms [off++];
+                       //_NET_WM_PING = atoms [off++];
+                       //_NET_WM_SYNC_REQUEST = atoms [off++];
                        _NET_SYSTEM_TRAY_OPCODE = atoms [off++];
-                       _NET_SYSTEM_TRAY_ORIENTATION = atoms [off++];
+                       //_NET_SYSTEM_TRAY_ORIENTATION = atoms [off++];
                        _NET_WM_STATE_MAXIMIZED_HORZ = atoms [off++];
                        _NET_WM_STATE_MAXIMIZED_VERT = atoms [off++];
                        _NET_WM_STATE_HIDDEN = atoms [off++];
@@ -678,17 +640,17 @@ namespace System.Windows.Forms {
                        _XEMBED_INFO = atoms [off++];
                        _MOTIF_WM_HINTS = atoms [off++];
                        _NET_WM_STATE_SKIP_TASKBAR = atoms [off++];
-                       _NET_WM_STATE_ABOVE = atoms [off++];
-                       _NET_WM_STATE_MODAL = atoms [off++];
+                       //_NET_WM_STATE_ABOVE = atoms [off++];
+                       //_NET_WM_STATE_MODAL = atoms [off++];
                        _NET_WM_CONTEXT_HELP = atoms [off++];
                        _NET_WM_WINDOW_OPACITY = atoms [off++];
-                       _NET_WM_WINDOW_TYPE_DESKTOP = atoms [off++];
-                       _NET_WM_WINDOW_TYPE_DOCK = atoms [off++];
-                       _NET_WM_WINDOW_TYPE_TOOLBAR = atoms [off++];
-                       _NET_WM_WINDOW_TYPE_MENU = atoms [off++];
+                       //_NET_WM_WINDOW_TYPE_DESKTOP = atoms [off++];
+                       //_NET_WM_WINDOW_TYPE_DOCK = atoms [off++];
+                       //_NET_WM_WINDOW_TYPE_TOOLBAR = atoms [off++];
+                       //_NET_WM_WINDOW_TYPE_MENU = atoms [off++];
                        _NET_WM_WINDOW_TYPE_UTILITY = atoms [off++];
-                       _NET_WM_WINDOW_TYPE_DIALOG = atoms [off++];
-                       _NET_WM_WINDOW_TYPE_SPLASH = atoms [off++];
+                       //_NET_WM_WINDOW_TYPE_DIALOG = atoms [off++];
+                       //_NET_WM_WINDOW_TYPE_SPLASH = atoms [off++];
                        _NET_WM_WINDOW_TYPE_NORMAL = atoms [off++];
                        CLIPBOARD = atoms [off++];
                        PRIMARY = atoms [off++];
@@ -699,7 +661,7 @@ namespace System.Windows.Forms {
                        PostAtom = atoms [off++];
                        HoverState.Atom = atoms [off++];
 
-                       DIB = (IntPtr)Atom.XA_PIXMAP;
+                       //DIB = (IntPtr)Atom.XA_PIXMAP;
                        _NET_SYSTEM_TRAY_S = XInternAtom (DisplayHandle, "_NET_SYSTEM_TRAY_S" + ScreenNo.ToString(), false);
                }
 
@@ -740,6 +702,47 @@ namespace System.Windows.Forms {
                        XSendEvent(DisplayHandle, window, false, new IntPtr ((int)EventMask.NoEventMask), ref xev);
                }
 
+               // For WM_LBUTTONDOWN, WM_MBUTTONDOWN, WM_RBUTTONDOWN, WM_XBUTTONDOWN
+               //     WM_CREATE and WM_DESTROY causes
+               void SendParentNotify(IntPtr child, Msg cause, int x, int y)
+               {       
+                       Hwnd hwnd;
+                       
+                       if (child == IntPtr.Zero) {
+                               return;
+                       }
+                       
+                       hwnd = Hwnd.GetObjectFromWindow (child);
+                       
+                       if (hwnd == null) {
+                               return;
+                       }
+                       
+                       if (hwnd.Handle == IntPtr.Zero) {
+                               return;
+                       }
+                       
+                       if (ExStyleSet ((int) hwnd.initial_ex_style, WindowExStyles.WS_EX_NOPARENTNOTIFY)) {
+                               return;
+                       }
+                       
+                       if (hwnd.Parent == null) {
+                               return;
+                       }
+                       
+                       if (hwnd.Parent.Handle == IntPtr.Zero) {
+                               return;
+                       }
+
+                       if (cause == Msg.WM_CREATE || cause == Msg.WM_DESTROY) {
+                               SendMessage(hwnd.Parent.Handle, Msg.WM_PARENTNOTIFY, Control.MakeParam((int)cause, 0), child);
+                       } else {
+                               SendMessage(hwnd.Parent.Handle, Msg.WM_PARENTNOTIFY, Control.MakeParam((int)cause, 0), Control.MakeParam(x, y));
+                       }
+                       
+                       SendParentNotify (hwnd.Parent.Handle, cause, x, y);
+               }
+               
                bool StyleSet (int s, WindowStyles ws)
                {
                        return (s & (int)ws) == (int)ws;
@@ -1016,10 +1019,6 @@ namespace System.Windows.Forms {
                        XChangeProperty(DisplayHandle, hwnd.whole_window, _NET_WM_ICON, (IntPtr)Atom.XA_CARDINAL, 32, PropertyMode.Replace, data, size);
                }
 
-               private IntPtr ImageToPixmap(Image image) {
-                       return IntPtr.Zero;
-               }
-
                private void WakeupMain () {
                        wake.Send (new byte [] { 0xFF });
                }
@@ -1099,66 +1098,6 @@ namespace System.Windows.Forms {
                        }
                }
 
-               private void WholeToScreen(IntPtr handle, ref int x, ref int y) {
-                       int     dest_x_return;
-                       int     dest_y_return;
-                       IntPtr  child;
-                       Hwnd    hwnd;
-
-                       hwnd = Hwnd.ObjectFromHandle(handle);
-
-                       lock (XlibLock) {
-                               XTranslateCoordinates(DisplayHandle, hwnd.whole_window, RootWindow, x, y, out dest_x_return, out dest_y_return, out child);
-                       }
-
-                       x = dest_x_return;
-                       y = dest_y_return;
-               }
-
-               private void AbsoluteGeometry(IntPtr window, out int ret_x, out int ret_y, out int width, out int height) {
-                       IntPtr  root;
-                       IntPtr  win;
-                       IntPtr  parent;
-                       IntPtr  children;
-                       int     x;
-                       int     y;
-                       int     w;
-                       int     h;
-                       int     absX;
-                       int     absY;
-                       int     b;
-                       int     d;
-                       int     nchildren;
-
-                       absX = 0;
-                       absY = 0;
-                       win = window;
-                       width = 0;
-                       height = 0;
-                       do {
-                               XGetGeometry(DisplayHandle, win, out root, out x, out y, out w, out h, out b, out d);
-                               if (win == window) {
-                                       width = w;
-                                       height = h;
-                               }
-                               absX += x;
-                               absY += y;
-                               if (XQueryTree(DisplayHandle, win, out root, out parent,  out children, out nchildren) == 0) {
-                                       break;
-                               }
-
-                               if (children != IntPtr.Zero) {
-                                       XFree(children);
-                               }
-                               win = parent;
-                       } while (win != root);
-
-                       ret_x = absX;
-                       ret_y = absY;
-
-//Console.WriteLine("Absolute pos for window {0} = {1},{2} {3}x{4}", XplatUI.Window(window), ret_x, ret_y, width, height);
-               }
-
                private void FrameExtents(IntPtr window, out int left, out int top) {
                        IntPtr                  actual_atom;
                        int                     actual_format;
@@ -1672,7 +1611,7 @@ namespace System.Windows.Forms {
                        if (ErrorExceptions) {
                                throw new XException(error_event.display, error_event.resourceid, error_event.serial, error_event.error_code, error_event.request_code, error_event.minor_code);
                        } else {
-                               Console.WriteLine("X11 Error encountered: {0}{1}\n", XException.GetMessage(error_event.display, error_event.resourceid, error_event.serial, error_event.error_code, error_event.request_code, error_event.minor_code), WhereString());
+                               Console.WriteLine("X11 Error encountered: {0}{1}\n", XException.GetMessage(error_event.display, error_event.resourceid, error_event.serial, error_event.error_code, error_event.request_code, error_event.minor_code), Environment.StackTrace);
                        }
                        return 0;
                }
@@ -1680,7 +1619,7 @@ namespace System.Windows.Forms {
                private void AccumulateDestroyedHandles (Control c, ArrayList list)
                {
                        if (c != null) {
-                               Control[] controls = c.child_controls.GetAllControls ();
+                               Control[] controls = c.Controls.GetAllControls ();
 
                                if (c.IsHandleCreated && !c.IsDisposed) {
                                        Hwnd hwnd = Hwnd.ObjectFromHandle(c.Handle);
@@ -2025,6 +1964,12 @@ namespace System.Windows.Forms {
                        }
                } 
 
+               internal override Point MousePosition {
+                       get {
+                               return mouse_position;
+                       }
+               }
+
                internal override Size MouseHoverSize {
                        get {
                                return new Size (1, 1);
@@ -2388,6 +2333,7 @@ namespace System.Windows.Forms {
                        hwnd.width = Width;
                        hwnd.height = Height;
                        hwnd.parent = Hwnd.ObjectFromHandle(cp.Parent);
+                       hwnd.initial_ex_style = (WindowExStyles) cp.ExStyle;
 
                        if (StyleSet (cp.Style, WindowStyles.WS_DISABLED)) {
                                hwnd.enabled = false;
@@ -2482,6 +2428,8 @@ namespace System.Windows.Forms {
 
                        // Set caption/window title
                        Text(hwnd.Handle, cp.Caption);
+                       
+                       SendParentNotify (hwnd.Handle, Msg.WM_CREATE, int.MaxValue, int.MaxValue);
 
                        return hwnd.Handle;
                }
@@ -2861,7 +2809,8 @@ namespace System.Windows.Forms {
 
                internal override void DestroyCaret(IntPtr handle) {
                        if (Caret.Hwnd == handle) {
-                               if (Caret.Visible == true) {
+                               if (Caret.Visible) {
+                                       HideCaret ();
                                        Caret.Timer.Stop();
                                }
                                if (Caret.gc != IntPtr.Zero) {
@@ -2896,6 +2845,8 @@ namespace System.Windows.Forms {
                                Console.WriteLine("Destroying window {0}", XplatUI.Window(hwnd.client_window));
                        #endif
 
+                       SendParentNotify (hwnd.Handle, Msg.WM_DESTROY, int.MaxValue, int.MaxValue);
+                               
                        CleanupCachedWindows (hwnd);
 
                        ArrayList windows = new ArrayList ();
@@ -2927,12 +2878,36 @@ namespace System.Windows.Forms {
                        return NativeWindow.WndProc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
                }
 
-               internal override void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width) {
-                       Hwnd            hwnd;
+               IntPtr GetReversibleScreenGC (Color backColor)
+               {
                        XGCValues       gc_values;
                        IntPtr          gc;
+                       uint pixel;
+
+                       XColor xcolor = new XColor();
+                       xcolor.red = (ushort)(backColor.R * 257);
+                       xcolor.green = (ushort)(backColor.G * 257);
+                       xcolor.blue = (ushort)(backColor.B * 257);
+                       XAllocColor(DisplayHandle, DefaultColormap, ref xcolor);
+                       pixel = (uint)xcolor.pixel.ToInt32();
 
-                       hwnd = Hwnd.ObjectFromHandle(handle);
+
+                       gc_values = new XGCValues();
+
+                       gc_values.subwindow_mode = GCSubwindowMode.IncludeInferiors;
+                       gc_values.foreground = (IntPtr)pixel;
+
+                       gc = XCreateGC(DisplayHandle, RootWindow, new IntPtr ((int) (GCFunction.GCSubwindowMode | GCFunction.GCForeground)), ref gc_values);
+                       XSetForeground(DisplayHandle, gc, (UIntPtr)pixel);
+                       XSetFunction(DisplayHandle,   gc, GXFunction.GXxor);
+
+                       return gc;
+               }
+
+               IntPtr GetReversibleControlGC (Control control, int line_width)
+               {
+                       XGCValues       gc_values;
+                       IntPtr          gc;
 
                        gc_values = new XGCValues();
 
@@ -2948,13 +2923,10 @@ namespace System.Windows.Forms {
                        //XSetPlaneMask(DisplayHandle,  gc, mask);
 
 
-                       gc = XCreateGC(DisplayHandle, hwnd.client_window, new IntPtr ((int) (GCFunction.GCSubwindowMode | GCFunction.GCLineWidth | GCFunction.GCForeground)), ref gc_values);
+                       gc = XCreateGC(DisplayHandle, control.Handle, new IntPtr ((int) (GCFunction.GCSubwindowMode | GCFunction.GCLineWidth | GCFunction.GCForeground)), ref gc_values);
                        uint foreground;
                        uint background;
 
-                       Control control;
-                       control = Control.FromHandle(handle);
-
                        XColor xcolor = new XColor();
 
                        xcolor.red = (ushort)(control.ForeColor.R * 257);
@@ -2976,13 +2948,82 @@ namespace System.Windows.Forms {
                        XSetFunction(DisplayHandle,   gc, GXFunction.GXxor);
                        XSetPlaneMask(DisplayHandle,  gc, (IntPtr)mask);
 
+                       return gc;
+               }
+
+               internal override void DrawReversibleLine(Point start, Point end, Color backColor)
+               {
+                       IntPtr gc = GetReversibleScreenGC (backColor);
+
+                       XDrawLine (DisplayHandle, RootWindow, gc, start.X, start.Y, end.X, end.Y);
+
+                       XFreeGC(DisplayHandle, gc);
+               }
+
+               internal override void DrawReversibleFrame (Rectangle rectangle, Color backColor, FrameStyle style)
+               {
+                       IntPtr gc = GetReversibleScreenGC (backColor);
+
+                       if (rectangle.Width < 0) {
+                               rectangle.X += rectangle.Width;
+                               rectangle.Width = -rectangle.Width;
+                       }
+                       if (rectangle.Height < 0) {
+                               rectangle.Y += rectangle.Height;
+                               rectangle.Height = -rectangle.Height;
+                       }
+
+                       int line_width = 1;
+                       GCLineStyle line_style = GCLineStyle.LineSolid;
+                       GCCapStyle cap_style = GCCapStyle.CapButt;
+                       GCJoinStyle join_style = GCJoinStyle.JoinMiter;
+
+                       switch (style) {
+                       case FrameStyle.Dashed:
+                               line_style = GCLineStyle.LineOnOffDash;
+                               break;
+                       case FrameStyle.Thick:
+                               line_width = 2;
+                               break;
+                       }
+
+                       XSetLineAttributes (DisplayHandle, gc, line_width, line_style, cap_style, join_style);
+
+                       XDrawRectangle(DisplayHandle, RootWindow, gc, rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height);
+
+                       XFreeGC(DisplayHandle, gc);
+               }
+
+               internal override void FillReversibleRectangle (Rectangle rectangle, Color backColor) 
+               {
+                       IntPtr gc = GetReversibleScreenGC (backColor);
+
+                       if (rectangle.Width < 0) {
+                               rectangle.X += rectangle.Width;
+                               rectangle.Width = -rectangle.Width;
+                       }
+                       if (rectangle.Height < 0) {
+                               rectangle.Y += rectangle.Height;
+                               rectangle.Height = -rectangle.Height;
+                       }
+                       XFillRectangle(DisplayHandle, RootWindow, gc, rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height);
+
+                       XFreeGC(DisplayHandle, gc);
+               }
+
+               internal override void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width) {
+                       IntPtr          gc;
+                       Control control = Control.FromHandle(handle);
+
+                       gc = GetReversibleControlGC (control, line_width);
+
                        if ((rect.Width > 0) && (rect.Height > 0)) {
-                               XDrawRectangle(DisplayHandle, hwnd.client_window, gc, rect.Left, rect.Top, rect.Width, rect.Height);
+                               XDrawRectangle(DisplayHandle, control.Handle, gc, rect.Left, rect.Top, rect.Width, rect.Height);
                        } else {
                                if (rect.Width > 0) {
-                                       XDrawLine(DisplayHandle, hwnd.client_window, gc, rect.X, rect.Y, rect.Right, rect.Y);
+                                       XDrawLine(DisplayHandle, control.Handle, gc, rect.X, rect.Y, rect.Right, rect.Y);
                                } else {
-                                       XDrawLine(DisplayHandle, hwnd.client_window, gc, rect.X, rect.Y, rect.X, rect.Bottom);
+                                       XDrawLine(DisplayHandle, control.Handle, gc, rect.X, rect.Y, rect.X, rect.Bottom);
                                }
                        }
                        XFreeGC(DisplayHandle, gc);
@@ -3285,15 +3326,15 @@ namespace System.Windows.Forms {
                                        }
 
                                        msg.lParam=(IntPtr) (xevent.ButtonEvent.y << 16 | xevent.ButtonEvent.x);
-                                       MousePosition.X = xevent.ButtonEvent.x;
-                                       MousePosition.Y = xevent.ButtonEvent.y;
+                                       mouse_position.X = xevent.ButtonEvent.x;
+                                       mouse_position.Y = xevent.ButtonEvent.y;
 
                                        if (!hwnd.Enabled) {
                                                IntPtr dummy;
 
                                                msg.hwnd = hwnd.EnabledHwnd;
                                                XTranslateCoordinates(DisplayHandle, xevent.AnyEvent.window, Hwnd.ObjectFromHandle(msg.hwnd).ClientWindow, xevent.ButtonEvent.x, xevent.ButtonEvent.y, out xevent.ButtonEvent.x, out xevent.ButtonEvent.y, out dummy);
-                                               msg.lParam = (IntPtr)(MousePosition.Y << 16 | MousePosition.X);
+                                               msg.lParam = (IntPtr)(mouse_position.Y << 16 | mouse_position.X);
                                        }
 
                                        if (Grab.Hwnd != IntPtr.Zero) {
@@ -3327,7 +3368,10 @@ namespace System.Windows.Forms {
                                                ClickPending.lParam = msg.lParam;
                                                ClickPending.Time = (long)xevent.ButtonEvent.time;
                                        }
-
+                                       
+                                       if (msg.message == Msg.WM_LBUTTONDOWN || msg.message == Msg.WM_MBUTTONDOWN || msg.message == Msg.WM_RBUTTONDOWN)
+                                               SendParentNotify(msg.hwnd, msg.message, mouse_position.X, mouse_position.Y);
+                                       
                                        break;
                                }
 
@@ -3388,7 +3432,7 @@ namespace System.Windows.Forms {
 
                                                msg.hwnd = hwnd.EnabledHwnd;
                                                XTranslateCoordinates(DisplayHandle, xevent.AnyEvent.window, Hwnd.ObjectFromHandle(msg.hwnd).ClientWindow, xevent.ButtonEvent.x, xevent.ButtonEvent.y, out xevent.ButtonEvent.x, out xevent.ButtonEvent.y, out dummy);
-                                               msg.lParam = (IntPtr)(MousePosition.Y << 16 | MousePosition.X);
+                                               msg.lParam = (IntPtr)(mouse_position.Y << 16 | mouse_position.X);
                                        }
 
                                        if (Grab.Hwnd != IntPtr.Zero) {
@@ -3396,8 +3440,8 @@ namespace System.Windows.Forms {
                                        }
 
                                        msg.lParam=(IntPtr) (xevent.ButtonEvent.y << 16 | xevent.ButtonEvent.x);
-                                       MousePosition.X = xevent.ButtonEvent.x;
-                                       MousePosition.Y = xevent.ButtonEvent.y;
+                                       mouse_position.X = xevent.ButtonEvent.x;
+                                       mouse_position.Y = xevent.ButtonEvent.y;
                                        break;
                                }
 
@@ -3424,21 +3468,21 @@ namespace System.Windows.Forms {
 
                                                        msg.hwnd = hwnd.EnabledHwnd;
                                                        XTranslateCoordinates(DisplayHandle, xevent.AnyEvent.window, Hwnd.ObjectFromHandle(msg.hwnd).ClientWindow, xevent.MotionEvent.x, xevent.MotionEvent.y, out xevent.MotionEvent.x, out xevent.MotionEvent.y, out dummy);
-                                                       msg.lParam = (IntPtr)(MousePosition.Y << 16 | MousePosition.X);
+                                                       msg.lParam = (IntPtr)(mouse_position.Y << 16 | mouse_position.X);
                                                }
 
-                                               MousePosition.X = xevent.MotionEvent.x;
-                                               MousePosition.Y = xevent.MotionEvent.y;
+                                               mouse_position.X = xevent.MotionEvent.x;
+                                               mouse_position.Y = xevent.MotionEvent.y;
 
                                                if ((HoverState.Timer.Enabled) &&
-                                                   (((MousePosition.X + HoverState.Size.Width) < HoverState.X) ||
-                                                   ((MousePosition.X - HoverState.Size.Width) > HoverState.X) ||
-                                                   ((MousePosition.Y + HoverState.Size.Height) < HoverState.Y) ||
-                                                   ((MousePosition.Y - HoverState.Size.Height) > HoverState.Y))) {
+                                                   (((mouse_position.X + HoverState.Size.Width) < HoverState.X) ||
+                                                   ((mouse_position.X - HoverState.Size.Width) > HoverState.X) ||
+                                                   ((mouse_position.Y + HoverState.Size.Height) < HoverState.Y) ||
+                                                   ((mouse_position.Y - HoverState.Size.Height) > HoverState.Y))) {
                                                        HoverState.Timer.Stop();
                                                        HoverState.Timer.Start();
-                                                       HoverState.X = MousePosition.X;
-                                                       HoverState.Y = MousePosition.Y;
+                                                       HoverState.X = mouse_position.X;
+                                                       HoverState.Y = mouse_position.Y;
                                                }
 
                                                break;
@@ -3456,7 +3500,7 @@ namespace System.Windows.Forms {
                                                if (!hwnd.Enabled) {
                                                        msg.hwnd = hwnd.EnabledHwnd;
                                                        XTranslateCoordinates(DisplayHandle, xevent.AnyEvent.window, Hwnd.ObjectFromHandle(msg.hwnd).ClientWindow, xevent.MotionEvent.x, xevent.MotionEvent.y, out xevent.MotionEvent.x, out xevent.MotionEvent.y, out dummy);
-                                                       msg.lParam = (IntPtr)(MousePosition.Y << 16 | MousePosition.X);
+                                                       msg.lParam = (IntPtr)(mouse_position.Y << 16 | mouse_position.X);
                                                }
 
                                                // The hit test is sent in screen coordinates
@@ -3469,8 +3513,8 @@ namespace System.Windows.Forms {
                                                                IntPtr.Zero, msg.lParam).ToInt32 ();
                                                NativeWindow.WndProc(hwnd.client_window, Msg.WM_SETCURSOR, msg.hwnd, (IntPtr)ht);
 
-                                               MousePosition.X = xevent.MotionEvent.x;
-                                               MousePosition.Y = xevent.MotionEvent.y;
+                                               mouse_position.X = xevent.MotionEvent.x;
+                                               mouse_position.Y = xevent.MotionEvent.y;
                                        }
 
                                        break;
@@ -4138,6 +4182,11 @@ namespace System.Windows.Forms {
                        ThreadQueue(Thread.CurrentThread).PostQuitState = true;
                }
 
+               internal override void RequestAdditionalWM_NCMessages(IntPtr hwnd, bool hover, bool leave)
+               {
+                       // TODO
+               }
+
                internal override void RequestNCRecalc(IntPtr handle) {
                        Hwnd                            hwnd;
 
@@ -4161,8 +4210,8 @@ namespace System.Windows.Forms {
                        }
 
                        HoverState.Timer.Enabled = true;
-                       HoverState.X = MousePosition.X;
-                       HoverState.Y = MousePosition.Y;
+                       HoverState.X = mouse_position.X;
+                       HoverState.Y = mouse_position.Y;
                        HoverState.Window = handle;
                }
 
@@ -4341,6 +4390,33 @@ namespace System.Windows.Forms {
                        return NativeWindow.WndProc(hwnd, message, wParam, lParam);
                }
 
+               internal override int SendInput(IntPtr handle, Queue keys) { 
+                       int count = keys.Count;
+
+                       while (keys.Count > 0) {
+                       
+                               MSG msg = (MSG)keys.Dequeue();
+
+                               XEvent xevent = new XEvent ();
+                               Hwnd hwnd = Hwnd.ObjectFromHandle(handle);
+
+                               xevent.type = (msg.message == Msg.WM_KEYUP ? XEventName.KeyRelease : XEventName.KeyPress);
+                               xevent.KeyEvent.display = DisplayHandle;
+
+                               if (hwnd != null) {
+                                       xevent.KeyEvent.window = hwnd.whole_window;
+                               } else {
+                                       xevent.KeyEvent.window = IntPtr.Zero;
+                               }
+
+                               xevent.KeyEvent.keycode = Keyboard.ToKeycode((int)msg.wParam);
+
+                               hwnd.Queue.EnqueueLocked (xevent);
+                       }
+                       return count;
+               }
+
+
                internal override void SetAllowDrop (IntPtr handle, bool value)
                {
                        // We allow drop on all windows
@@ -4836,6 +4912,11 @@ namespace System.Windows.Forms {
                        SetWMStyles(hwnd, cp);
                }
 
+               internal override double GetWindowTransparency(IntPtr handle)
+               {
+                       return 1.0;
+               }
+
                internal override void SetWindowTransparency(IntPtr handle, double transparency, Color key) {
                        Hwnd    hwnd;
                        IntPtr  opacity;
@@ -4914,9 +4995,9 @@ namespace System.Windows.Forms {
                        return (Object) ThreadQueue(thread);
                }
 
-               internal override bool SupportsTransparency() {
+               internal override TransparencySupport SupportsTransparency() {
                        // We need to check if the x compositing manager is running
-                       return true;
+                       return TransparencySupport.Set;
                }
 
                internal override bool SystrayAdd(IntPtr handle, string tip, Icon icon, out ToolTip tt) {
@@ -5071,6 +5152,54 @@ namespace System.Windows.Forms {
                        hwnd.Queue.Paint.Remove(hwnd);
                }
 
+               internal override void CreateOffscreenDrawable (IntPtr handle,
+                                                               int width, int height,
+                                                               out object offscreen_drawable)
+               {
+                       IntPtr root_out;
+                       int x_out, y_out, width_out, height_out, border_width_out, depth_out;
+
+                       XGetGeometry (DisplayHandle, handle,
+                                     out root_out,
+                                     out x_out, out y_out,
+                                     out width_out, out height_out,
+                                     out border_width_out, out depth_out);
+
+                       IntPtr pixmap = XCreatePixmap (DisplayHandle, handle, width, height, depth_out);
+
+                       offscreen_drawable = pixmap;
+
+               }
+
+               internal override void DestroyOffscreenDrawable (object offscreen_drawable)
+               {
+                       XFreePixmap (DisplayHandle, (IntPtr)offscreen_drawable);
+               }
+
+               internal override Graphics GetOffscreenGraphics (object offscreen_drawable)
+               {
+                       return Graphics.FromHwnd ((IntPtr) offscreen_drawable);
+               }
+               
+               internal override void BlitFromOffscreen (IntPtr dest_handle,
+                                                         Graphics dest_dc,
+                                                         object offscreen_drawable,
+                                                         Graphics offscreen_dc,
+                                                         Rectangle r)
+               {
+                       XGCValues gc_values;
+                       IntPtr gc;
+
+                       gc_values = new XGCValues();
+
+                       gc = XCreateGC (DisplayHandle, dest_handle, IntPtr.Zero, ref gc_values);
+
+                       XCopyArea (DisplayHandle, (IntPtr)offscreen_drawable, dest_handle,
+                                  gc, r.X, r.Y, r.Width, r.Height, r.X, r.Y);
+
+                       XFreeGC (DisplayHandle, gc);
+               }
+
                #endregion      // Public Static Methods
 
                #region Events
@@ -5262,12 +5391,18 @@ namespace System.Windows.Forms {
                [DllImport ("libX11", EntryPoint="XSetFunction")]
                internal extern static int XSetFunction(IntPtr display, IntPtr gc, GXFunction function);
 
+               [DllImport ("libX11", EntryPoint="XSetLineAttributes")]
+               internal extern static int XSetLineAttributes(IntPtr display, IntPtr gc, int line_width, GCLineStyle line_style, GCCapStyle cap_style, GCJoinStyle join_style);
+
                [DllImport ("libX11", EntryPoint="XDrawLine")]
                internal extern static int XDrawLine(IntPtr display, IntPtr drawable, IntPtr gc, int x1, int y1, int x2, int y2);
 
                [DllImport ("libX11", EntryPoint="XDrawRectangle")]
                internal extern static int XDrawRectangle(IntPtr display, IntPtr drawable, IntPtr gc, int x1, int y1, int width, int height);
 
+               [DllImport ("libX11", EntryPoint="XFillRectangle")]
+               internal extern static int XFillRectangle(IntPtr display, IntPtr drawable, IntPtr gc, int x1, int y1, int width, int height);
+
                [DllImport ("libX11", EntryPoint="XSetWindowBackground")]
                internal extern static int XSetWindowBackground(IntPtr display, IntPtr window, IntPtr background);
 
@@ -5301,6 +5436,9 @@ namespace System.Windows.Forms {
                [DllImport ("libX11", EntryPoint="XCreatePixmapFromBitmapData")]
                internal extern static IntPtr XCreatePixmapFromBitmapData(IntPtr display, IntPtr drawable, byte[] data, int width, int height, IntPtr fg, IntPtr bg, int depth);
 
+               [DllImport ("libX11", EntryPoint="XCreatePixmap")]
+               internal extern static IntPtr XCreatePixmap(IntPtr display, IntPtr d, int width, int height, int depth);
+
                [DllImport ("libX11", EntryPoint="XFreePixmap")]
                internal extern static IntPtr XFreePixmap(IntPtr display, IntPtr pixmap);