Permalink
Browse files

[X11] Remove unused XCreateWindow overloads

  • Loading branch information...
1 parent e39e4fb commit 7accefea3ef4b9e8c7c3f46c65e2c6a1d438cbb6 @thefiddler thefiddler committed Jun 17, 2014
@@ -117,24 +117,6 @@ static void CurrentDomain_ProcessExit(object sender, EventArgs e)
#region Window handling
- [Obsolete("Use XCreateWindow instead")]
- [DllImport(_dll_name, EntryPoint = "XCreateWindow")]
- public extern static Window CreateWindow(
- Display display,
- Window parent,
- int x, int y,
- //uint width, uint height,
- int width, int height,
- //uint border_width,
- int border_width,
- int depth,
- //uint @class,
- int @class,
- IntPtr visual,
- [MarshalAs(UnmanagedType.SysUInt)] CreateWindowMask valuemask,
- SetWindowAttributes attributes
- );
-
[DllImport(_dll_name, EntryPoint = "XCreateSimpleWindow")]
public extern static Window CreateSimpleWindow(
Display display,
@@ -1462,10 +1444,26 @@ internal static partial class Functions
/// <para>The XCreateSimpleWindow function creates an unmapped InputOutput subwindow for a specified parent window, returns the window ID of the created window, and causes the X server to generate a CreateNotify event. The created window is placed on top in the stacking order with respect to siblings. Any part of the window that extends outside its parent window is clipped. The border_width for an InputOnly window must be zero, or a BadMatch error results. XCreateSimpleWindow inherits its depth, class, and visual from its parent. All other window attributes, except background and border, have their default values. </para>
/// <para>XCreateSimpleWindow can generate BadAlloc, BadMatch, BadValue, and BadWindow errors.</para>
/// </remarks>
- [DllImport(X11Library, EntryPoint = "XCreateWindow")]//, CLSCompliant(false)]
- public extern static Window XCreateWindow(Display display, Window parent,
+ public static Window XCreateWindow(Display display, Window parent,
int x, int y, int width, int height, int border_width, int depth,
- int @class, IntPtr visual, UIntPtr valuemask, ref XSetWindowAttributes attributes);
+ CreateWindowArgs @class, IntPtr visual, SetWindowValuemask valuemask,
+ XSetWindowAttributes? attributes)
+ {
+ unsafe
+ {
+ if (attributes.HasValue)
+ {
+ XSetWindowAttributes attr = attributes.Value;
+ return XCreateWindow(display, parent, x, y, width, height, border_width, depth,
+ (int)@class, visual, (IntPtr)valuemask, &attr);
+ }
+ else
+ {
+ return XCreateWindow(display, parent, x, y, width, height, border_width, depth,
+ (int)@class, visual, (IntPtr)valuemask, null);
+ }
+ }
+ }
#endregion
@@ -71,10 +71,8 @@ public static IntPtr XOpenDisplay(IntPtr display)
[DllImport("libX11", EntryPoint = "XSynchronize")]
public extern static IntPtr XSynchronize(IntPtr display, bool onoff);
- //[DllImport("libX11", EntryPoint = "XCreateWindow"), CLSCompliant(false)]
- //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", EntryPoint = "XCreateWindow")]
- 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, IntPtr valuemask, ref XSetWindowAttributes attributes);
+ public unsafe 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, IntPtr valuemask, XSetWindowAttributes* attributes);
[DllImport("libX11", EntryPoint = "XCreateSimpleWindow")]//, CLSCompliant(false)]
public extern static IntPtr XCreateSimpleWindow(IntPtr display, IntPtr parent, int x, int y, int width, int height, int border_width, UIntPtr border, UIntPtr background);
@@ -103,7 +101,8 @@ public static IntPtr XOpenDisplay(IntPtr display)
[DllImport("libX11")]
public extern static Bool XCheckTypedEvent(Display display, XEventName event_type, out XEvent event_return);
-
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ [return: MarshalAs(UnmanagedType.Bool)]
public delegate Bool EventPredicate(IntPtr display, ref XEvent e, IntPtr arg);
[DllImport("libX11")]
public extern static Bool XIfEvent(Display display, ref XEvent e, IntPtr predicate, IntPtr arg );
@@ -181,12 +181,13 @@ internal sealed class X11GLNative : NativeWindowBase
EventMask.PropertyChangeMask;
attributes.event_mask = (IntPtr)window.EventMask;
- uint mask = (uint)SetWindowValuemask.ColorMap | (uint)SetWindowValuemask.EventMask |
- (uint)SetWindowValuemask.BackPixel | (uint)SetWindowValuemask.BorderPixel;
+ SetWindowValuemask mask =
+ SetWindowValuemask.ColorMap | SetWindowValuemask.EventMask |
+ SetWindowValuemask.BackPixel | SetWindowValuemask.BorderPixel;
window.Handle = Functions.XCreateWindow(window.Display, window.RootWindow,
x, y, width, height, 0, window.VisualInfo.Depth/*(int)CreateWindowArgs.CopyFromParent*/,
- (int)CreateWindowArgs.InputOutput, window.VisualInfo.Visual, (UIntPtr)mask, ref attributes);
+ CreateWindowArgs.InputOutput, window.VisualInfo.Visual, mask, attributes);
if (window.Handle == IntPtr.Zero)
throw new ApplicationException("XCreateWindow call failed (returned 0).");

0 comments on commit 7accefe

Please sign in to comment.