From 0133eb12220fb875f215f3da7748f71a665dcba2 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Tue, 21 Aug 2007 09:01:24 +0000 Subject: [PATCH] Corrected critical bug in X11/API.cs: VisualInfo.visualid was int where it should have been IntPtr, causing incorrect visuals to be created on 64bit platforms. Removed the OnCreate/OnDestroy methods from INativeGLWindow. Added convenience overloads to OpenTK.OpenGL.GL: Color3 and Color4 can now take a System.Drawing.Color directly. --- Source/OpenTK/OpenGL/GLHelper.cs | 14 + Source/OpenTK/Platform/INativeGLWindow.cs | 4 +- Source/OpenTK/Platform/X11/API.cs | 251 ++-- Source/OpenTK/Platform/X11/Functions.cs | 214 ++-- Source/OpenTK/Platform/X11/Glx.cs | 8 +- Source/OpenTK/Platform/X11/Structs.cs | 1224 ++++++++++---------- Source/OpenTK/Platform/X11/WindowInfo.cs | 22 +- Source/OpenTK/Platform/X11/X11GLContext.cs | 18 +- Source/OpenTK/Platform/X11/X11GLNative.cs | 75 +- Source/OpenTK/Platform/X11/X11Keyboard.cs | 2 + 10 files changed, 925 insertions(+), 907 deletions(-) diff --git a/Source/OpenTK/OpenGL/GLHelper.cs b/Source/OpenTK/OpenGL/GLHelper.cs index 0d880683..d620ef07 100644 --- a/Source/OpenTK/OpenGL/GLHelper.cs +++ b/Source/OpenTK/OpenGL/GLHelper.cs @@ -284,5 +284,19 @@ namespace OpenTK.OpenGL } #endregion + + #region public static void Color3() + + public static void Color4(System.Drawing.Color color) + { + GL.Color4(color.R, color.G, color.B, color.A); + } + + public static void Color3(System.Drawing.Color color) + { + GL.Color3(color.R, color.G, color.B); + } + + #endregion } } diff --git a/Source/OpenTK/Platform/INativeGLWindow.cs b/Source/OpenTK/Platform/INativeGLWindow.cs index 873565fd..aa08ad84 100644 --- a/Source/OpenTK/Platform/INativeGLWindow.cs +++ b/Source/OpenTK/Platform/INativeGLWindow.cs @@ -19,8 +19,8 @@ namespace OpenTK.Platform void DestroyWindow(); void ProcessEvents(); - void OnCreate(EventArgs e); - void OnDestroy(EventArgs e); + //void OnCreate(EventArgs e); + //void OnDestroy(EventArgs e); bool Exists { get; } //bool IsExiting { get; } diff --git a/Source/OpenTK/Platform/X11/API.cs b/Source/OpenTK/Platform/X11/API.cs index d202476a..aa640dd3 100644 --- a/Source/OpenTK/Platform/X11/API.cs +++ b/Source/OpenTK/Platform/X11/API.cs @@ -34,9 +34,9 @@ namespace OpenTK.Platform.X11 #endregion - #region internal static class API + #region public static class API - internal static class API + public static class API { // Prevent BeforeFieldInit optimization. static API() { } @@ -46,21 +46,21 @@ namespace OpenTK.Platform.X11 // Display management [DllImport(_dll_name, EntryPoint = "XOpenDisplay")] - extern internal static IntPtr OpenDisplay([MarshalAs(UnmanagedType.LPTStr)] string display_name); + extern public static IntPtr OpenDisplay([MarshalAs(UnmanagedType.LPTStr)] string display_name); [DllImport(_dll_name, EntryPoint = "XCloseDisplay")] - extern internal static void CloseDisplay(Display display); + extern public static void CloseDisplay(Display display); [DllImport(_dll_name, EntryPoint = "XCreateColormap")] - extern internal static IntPtr CreateColormap(Display display, Window window, IntPtr visual, int alloc); + extern public static IntPtr CreateColormap(Display display, Window window, IntPtr visual, int alloc); #region Window handling [DllImport(_dll_name, EntryPoint = "XRootWindow")] - internal static extern Window RootWindow(Display display, int screen); + public static extern Window RootWindow(Display display, int screen); [DllImport(_dll_name, EntryPoint = "XCreateWindow")] - internal extern static Window CreateWindow( + public extern static Window CreateWindow( Display display, Window parent, int x, int y, @@ -77,7 +77,7 @@ namespace OpenTK.Platform.X11 ); [DllImport(_dll_name, EntryPoint = "XCreateSimpleWindow")] - internal extern static Window CreateSimpleWindow( + public extern static Window CreateSimpleWindow( Display display, Window parent, int x, int y, @@ -88,24 +88,24 @@ namespace OpenTK.Platform.X11 ); [DllImport(_dll_name, EntryPoint = "XResizeWindow")] - internal extern static int XResizeWindow(Display display, Window window, int width, int height); + public extern static int XResizeWindow(Display display, Window window, int width, int height); [DllImport(_dll_name, EntryPoint = "XDestroyWindow")] - internal extern static void DestroyWindow(Display display, Window window); + public extern static void DestroyWindow(Display display, Window window); [DllImport(_dll_name, EntryPoint = "XMapWindow")] - extern internal static void MapWindow(Display display, Window window); + extern public static void MapWindow(Display display, Window window); [DllImport(_dll_name, EntryPoint = "XMapRaised")] - extern internal static void MapRaised(Display display, Window window); + extern public static void MapRaised(Display display, Window window); #endregion [DllImport(_dll_name, EntryPoint = "XDefaultScreen")] - extern internal static int DefaultScreen(Display display); + extern public static int DefaultScreen(Display display); [DllImport(_dll_name, EntryPoint = "XDefaultVisual")] - extern internal static IntPtr DefaultVisual(Display display, int screen_number); + extern public static IntPtr DefaultVisual(Display display, int screen_number); #region XFree @@ -114,7 +114,7 @@ namespace OpenTK.Platform.X11 /// /// A pointer to the structure that will be freed. [DllImport(_dll_name, EntryPoint = "XFree")] - extern internal static void Free(IntPtr data); + extern public static void Free(IntPtr data); #endregion @@ -122,33 +122,33 @@ namespace OpenTK.Platform.X11 [System.Security.SuppressUnmanagedCodeSecurity] [DllImport(_dll_name, EntryPoint = "XEventsQueued")] - extern internal static int EventsQueued(Display display, int mode); + extern public static int EventsQueued(Display display, int mode); [System.Security.SuppressUnmanagedCodeSecurity] [DllImport(_dll_name, EntryPoint = "XPending")] - extern internal static int Pending(Display display); + extern public static int Pending(Display display); //[System.Security.SuppressUnmanagedCodeSecurity] [DllImport(_dll_name, EntryPoint = "XNextEvent")] - extern internal static void NextEvent( + extern public static void NextEvent( Display display, [MarshalAs(UnmanagedType.AsAny)][In, Out]object e); [DllImport(_dll_name, EntryPoint = "XNextEvent")] - extern internal static void NextEvent(Display display, [In, Out] IntPtr e); + extern public static void NextEvent(Display display, [In, Out] IntPtr e); [DllImport(_dll_name, EntryPoint = "XPeekEvent")] - extern internal static void PeekEvent( + extern public static void PeekEvent( Display display, [MarshalAs(UnmanagedType.AsAny)][In, Out]object event_return ); [DllImport(_dll_name, EntryPoint = "XPeekEvent")] - extern internal static void PeekEvent(Display display, [In, Out]XEvent event_return); + extern public static void PeekEvent(Display display, [In, Out]XEvent event_return); [DllImport(_dll_name, EntryPoint = "XSendEvent")] [return: MarshalAs(UnmanagedType.Bool)] - extern internal static bool SendEvent(Display display, Window window, bool propagate, + extern public static bool SendEvent(Display display, Window window, bool propagate, [MarshalAs(UnmanagedType.SysInt)]EventMask event_mask, ref XEvent event_send); /// @@ -173,7 +173,7 @@ namespace OpenTK.Platform.X11 /// XSelectInput() can generate a BadWindow error. /// [DllImport(_dll_name, EntryPoint = "XSelectInput")] - internal static extern void SelectInput(Display display, Window w, EventMask event_mask); + public static extern void SelectInput(Display display, Window w, EventMask event_mask); /// /// When the predicate procedure finds a match, XCheckIfEvent() copies the matched event into the client-supplied XEvent structure and returns True. (This event is removed from the queue.) If the predicate procedure finds no match, XCheckIfEvent() returns False, and the output buffer will have been flushed. All earlier events stored in the queue are not discarded. @@ -185,39 +185,39 @@ namespace OpenTK.Platform.X11 /// true if the predicate returns true for some event, false otherwise [DllImport(_dll_name, EntryPoint = "XCheckIfEvent")] [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool CheckIfEvent(Display display, ref XEvent event_return, + public static extern bool CheckIfEvent(Display display, ref XEvent event_return, /*[MarshalAs(UnmanagedType.FunctionPtr)] */ CheckEventPredicate predicate, /*XPointer*/ IntPtr arg); [DllImport(_dll_name, EntryPoint = "XIfEvent")] [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool IfEvent(Display display, ref XEvent event_return, + public static extern bool IfEvent(Display display, ref XEvent event_return, /*[MarshalAs(UnmanagedType.FunctionPtr)] */ CheckEventPredicate predicate, /*XPointer*/ IntPtr arg); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool CheckEventPredicate(Display display, ref XEvent @event, IntPtr arg); + public delegate bool CheckEventPredicate(Display display, ref XEvent @event, IntPtr arg); [DllImport(_dll_name, EntryPoint = "XCheckMaskEvent")] [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool CheckMaskEvent(Display display, EventMask event_mask, ref XEvent event_return); + public static extern bool CheckMaskEvent(Display display, EventMask event_mask, ref XEvent event_return); #endregion #region Pointer and Keyboard functions [DllImport(_dll_name, EntryPoint = "XGrabPointer")] - extern internal static ErrorCodes GrabPointer(Display display, IntPtr grab_window, + extern public static ErrorCodes GrabPointer(Display display, IntPtr grab_window, bool owner_events, int event_mask, GrabMode pointer_mode, GrabMode keyboard_mode, IntPtr confine_to, IntPtr cursor, int time); [DllImport(_dll_name, EntryPoint = "XUngrabPointer")] - extern internal static ErrorCodes UngrabPointer(Display display, int time); + extern public static ErrorCodes UngrabPointer(Display display, int time); [DllImport(_dll_name, EntryPoint = "XGrabKeyboard")] - extern internal static ErrorCodes GrabKeyboard(Display display, IntPtr grab_window, + extern public static ErrorCodes GrabKeyboard(Display display, IntPtr grab_window, bool owner_events, GrabMode pointer_mode, GrabMode keyboard_mode, int time); [DllImport(_dll_name, EntryPoint = "XUngrabKeyboard")] - extern internal static void UngrabKeyboard(Display display, int time); + extern public static void UngrabKeyboard(Display display, int time); /// /// The XGetKeyboardMapping() function returns the symbols for the specified number of KeyCodes starting with first_keycode. @@ -240,7 +240,7 @@ namespace OpenTK.Platform.X11 /// BadValue: Some numeric value falls outside the range of values accepted by the request. Unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. Any argument defined as a set of alternatives can generate this error. /// [DllImport(_dll_name, EntryPoint = "XGetKeyboardMapping")] - internal static extern KeySym GetKeyboardMapping(Display display, KeyCode first_keycode, int keycode_count, + public static extern KeySym GetKeyboardMapping(Display display, KeyCode first_keycode, int keycode_count, ref int keysyms_per_keycode_return); /// @@ -251,14 +251,14 @@ namespace OpenTK.Platform.X11 /// Returns the maximum number of KeyCodes. /// The minimum number of KeyCodes returned is never less than 8, and the maximum number of KeyCodes returned is never greater than 255. Not all KeyCodes in this range are required to have corresponding keys. [DllImport(_dll_name, EntryPoint = "XDisplayKeycodes")] - internal static extern void DisplayKeycodes(Display display, ref int min_keycodes_return, ref int max_keycodes_return); + public static extern void DisplayKeycodes(Display display, ref int min_keycodes_return, ref int max_keycodes_return); #endregion - #region Xf86VidMode internal structures + #region Xf86VidMode public structures [StructLayout(LayoutKind.Sequential)] - internal struct XF86VidModeModeLine + public struct XF86VidModeModeLine { short hdisplay; /* Number of display pixels horizontally */ short hsyncstart; /* Horizontal sync start */ @@ -277,67 +277,67 @@ namespace OpenTK.Platform.X11 /// Specifies an XF86 display mode. /// [StructLayout(LayoutKind.Sequential)] - internal struct XF86VidModeModeInfo + public struct XF86VidModeModeInfo { /// /// Pixel clock. /// - internal int dotclock; + public int dotclock; /// /// Number of display pixels horizontally /// - internal short hdisplay; + public short hdisplay; /// /// Horizontal sync start /// - internal short hsyncstart; + public short hsyncstart; /// /// Horizontal sync end /// - internal short hsyncend; + public short hsyncend; /// /// Total horizontal pixel /// - internal short htotal; + public short htotal; /// /// /// - internal short hskew; + public short hskew; /// /// Number of display pixels vertically /// - internal short vdisplay; + public short vdisplay; /// /// Vertical sync start /// - internal short vsyncstart; + public short vsyncstart; /// /// Vertical sync end /// - internal short vsyncend; + public short vsyncend; /// /// Total vertical pixels /// - internal short vtotal; + public short vtotal; /// /// /// - internal short vskew; + public short vskew; /// /// Mode flags /// - internal int flags; + public int flags; int privsize; /* Size of private */ IntPtr _private; /* Server privates */ @@ -345,7 +345,7 @@ namespace OpenTK.Platform.X11 //Monitor information: [StructLayout(LayoutKind.Sequential)] - internal struct XF86VidModeMonitor + public struct XF86VidModeMonitor { [MarshalAs(UnmanagedType.LPStr)] string vendor; /* Name of manufacturer */ @@ -361,14 +361,14 @@ namespace OpenTK.Platform.X11 } [StructLayout(LayoutKind.Sequential)] - internal struct XF86VidModeSyncRange + public struct XF86VidModeSyncRange { float hi; /* Top of range */ float lo; /* Bottom of range */ } [StructLayout(LayoutKind.Sequential)] - internal struct XF86VidModeNotifyEvent + public struct XF86VidModeNotifyEvent { int type; /* of event */ ulong serial; /* # of last request processed by server */ @@ -383,7 +383,7 @@ namespace OpenTK.Platform.X11 } [StructLayout(LayoutKind.Sequential)] - internal struct XF86VidModeGamma + public struct XF86VidModeGamma { float red; /* Red Gamma value */ float green; /* Green Gamma value */ @@ -394,20 +394,20 @@ namespace OpenTK.Platform.X11 #region libXxf86vm Functions [DllImport(_dll_name_vid)] - extern internal static bool XF86VidModeQueryExtension( + extern public static bool XF86VidModeQueryExtension( Display display, out int event_base_return, out int error_base_return); /* [DllImport(_dll_name_vid)] - extern internal static bool XF86VidModeSwitchMode( + extern public static bool XF86VidModeSwitchMode( Display display, int screen, int zoom); */ [DllImport(_dll_name_vid)] - extern internal static bool XF86VidModeSwitchToMode( + extern public static bool XF86VidModeSwitchToMode( Display display, int screen, IntPtr @@ -415,13 +415,13 @@ namespace OpenTK.Platform.X11 [DllImport(_dll_name_vid)] - extern internal static bool XF86VidModeQueryVersion( + extern public static bool XF86VidModeQueryVersion( Display display, out int major_version_return, out int minor_version_return); [DllImport(_dll_name_vid)] - extern internal static bool XF86VidModeGetAllModeLines( + extern public static bool XF86VidModeGetAllModeLines( Display display, int screen, out int modecount_return, @@ -429,7 +429,7 @@ namespace OpenTK.Platform.X11 out IntPtr modesinfo); [DllImport(_dll_name_vid)] - extern internal static bool XF86VidModeSetViewPort( + extern public static bool XF86VidModeSetViewPort( Display display, int screen, int x, @@ -521,32 +521,31 @@ XF86VidModeGetGammaRampSize( #endregion [DllImport(_dll_name, EntryPoint = "XLookupKeysym")] - internal static extern KeySym LookupKeysym(ref XKeyEvent key_event, int index); + public static extern KeySym LookupKeysym(ref XKeyEvent key_event, int index); } #endregion #region X11 Structures - #region internal class VisualInfo + #region public class VisualInfo [StructLayout(LayoutKind.Sequential)] public class VisualInfo { - internal IntPtr visual; - internal int visualid; - internal int screen; - internal int depth; - internal int @class; - internal long redMask; - internal long greenMask; - internal long blueMask; - internal int colormap_size; - internal int bits_per_rgb; + public IntPtr visual; + public VisualID visualid; + public int screen; + public int depth; + public XVisualClass @class; + public long redMask; + public long greenMask; + public long blueMask; + public int colormap_size; + public int bits_per_rgb; public override string ToString() { - // return base.ToString(); return String.Format("id ({0}), screen ({1}), depth ({2}), class ({3})", visualid, screen, depth, @class); } @@ -554,93 +553,93 @@ XF86VidModeGetGammaRampSize( #endregion - #region internal class SetWindowAttributes + #region public class SetWindowAttributes [StructLayout(LayoutKind.Sequential)] - internal class SetWindowAttributes + public class SetWindowAttributes { /// /// background, None, or ParentRelative /// - internal Pixmap background_pixmap; + public Pixmap background_pixmap; /// /// background pixel /// - internal long background_pixel; + public long background_pixel; /// /// border of the window or CopyFromParent /// - internal Pixmap border_pixmap; + public Pixmap border_pixmap; /// /// border pixel value /// - internal long border_pixel; + public long border_pixel; /// /// one of bit gravity values /// - internal int bit_gravity; + public int bit_gravity; /// /// one of the window gravity values /// - internal int win_gravity; + public int win_gravity; /// /// NotUseful, WhenMapped, Always /// - internal int backing_store; + public int backing_store; /// /// planes to be preserved if possible /// - internal long backing_planes; + public long backing_planes; /// /// value to use in restoring planes /// - internal long backing_pixel; + public long backing_pixel; /// /// should bits under be saved? (popups) /// - internal bool save_under; + public bool save_under; /// /// set of events that should be saved /// - internal EventMask event_mask; + public EventMask event_mask; /// /// set of events that should not propagate /// - internal long do_not_propagate_mask; + public long do_not_propagate_mask; /// /// boolean value for override_redirect /// - internal bool override_redirect; + public bool override_redirect; /// /// color map to be associated with window /// - internal Colormap colormap; + public Colormap colormap; /// /// cursor to be displayed (or None) /// - internal Cursor cursor; + public Cursor cursor; } #endregion - #region internal struct SizeHints + #region public struct SizeHints [StructLayout(LayoutKind.Sequential)] - internal struct SizeHints + public struct SizeHints { - internal long flags; /* marks which fields in this structure are defined */ - internal int x, y; /* Obsolete */ - internal int width, height; /* Obsolete */ - internal int min_width, min_height; - internal int max_width, max_height; - internal int width_inc, height_inc; - internal Rectangle min_aspect, max_aspect; - internal int base_width, base_height; - internal int win_gravity; - internal struct Rectangle + public long flags; /* marks which fields in this structure are defined */ + public int x, y; /* Obsolete */ + public int width, height; /* Obsolete */ + public int min_width, min_height; + public int max_width, max_height; + public int width_inc, height_inc; + public Rectangle min_aspect, max_aspect; + public int base_width, base_height; + public int win_gravity; + public struct Rectangle { - internal int x; /* numerator */ - internal int y; /* denominator */ + public int x; /* numerator */ + public int y; /* denominator */ private void stop_the_compiler_warnings() { x = y = 0; } } /* this structure may be extended in the future */ @@ -652,19 +651,19 @@ XF86VidModeGetGammaRampSize( #region X11 Constants and Enums - internal struct Constants + public struct Constants { - internal const int QueuedAlready = 0; - internal const int QueuedAfterReading = 1; - internal const int QueuedAfterFlush = 2; + public const int QueuedAlready = 0; + public const int QueuedAfterReading = 1; + public const int QueuedAfterFlush = 2; - internal const int CopyFromParent = 0; - internal const int CWX = 1; - internal const int InputOutput = 1; - internal const int InputOnly = 2; + public const int CopyFromParent = 0; + public const int CWX = 1; + public const int InputOutput = 1; + public const int InputOnly = 2; } - internal enum ErrorCodes : int + public enum ErrorCodes : int { Success = 0, BadRequest = 1, @@ -687,7 +686,7 @@ XF86VidModeGetGammaRampSize( } [Flags] - internal enum CreateWindowMask : long//: ulong + public enum CreateWindowMask : long//: ulong { CWBackPixmap = (1L<<0), CWBackPixel = (1L<<1), @@ -718,7 +717,7 @@ XF86VidModeGetGammaRampSize( /// /// Defines LATIN-1 and miscellaneous keys. /// - internal enum XKey + public enum XKey { /* * TTY function keys, cleverly chosen to map to ASCII, for convenience of @@ -1038,5 +1037,31 @@ XF86VidModeGetGammaRampSize( #endregion + public enum XVisualClass : int + { + StaticGray = 0, + GrayScale = 1, + StaticColor = 2, + PseudoColor = 3, + TrueColor = 4, + DirectColor = 5, + } + + public enum XVisualInfoMask + { + VisualNoMask = 0x0, + VisualIDMask = 0x1, + VisualScreenMask = 0x2, + VisualDepthMask = 0x4, + VisualClassMask = 0x8, + VisualRedMaskMask = 0x10, + VisualGreenMaskMask = 0x20, + VisualBlueMaskMask = 0x40, + VisualColormapSizeMask = 0x80, + VisualBitsPerRGBMask = 0x100, + VisualAllMask = 0x1FF, + } + + #endregion } diff --git a/Source/OpenTK/Platform/X11/Functions.cs b/Source/OpenTK/Platform/X11/Functions.cs index 4fee743e..32c31ad8 100644 --- a/Source/OpenTK/Platform/X11/Functions.cs +++ b/Source/OpenTK/Platform/X11/Functions.cs @@ -5,313 +5,313 @@ using System.Runtime.InteropServices; namespace OpenTK.Platform.X11 { - class Functions + public class Functions { [DllImport("libX11", EntryPoint = "XOpenDisplay")] - internal extern static IntPtr XOpenDisplay(IntPtr display); + public extern static IntPtr XOpenDisplay(IntPtr display); [DllImport("libX11", EntryPoint = "XCloseDisplay")] - internal extern static int XCloseDisplay(IntPtr display); + public extern static int XCloseDisplay(IntPtr display); [DllImport("libX11", EntryPoint = "XSynchronize")] - internal extern static IntPtr XSynchronize(IntPtr display, bool onoff); + public extern static IntPtr XSynchronize(IntPtr display, bool onoff); [DllImport("libX11", EntryPoint = "XCreateWindow")] - internal 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); + 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 = "XCreateSimpleWindow")] - internal extern static IntPtr XCreateSimpleWindow(IntPtr display, IntPtr parent, int x, int y, int width, int height, int border_width, UIntPtr border, UIntPtr background); + 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", EntryPoint = "XMapWindow")] - internal extern static int XMapWindow(IntPtr display, IntPtr window); + public extern static int XMapWindow(IntPtr display, IntPtr window); [DllImport("libX11", EntryPoint = "XUnmapWindow")] - internal extern static int XUnmapWindow(IntPtr display, IntPtr window); + public extern static int XUnmapWindow(IntPtr display, IntPtr window); [DllImport("libX11", EntryPoint = "XMapSubwindows")] - internal extern static int XMapSubindows(IntPtr display, IntPtr window); + public extern static int XMapSubindows(IntPtr display, IntPtr window); [DllImport("libX11", EntryPoint = "XUnmapSubwindows")] - internal extern static int XUnmapSubwindows(IntPtr display, IntPtr window); + public extern static int XUnmapSubwindows(IntPtr display, IntPtr window); [DllImport("libX11", EntryPoint = "XRootWindow")] - internal extern static IntPtr XRootWindow(IntPtr display, int screen_number); + public extern static IntPtr XRootWindow(IntPtr display, int screen_number); [DllImport("libX11", EntryPoint = "XNextEvent")] - internal extern static IntPtr XNextEvent(IntPtr display, ref XEvent xevent); + public extern static IntPtr XNextEvent(IntPtr display, ref XEvent xevent); [DllImport("libX11")] - internal extern static int XConnectionNumber(IntPtr diplay); + public extern static int XConnectionNumber(IntPtr diplay); [DllImport("libX11")] - internal extern static int XPending(IntPtr diplay); + public extern static int XPending(IntPtr diplay); [DllImport("libX11", EntryPoint = "XSelectInput")] - internal extern static IntPtr XSelectInput(IntPtr display, IntPtr window, IntPtr mask); + public extern static IntPtr XSelectInput(IntPtr display, IntPtr window, IntPtr mask); [DllImport("libX11", EntryPoint = "XDestroyWindow")] - internal extern static int XDestroyWindow(IntPtr display, IntPtr window); + public extern static int XDestroyWindow(IntPtr display, IntPtr window); [DllImport("libX11", EntryPoint = "XReparentWindow")] - internal extern static int XReparentWindow(IntPtr display, IntPtr window, IntPtr parent, int x, int y); + public extern static int XReparentWindow(IntPtr display, IntPtr window, IntPtr parent, int x, int y); [DllImport("libX11", EntryPoint = "XMoveResizeWindow")] - internal extern static int XMoveResizeWindow(IntPtr display, IntPtr window, int x, int y, int width, int height); + public extern static int XMoveResizeWindow(IntPtr display, IntPtr window, int x, int y, int width, int height); [DllImport("libX11", EntryPoint = "XResizeWindow")] - internal extern static int XResizeWindow(IntPtr display, IntPtr window, int width, int height); + public extern static int XResizeWindow(IntPtr display, IntPtr window, int width, int height); [DllImport("libX11", EntryPoint = "XGetWindowAttributes")] - internal extern static int XGetWindowAttributes(IntPtr display, IntPtr window, ref XWindowAttributes attributes); + public extern static int XGetWindowAttributes(IntPtr display, IntPtr window, ref XWindowAttributes attributes); [DllImport("libX11", EntryPoint = "XFlush")] - internal extern static int XFlush(IntPtr display); + public extern static int XFlush(IntPtr display); [DllImport("libX11", EntryPoint = "XSetWMName")] - internal extern static int XSetWMName(IntPtr display, IntPtr window, ref XTextProperty text_prop); + public extern static int XSetWMName(IntPtr display, IntPtr window, ref XTextProperty text_prop); [DllImport("libX11", EntryPoint = "XStoreName")] - internal extern static int XStoreName(IntPtr display, IntPtr window, string window_name); + public extern static int XStoreName(IntPtr display, IntPtr window, string window_name); [DllImport("libX11", EntryPoint = "XFetchName")] - internal extern static int XFetchName(IntPtr display, IntPtr window, ref IntPtr window_name); + public extern static int XFetchName(IntPtr display, IntPtr window, ref IntPtr window_name); [DllImport("libX11", EntryPoint = "XSendEvent")] - internal extern static int XSendEvent(IntPtr display, IntPtr window, bool propagate, IntPtr event_mask, ref XEvent send_event); + public extern static int XSendEvent(IntPtr display, IntPtr window, bool propagate, IntPtr event_mask, ref XEvent send_event); [DllImport("libX11", EntryPoint = "XQueryTree")] - internal extern static int XQueryTree(IntPtr display, IntPtr window, out IntPtr root_return, out IntPtr parent_return, out IntPtr children_return, out int nchildren_return); + 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", EntryPoint = "XFree")] - internal extern static int XFree(IntPtr data); + public extern static int XFree(IntPtr data); [DllImport("libX11", EntryPoint = "XRaiseWindow")] - internal extern static int XRaiseWindow(IntPtr display, IntPtr window); + public extern static int XRaiseWindow(IntPtr display, IntPtr window); [DllImport("libX11", EntryPoint = "XLowerWindow")] - internal extern static uint XLowerWindow(IntPtr display, IntPtr window); + public extern static uint XLowerWindow(IntPtr display, IntPtr window); [DllImport("libX11", EntryPoint = "XConfigureWindow")] - internal extern static uint XConfigureWindow(IntPtr display, IntPtr window, ChangeWindowFlags value_mask, ref XWindowChanges values); + public extern static uint XConfigureWindow(IntPtr display, IntPtr window, ChangeWindowFlags value_mask, ref XWindowChanges values); [DllImport("libX11", EntryPoint = "XInternAtom")] - internal extern static IntPtr XInternAtom(IntPtr display, string atom_name, bool only_if_exists); + public extern static IntPtr XInternAtom(IntPtr display, string atom_name, bool only_if_exists); [DllImport("libX11", EntryPoint = "XInternAtoms")] - internal extern static int XInternAtoms(IntPtr display, string[] atom_names, int atom_count, bool only_if_exists, IntPtr[] atoms); + public extern static int XInternAtoms(IntPtr display, string[] atom_names, int atom_count, bool only_if_exists, IntPtr[] atoms); [DllImport("libX11", EntryPoint = "XSetWMProtocols")] - internal extern static int XSetWMProtocols(IntPtr display, IntPtr window, IntPtr[] protocols, int count); + public extern static int XSetWMProtocols(IntPtr display, IntPtr window, IntPtr[] protocols, int count); [DllImport("libX11", EntryPoint = "XGrabPointer")] - internal 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); + 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", EntryPoint = "XUngrabPointer")] - internal extern static int XUngrabPointer(IntPtr display, IntPtr timestamp); + public extern static int XUngrabPointer(IntPtr display, IntPtr timestamp); [DllImport("libX11", EntryPoint = "XQueryPointer")] - internal 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); + 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", EntryPoint = "XTranslateCoordinates")] - internal 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); + 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", EntryPoint = "XGetGeometry")] - internal 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); + 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", EntryPoint = "XGetGeometry")] - internal 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); + 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", EntryPoint = "XGetGeometry")] - internal 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); + 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", EntryPoint = "XGetGeometry")] - internal 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); + 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", EntryPoint = "XWarpPointer")] - internal 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); + 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", EntryPoint = "XClearWindow")] - internal extern static int XClearWindow(IntPtr display, IntPtr window); + public extern static int XClearWindow(IntPtr display, IntPtr window); [DllImport("libX11", EntryPoint = "XClearArea")] - internal extern static int XClearArea(IntPtr display, IntPtr window, int x, int y, int width, int height, bool exposures); + public extern static int XClearArea(IntPtr display, IntPtr window, int x, int y, int width, int height, bool exposures); // Colormaps [DllImport("libX11", EntryPoint = "XDefaultScreenOfDisplay")] - internal extern static IntPtr XDefaultScreenOfDisplay(IntPtr display); + public extern static IntPtr XDefaultScreenOfDisplay(IntPtr display); [DllImport("libX11", EntryPoint = "XScreenNumberOfScreen")] - internal extern static int XScreenNumberOfScreen(IntPtr display, IntPtr Screen); + public extern static int XScreenNumberOfScreen(IntPtr display, IntPtr Screen); [DllImport("libX11", EntryPoint = "XDefaultVisual")] - internal extern static IntPtr XDefaultVisual(IntPtr display, int screen_number); + public extern static IntPtr XDefaultVisual(IntPtr display, int screen_number); [DllImport("libX11", EntryPoint = "XDefaultDepth")] - internal extern static uint XDefaultDepth(IntPtr display, int screen_number); + public extern static uint XDefaultDepth(IntPtr display, int screen_number); [DllImport("libX11", EntryPoint = "XDefaultScreen")] - internal extern static int XDefaultScreen(IntPtr display); + public extern static int XDefaultScreen(IntPtr display); [DllImport("libX11", EntryPoint = "XDefaultColormap")] - internal extern static IntPtr XDefaultColormap(IntPtr display, int screen_number); + public extern static IntPtr XDefaultColormap(IntPtr display, int screen_number); [DllImport("libX11", EntryPoint = "XLookupColor")] - internal extern static int XLookupColor(IntPtr display, IntPtr Colormap, string Coloranem, ref XColor exact_def_color, ref XColor screen_def_color); + public extern static int XLookupColor(IntPtr display, IntPtr Colormap, string Coloranem, ref XColor exact_def_color, ref XColor screen_def_color); [DllImport("libX11", EntryPoint = "XAllocColor")] - internal extern static int XAllocColor(IntPtr display, IntPtr Colormap, ref XColor colorcell_def); + public extern static int XAllocColor(IntPtr display, IntPtr Colormap, ref XColor colorcell_def); [DllImport("libX11", EntryPoint = "XSetTransientForHint")] - internal extern static int XSetTransientForHint(IntPtr display, IntPtr window, IntPtr prop_window); + public extern static int XSetTransientForHint(IntPtr display, IntPtr window, IntPtr prop_window); [DllImport("libX11", EntryPoint = "XChangeProperty")] - internal extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, ref MotifWmHints data, int nelements); + public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, ref MotifWmHints data, int nelements); [DllImport("libX11", EntryPoint = "XChangeProperty")] - internal extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, ref uint value, int nelements); + public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, ref uint value, int nelements); [DllImport("libX11", EntryPoint = "XChangeProperty")] - internal extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, ref IntPtr value, int nelements); + public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, ref IntPtr value, int nelements); [DllImport("libX11", EntryPoint = "XChangeProperty")] - internal extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, uint[] data, int nelements); + public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, uint[] data, int nelements); [DllImport("libX11", EntryPoint = "XChangeProperty")] - internal extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, int[] data, int nelements); + public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, int[] data, int nelements); [DllImport("libX11", EntryPoint = "XChangeProperty")] - internal extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, IntPtr[] data, int nelements); + public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, IntPtr[] data, int nelements); [DllImport("libX11", EntryPoint = "XChangeProperty")] - internal extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, IntPtr atoms, int nelements); + public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, IntPtr atoms, int nelements); [DllImport("libX11", EntryPoint = "XChangeProperty", CharSet = CharSet.Ansi)] - internal extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, string text, int text_length); + public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, string text, int text_length); [DllImport("libX11", EntryPoint = "XDeleteProperty")] - internal extern static int XDeleteProperty(IntPtr display, IntPtr window, IntPtr property); + public extern static int XDeleteProperty(IntPtr display, IntPtr window, IntPtr property); // Drawing [DllImport("libX11", EntryPoint = "XCreateGC")] - internal extern static IntPtr XCreateGC(IntPtr display, IntPtr window, IntPtr valuemask, ref XGCValues values); + public extern static IntPtr XCreateGC(IntPtr display, IntPtr window, IntPtr valuemask, ref XGCValues values); [DllImport("libX11", EntryPoint = "XFreeGC")] - internal extern static int XFreeGC(IntPtr display, IntPtr gc); + public extern static int XFreeGC(IntPtr display, IntPtr gc); [DllImport("libX11", EntryPoint = "XSetFunction")] - internal extern static int XSetFunction(IntPtr display, IntPtr gc, GXFunction function); + public 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); + public 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); + public 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); + public 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); + public 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); + public extern static int XSetWindowBackground(IntPtr display, IntPtr window, IntPtr background); [DllImport("libX11", EntryPoint = "XCopyArea")] - internal extern static int XCopyArea(IntPtr display, IntPtr src, IntPtr dest, IntPtr gc, int src_x, int src_y, int width, int height, int dest_x, int dest_y); + public extern static int XCopyArea(IntPtr display, IntPtr src, IntPtr dest, IntPtr gc, int src_x, int src_y, int width, int height, int dest_x, int dest_y); [DllImport("libX11", EntryPoint = "XGetWindowProperty")] - internal extern static int XGetWindowProperty(IntPtr display, IntPtr window, IntPtr atom, IntPtr long_offset, IntPtr long_length, bool delete, IntPtr req_type, out IntPtr actual_type, out int actual_format, out IntPtr nitems, out IntPtr bytes_after, ref IntPtr prop); + public extern static int XGetWindowProperty(IntPtr display, IntPtr window, IntPtr atom, IntPtr long_offset, IntPtr long_length, bool delete, IntPtr req_type, out IntPtr actual_type, out int actual_format, out IntPtr nitems, out IntPtr bytes_after, ref IntPtr prop); [DllImport("libX11", EntryPoint = "XSetInputFocus")] - internal extern static int XSetInputFocus(IntPtr display, IntPtr window, RevertTo revert_to, IntPtr time); + public extern static int XSetInputFocus(IntPtr display, IntPtr window, RevertTo revert_to, IntPtr time); [DllImport("libX11", EntryPoint = "XIconifyWindow")] - internal extern static int XIconifyWindow(IntPtr display, IntPtr window, int screen_number); + public extern static int XIconifyWindow(IntPtr display, IntPtr window, int screen_number); [DllImport("libX11", EntryPoint = "XDefineCursor")] - internal extern static int XDefineCursor(IntPtr display, IntPtr window, IntPtr cursor); + public extern static int XDefineCursor(IntPtr display, IntPtr window, IntPtr cursor); [DllImport("libX11", EntryPoint = "XUndefineCursor")] - internal extern static int XUndefineCursor(IntPtr display, IntPtr window); + public extern static int XUndefineCursor(IntPtr display, IntPtr window); [DllImport("libX11", EntryPoint = "XFreeCursor")] - internal extern static int XFreeCursor(IntPtr display, IntPtr cursor); + public extern static int XFreeCursor(IntPtr display, IntPtr cursor); [DllImport("libX11", EntryPoint = "XCreateFontCursor")] - internal extern static IntPtr XCreateFontCursor(IntPtr display, CursorFontShape shape); + public extern static IntPtr XCreateFontCursor(IntPtr display, CursorFontShape shape); [DllImport("libX11", EntryPoint = "XCreatePixmapCursor")] - internal extern static IntPtr XCreatePixmapCursor(IntPtr display, IntPtr source, IntPtr mask, ref XColor foreground_color, ref XColor background_color, int x_hot, int y_hot); + public extern static IntPtr XCreatePixmapCursor(IntPtr display, IntPtr source, IntPtr mask, ref XColor foreground_color, ref XColor background_color, int x_hot, int y_hot); [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); + public 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); + public 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); + public extern static IntPtr XFreePixmap(IntPtr display, IntPtr pixmap); [DllImport("libX11", EntryPoint = "XQueryBestCursor")] - internal extern static int XQueryBestCursor(IntPtr display, IntPtr drawable, int width, int height, out int best_width, out int best_height); + public extern static int XQueryBestCursor(IntPtr display, IntPtr drawable, int width, int height, out int best_width, out int best_height); [DllImport("libX11", EntryPoint = "XQueryExtension")] - internal extern static int XQueryExtension(IntPtr display, string extension_name, ref int major, ref int first_event, ref int first_error); + public extern static int XQueryExtension(IntPtr display, string extension_name, ref int major, ref int first_event, ref int first_error); [DllImport("libX11", EntryPoint = "XWhitePixel")] - internal extern static IntPtr XWhitePixel(IntPtr display, int screen_no); + public extern static IntPtr XWhitePixel(IntPtr display, int screen_no); [DllImport("libX11", EntryPoint = "XBlackPixel")] - internal extern static IntPtr XBlackPixel(IntPtr display, int screen_no); + public extern static IntPtr XBlackPixel(IntPtr display, int screen_no); [DllImport("libX11", EntryPoint = "XGrabServer")] - internal extern static void XGrabServer(IntPtr display); + public extern static void XGrabServer(IntPtr display); [DllImport("libX11", EntryPoint = "XUngrabServer")] - internal extern static void XUngrabServer(IntPtr display); + public extern static void XUngrabServer(IntPtr display); [DllImport("libX11", EntryPoint = "XGetWMNormalHints")] - internal extern static void XGetWMNormalHints(IntPtr display, IntPtr window, ref XSizeHints hints, out IntPtr supplied_return); + public extern static void XGetWMNormalHints(IntPtr display, IntPtr window, ref XSizeHints hints, out IntPtr supplied_return); [DllImport("libX11", EntryPoint = "XSetWMNormalHints")] - internal extern static void XSetWMNormalHints(IntPtr display, IntPtr window, ref XSizeHints hints); + public extern static void XSetWMNormalHints(IntPtr display, IntPtr window, ref XSizeHints hints); [DllImport("libX11", EntryPoint = "XSetZoomHints")] - internal extern static void XSetZoomHints(IntPtr display, IntPtr window, ref XSizeHints hints); + public extern static void XSetZoomHints(IntPtr display, IntPtr window, ref XSizeHints hints); [DllImport("libX11", EntryPoint = "XSetWMHints")] - internal extern static void XSetWMHints(IntPtr display, IntPtr window, ref XWMHints wmhints); + public extern static void XSetWMHints(IntPtr display, IntPtr window, ref XWMHints wmhints); [DllImport("libX11", EntryPoint = "XGetIconSizes")] - internal extern static int XGetIconSizes(IntPtr display, IntPtr window, out IntPtr size_list, out int count); + public extern static int XGetIconSizes(IntPtr display, IntPtr window, out IntPtr size_list, out int count); [DllImport("libX11", EntryPoint = "XSetErrorHandler")] - internal extern static IntPtr XSetErrorHandler(XErrorHandler error_handler); + public extern static IntPtr XSetErrorHandler(XErrorHandler error_handler); [DllImport("libX11", EntryPoint = "XGetErrorText")] - internal extern static IntPtr XGetErrorText(IntPtr display, byte code, StringBuilder buffer, int length); + public extern static IntPtr XGetErrorText(IntPtr display, byte code, StringBuilder buffer, int length); [DllImport("libX11", EntryPoint = "XInitThreads")] - internal extern static int XInitThreads(); + public extern static int XInitThreads(); [DllImport("libX11", EntryPoint = "XConvertSelection")] - internal extern static int XConvertSelection(IntPtr display, IntPtr selection, IntPtr target, IntPtr property, IntPtr requestor, IntPtr time); + public extern static int XConvertSelection(IntPtr display, IntPtr selection, IntPtr target, IntPtr property, IntPtr requestor, IntPtr time); [DllImport("libX11", EntryPoint = "XGetSelectionOwner")] - internal extern static IntPtr XGetSelectionOwner(IntPtr display, IntPtr selection); + public extern static IntPtr XGetSelectionOwner(IntPtr display, IntPtr selection); [DllImport("libX11", EntryPoint = "XSetSelectionOwner")] - internal extern static int XSetSelectionOwner(IntPtr display, IntPtr selection, IntPtr owner, IntPtr time); + public extern static int XSetSelectionOwner(IntPtr display, IntPtr selection, IntPtr owner, IntPtr time); [DllImport("libX11", EntryPoint = "XSetPlaneMask")] - internal extern static int XSetPlaneMask(IntPtr display, IntPtr gc, IntPtr mask); + public extern static int XSetPlaneMask(IntPtr display, IntPtr gc, IntPtr mask); [DllImport("libX11", EntryPoint = "XSetForeground")] - internal extern static int XSetForeground(IntPtr display, IntPtr gc, UIntPtr foreground); + public extern static int XSetForeground(IntPtr display, IntPtr gc, UIntPtr foreground); [DllImport("libX11", EntryPoint = "XSetBackground")] - internal extern static int XSetBackground(IntPtr display, IntPtr gc, UIntPtr background); + public extern static int XSetBackground(IntPtr display, IntPtr gc, UIntPtr background); [DllImport("libX11", EntryPoint = "XBell")] - internal extern static int XBell(IntPtr display, int percent); + public extern static int XBell(IntPtr display, int percent); [DllImport("libX11", EntryPoint = "XChangeActivePointerGrab")] - internal extern static int XChangeActivePointerGrab(IntPtr display, EventMask event_mask, IntPtr cursor, IntPtr time); + public extern static int XChangeActivePointerGrab(IntPtr display, EventMask event_mask, IntPtr cursor, IntPtr time); [DllImport("libX11", EntryPoint = "XFilterEvent")] - internal extern static bool XFilterEvent(ref XEvent xevent, IntPtr window); + public extern static bool XFilterEvent(ref XEvent xevent, IntPtr window); [DllImport("libX11")] - internal extern static void XkbSetDetectableAutoRepeat(IntPtr display, bool detectable, IntPtr supported); + public extern static void XkbSetDetectableAutoRepeat(IntPtr display, bool detectable, IntPtr supported); [DllImport("libX11")] - internal extern static void XPeekEvent(IntPtr display, ref XEvent xevent); + public extern static void XPeekEvent(IntPtr display, ref XEvent xevent); } } diff --git a/Source/OpenTK/Platform/X11/Glx.cs b/Source/OpenTK/Platform/X11/Glx.cs index 4947d1d0..d34f2f08 100644 --- a/Source/OpenTK/Platform/X11/Glx.cs +++ b/Source/OpenTK/Platform/X11/Glx.cs @@ -265,9 +265,9 @@ namespace OpenTK.Platform.X11 #region GLX functions [DllImport(Library, EntryPoint = "glXCreateContext")] - internal static extern IntPtr CreateContext(IntPtr dpy, IntPtr vis, IntPtr shareList, bool direct); + public static extern IntPtr CreateContext(IntPtr dpy, IntPtr vis, IntPtr shareList, bool direct); - internal static IntPtr CreateContext(IntPtr dpy, VisualInfo vis, IntPtr shareList, bool direct) + public static IntPtr CreateContext(IntPtr dpy, VisualInfo vis, IntPtr shareList, bool direct) { GCHandle h0 = GCHandle.Alloc(vis, GCHandleType.Pinned); @@ -296,9 +296,9 @@ namespace OpenTK.Platform.X11 #region glXChooseVisual [DllImport(Library, EntryPoint = "glXChooseVisual")] - internal extern static IntPtr ChooseVisual(IntPtr dpy, int screen, IntPtr attriblist); + public extern static IntPtr ChooseVisual(IntPtr dpy, int screen, IntPtr attriblist); - internal static IntPtr ChooseVisual(IntPtr dpy, int screen, int[] attriblist) + public static IntPtr ChooseVisual(IntPtr dpy, int screen, int[] attriblist) { unsafe { diff --git a/Source/OpenTK/Platform/X11/Structs.cs b/Source/OpenTK/Platform/X11/Structs.cs index 77f4d4cd..d39d92b0 100644 --- a/Source/OpenTK/Platform/X11/Structs.cs +++ b/Source/OpenTK/Platform/X11/Structs.cs @@ -43,580 +43,580 @@ namespace OpenTK.Platform.X11 // [StructLayout(LayoutKind.Sequential)] - internal struct XAnyEvent + public struct XAnyEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr window; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr window; } [StructLayout(LayoutKind.Sequential)] - internal struct XKeyEvent + public struct XKeyEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr window; - internal IntPtr root; - internal IntPtr subwindow; - internal IntPtr time; - internal int x; - internal int y; - internal int x_root; - internal int y_root; - internal int state; - internal int keycode; - internal bool same_screen; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr window; + public IntPtr root; + public IntPtr subwindow; + public IntPtr time; + public int x; + public int y; + public int x_root; + public int y_root; + public int state; + public int keycode; + public bool same_screen; } [StructLayout(LayoutKind.Sequential)] - internal struct XButtonEvent + public struct XButtonEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr window; - internal IntPtr root; - internal IntPtr subwindow; - internal IntPtr time; - internal int x; - internal int y; - internal int x_root; - internal int y_root; - internal int state; - internal int button; - internal bool same_screen; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr window; + public IntPtr root; + public IntPtr subwindow; + public IntPtr time; + public int x; + public int y; + public int x_root; + public int y_root; + public int state; + public int button; + public bool same_screen; } [StructLayout(LayoutKind.Sequential)] - internal struct XMotionEvent + public struct XMotionEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr window; - internal IntPtr root; - internal IntPtr subwindow; - internal IntPtr time; - internal int x; - internal int y; - internal int x_root; - internal int y_root; - internal int state; - internal byte is_hint; - internal bool same_screen; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr window; + public IntPtr root; + public IntPtr subwindow; + public IntPtr time; + public int x; + public int y; + public int x_root; + public int y_root; + public int state; + public byte is_hint; + public bool same_screen; } [StructLayout(LayoutKind.Sequential)] - internal struct XCrossingEvent + public struct XCrossingEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr window; - internal IntPtr root; - internal IntPtr subwindow; - internal IntPtr time; - internal int x; - internal int y; - internal int x_root; - internal int y_root; - internal NotifyMode mode; - internal NotifyDetail detail; - internal bool same_screen; - internal bool focus; - internal int state; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr window; + public IntPtr root; + public IntPtr subwindow; + public IntPtr time; + public int x; + public int y; + public int x_root; + public int y_root; + public NotifyMode mode; + public NotifyDetail detail; + public bool same_screen; + public bool focus; + public int state; } [StructLayout(LayoutKind.Sequential)] - internal struct XFocusChangeEvent + public struct XFocusChangeEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr window; - internal int mode; - internal NotifyDetail detail; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr window; + public int mode; + public NotifyDetail detail; } [StructLayout(LayoutKind.Sequential)] - internal struct XKeymapEvent + public struct XKeymapEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr window; - internal byte key_vector0; - internal byte key_vector1; - internal byte key_vector2; - internal byte key_vector3; - internal byte key_vector4; - internal byte key_vector5; - internal byte key_vector6; - internal byte key_vector7; - internal byte key_vector8; - internal byte key_vector9; - internal byte key_vector10; - internal byte key_vector11; - internal byte key_vector12; - internal byte key_vector13; - internal byte key_vector14; - internal byte key_vector15; - internal byte key_vector16; - internal byte key_vector17; - internal byte key_vector18; - internal byte key_vector19; - internal byte key_vector20; - internal byte key_vector21; - internal byte key_vector22; - internal byte key_vector23; - internal byte key_vector24; - internal byte key_vector25; - internal byte key_vector26; - internal byte key_vector27; - internal byte key_vector28; - internal byte key_vector29; - internal byte key_vector30; - internal byte key_vector31; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr window; + public byte key_vector0; + public byte key_vector1; + public byte key_vector2; + public byte key_vector3; + public byte key_vector4; + public byte key_vector5; + public byte key_vector6; + public byte key_vector7; + public byte key_vector8; + public byte key_vector9; + public byte key_vector10; + public byte key_vector11; + public byte key_vector12; + public byte key_vector13; + public byte key_vector14; + public byte key_vector15; + public byte key_vector16; + public byte key_vector17; + public byte key_vector18; + public byte key_vector19; + public byte key_vector20; + public byte key_vector21; + public byte key_vector22; + public byte key_vector23; + public byte key_vector24; + public byte key_vector25; + public byte key_vector26; + public byte key_vector27; + public byte key_vector28; + public byte key_vector29; + public byte key_vector30; + public byte key_vector31; } [StructLayout(LayoutKind.Sequential)] - internal struct XExposeEvent + public struct XExposeEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr window; - internal int x; - internal int y; - internal int width; - internal int height; - internal int count; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr window; + public int x; + public int y; + public int width; + public int height; + public int count; } [StructLayout(LayoutKind.Sequential)] - internal struct XGraphicsExposeEvent + public struct XGraphicsExposeEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr drawable; - internal int x; - internal int y; - internal int width; - internal int height; - internal int count; - internal int major_code; - internal int minor_code; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr drawable; + public int x; + public int y; + public int width; + public int height; + public int count; + public int major_code; + public int minor_code; } [StructLayout(LayoutKind.Sequential)] - internal struct XNoExposeEvent + public struct XNoExposeEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr drawable; - internal int major_code; - internal int minor_code; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr drawable; + public int major_code; + public int minor_code; } [StructLayout(LayoutKind.Sequential)] - internal struct XVisibilityEvent + public struct XVisibilityEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr window; - internal int state; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr window; + public int state; } [StructLayout(LayoutKind.Sequential)] - internal struct XCreateWindowEvent + public struct XCreateWindowEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr parent; - internal IntPtr window; - internal int x; - internal int y; - internal int width; - internal int height; - internal int border_width; - internal bool override_redirect; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr parent; + public IntPtr window; + public int x; + public int y; + public int width; + public int height; + public int border_width; + public bool override_redirect; } [StructLayout(LayoutKind.Sequential)] - internal struct XDestroyWindowEvent + public struct XDestroyWindowEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr xevent; - internal IntPtr window; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr xevent; + public IntPtr window; } [StructLayout(LayoutKind.Sequential)] - internal struct XUnmapEvent + public struct XUnmapEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr xevent; - internal IntPtr window; - internal bool from_configure; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr xevent; + public IntPtr window; + public bool from_configure; } [StructLayout(LayoutKind.Sequential)] - internal struct XMapEvent + public struct XMapEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr xevent; - internal IntPtr window; - internal bool override_redirect; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr xevent; + public IntPtr window; + public bool override_redirect; } [StructLayout(LayoutKind.Sequential)] - internal struct XMapRequestEvent + public struct XMapRequestEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr parent; - internal IntPtr window; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr parent; + public IntPtr window; } [StructLayout(LayoutKind.Sequential)] - internal struct XReparentEvent + public struct XReparentEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr xevent; - internal IntPtr window; - internal IntPtr parent; - internal int x; - internal int y; - internal bool override_redirect; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr xevent; + public IntPtr window; + public IntPtr parent; + public int x; + public int y; + public bool override_redirect; } [StructLayout(LayoutKind.Sequential)] - internal struct XConfigureEvent + public struct XConfigureEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr xevent; - internal IntPtr window; - internal int x; - internal int y; - internal int width; - internal int height; - internal int border_width; - internal IntPtr above; - internal bool override_redirect; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr xevent; + public IntPtr window; + public int x; + public int y; + public int width; + public int height; + public int border_width; + public IntPtr above; + public bool override_redirect; } [StructLayout(LayoutKind.Sequential)] - internal struct XGravityEvent + public struct XGravityEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr xevent; - internal IntPtr window; - internal int x; - internal int y; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr xevent; + public IntPtr window; + public int x; + public int y; } [StructLayout(LayoutKind.Sequential)] - internal struct XResizeRequestEvent + public struct XResizeRequestEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr window; - internal int width; - internal int height; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr window; + public int width; + public int height; } [StructLayout(LayoutKind.Sequential)] - internal struct XConfigureRequestEvent + public struct XConfigureRequestEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr parent; - internal IntPtr window; - internal int x; - internal int y; - internal int width; - internal int height; - internal int border_width; - internal IntPtr above; - internal int detail; - internal IntPtr value_mask; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr parent; + public IntPtr window; + public int x; + public int y; + public int width; + public int height; + public int border_width; + public IntPtr above; + public int detail; + public IntPtr value_mask; } [StructLayout(LayoutKind.Sequential)] - internal struct XCirculateEvent + public struct XCirculateEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr xevent; - internal IntPtr window; - internal int place; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr xevent; + public IntPtr window; + public int place; } [StructLayout(LayoutKind.Sequential)] - internal struct XCirculateRequestEvent + public struct XCirculateRequestEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr parent; - internal IntPtr window; - internal int place; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr parent; + public IntPtr window; + public int place; } [StructLayout(LayoutKind.Sequential)] - internal struct XPropertyEvent + public struct XPropertyEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr window; - internal IntPtr atom; - internal IntPtr time; - internal int state; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr window; + public IntPtr atom; + public IntPtr time; + public int state; } [StructLayout(LayoutKind.Sequential)] - internal struct XSelectionClearEvent + public struct XSelectionClearEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr window; - internal IntPtr selection; - internal IntPtr time; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr window; + public IntPtr selection; + public IntPtr time; } [StructLayout(LayoutKind.Sequential)] - internal struct XSelectionRequestEvent + public struct XSelectionRequestEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr owner; - internal IntPtr requestor; - internal IntPtr selection; - internal IntPtr target; - internal IntPtr property; - internal IntPtr time; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr owner; + public IntPtr requestor; + public IntPtr selection; + public IntPtr target; + public IntPtr property; + public IntPtr time; } [StructLayout(LayoutKind.Sequential)] - internal struct XSelectionEvent + public struct XSelectionEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr requestor; - internal IntPtr selection; - internal IntPtr target; - internal IntPtr property; - internal IntPtr time; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr requestor; + public IntPtr selection; + public IntPtr target; + public IntPtr property; + public IntPtr time; } [StructLayout(LayoutKind.Sequential)] - internal struct XColormapEvent + public struct XColormapEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr window; - internal IntPtr colormap; - internal bool c_new; - internal int state; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr window; + public IntPtr colormap; + public bool c_new; + public int state; } [StructLayout(LayoutKind.Sequential)] - internal struct XClientMessageEvent + public struct XClientMessageEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr window; - internal IntPtr message_type; - internal int format; - internal IntPtr ptr1; - internal IntPtr ptr2; - internal IntPtr ptr3; - internal IntPtr ptr4; - internal IntPtr ptr5; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr window; + public IntPtr message_type; + public int format; + public IntPtr ptr1; + public IntPtr ptr2; + public IntPtr ptr3; + public IntPtr ptr4; + public IntPtr ptr5; } [StructLayout(LayoutKind.Sequential)] - internal struct XMappingEvent + public struct XMappingEvent { - internal XEventName type; - internal IntPtr serial; - internal bool send_event; - internal IntPtr display; - internal IntPtr window; - internal int request; - internal int first_keycode; - internal int count; + public XEventName type; + public IntPtr serial; + public bool send_event; + public IntPtr display; + public IntPtr window; + public int request; + public int first_keycode; + public int count; } [StructLayout(LayoutKind.Sequential)] - internal struct XErrorEvent + public struct XErrorEvent { - internal XEventName type; - internal IntPtr display; - internal IntPtr resourceid; - internal IntPtr serial; - internal byte error_code; - internal XRequest request_code; - internal byte minor_code; + public XEventName type; + public IntPtr display; + public IntPtr resourceid; + public IntPtr serial; + public byte error_code; + public XRequest request_code; + public byte minor_code; } [StructLayout(LayoutKind.Sequential)] - internal struct XEventPad + public struct XEventPad { - internal IntPtr pad0; - internal IntPtr pad1; - internal IntPtr pad2; - internal IntPtr pad3; - internal IntPtr pad4; - internal IntPtr pad5; - internal IntPtr pad6; - internal IntPtr pad7; - internal IntPtr pad8; - internal IntPtr pad9; - internal IntPtr pad10; - internal IntPtr pad11; - internal IntPtr pad12; - internal IntPtr pad13; - internal IntPtr pad14; - internal IntPtr pad15; - internal IntPtr pad16; - internal IntPtr pad17; - internal IntPtr pad18; - internal IntPtr pad19; - internal IntPtr pad20; - internal IntPtr pad21; - internal IntPtr pad22; - internal IntPtr pad23; + public IntPtr pad0; + public IntPtr pad1; + public IntPtr pad2; + public IntPtr pad3; + public IntPtr pad4; + public IntPtr pad5; + public IntPtr pad6; + public IntPtr pad7; + public IntPtr pad8; + public IntPtr pad9; + public IntPtr pad10; + public IntPtr pad11; + public IntPtr pad12; + public IntPtr pad13; + public IntPtr pad14; + public IntPtr pad15; + public IntPtr pad16; + public IntPtr pad17; + public IntPtr pad18; + public IntPtr pad19; + public IntPtr pad20; + public IntPtr pad21; + public IntPtr pad22; + public IntPtr pad23; } [StructLayout(LayoutKind.Explicit)] - internal struct XEvent + public struct XEvent { [FieldOffset(0)] - internal XEventName type; + public XEventName type; [FieldOffset(0)] - internal XAnyEvent AnyEvent; + public XAnyEvent AnyEvent; [FieldOffset(0)] - internal XKeyEvent KeyEvent; + public XKeyEvent KeyEvent; [FieldOffset(0)] - internal XButtonEvent ButtonEvent; + public XButtonEvent ButtonEvent; [FieldOffset(0)] - internal XMotionEvent MotionEvent; + public XMotionEvent MotionEvent; [FieldOffset(0)] - internal XCrossingEvent CrossingEvent; + public XCrossingEvent CrossingEvent; [FieldOffset(0)] - internal XFocusChangeEvent FocusChangeEvent; + public XFocusChangeEvent FocusChangeEvent; [FieldOffset(0)] - internal XExposeEvent ExposeEvent; + public XExposeEvent ExposeEvent; [FieldOffset(0)] - internal XGraphicsExposeEvent GraphicsExposeEvent; + public XGraphicsExposeEvent GraphicsExposeEvent; [FieldOffset(0)] - internal XNoExposeEvent NoExposeEvent; + public XNoExposeEvent NoExposeEvent; [FieldOffset(0)] - internal XVisibilityEvent VisibilityEvent; + public XVisibilityEvent VisibilityEvent; [FieldOffset(0)] - internal XCreateWindowEvent CreateWindowEvent; + public XCreateWindowEvent CreateWindowEvent; [FieldOffset(0)] - internal XDestroyWindowEvent DestroyWindowEvent; + public XDestroyWindowEvent DestroyWindowEvent; [FieldOffset(0)] - internal XUnmapEvent UnmapEvent; + public XUnmapEvent UnmapEvent; [FieldOffset(0)] - internal XMapEvent MapEvent; + public XMapEvent MapEvent; [FieldOffset(0)] - internal XMapRequestEvent MapRequestEvent; + public XMapRequestEvent MapRequestEvent; [FieldOffset(0)] - internal XReparentEvent ReparentEvent; + public XReparentEvent ReparentEvent; [FieldOffset(0)] - internal XConfigureEvent ConfigureEvent; + public XConfigureEvent ConfigureEvent; [FieldOffset(0)] - internal XGravityEvent GravityEvent; + public XGravityEvent GravityEvent; [FieldOffset(0)] - internal XResizeRequestEvent ResizeRequestEvent; + public XResizeRequestEvent ResizeRequestEvent; [FieldOffset(0)] - internal XConfigureRequestEvent ConfigureRequestEvent; + public XConfigureRequestEvent ConfigureRequestEvent; [FieldOffset(0)] - internal XCirculateEvent CirculateEvent; + public XCirculateEvent CirculateEvent; [FieldOffset(0)] - internal XCirculateRequestEvent CirculateRequestEvent; + public XCirculateRequestEvent CirculateRequestEvent; [FieldOffset(0)] - internal XPropertyEvent PropertyEvent; + public XPropertyEvent PropertyEvent; [FieldOffset(0)] - internal XSelectionClearEvent SelectionClearEvent; + public XSelectionClearEvent SelectionClearEvent; [FieldOffset(0)] - internal XSelectionRequestEvent SelectionRequestEvent; + public XSelectionRequestEvent SelectionRequestEvent; [FieldOffset(0)] - internal XSelectionEvent SelectionEvent; + public XSelectionEvent SelectionEvent; [FieldOffset(0)] - internal XColormapEvent ColormapEvent; + public XColormapEvent ColormapEvent; [FieldOffset(0)] - internal XClientMessageEvent ClientMessageEvent; + public XClientMessageEvent ClientMessageEvent; [FieldOffset(0)] - internal XMappingEvent MappingEvent; + public XMappingEvent MappingEvent; [FieldOffset(0)] - internal XErrorEvent ErrorEvent; + public XErrorEvent ErrorEvent; [FieldOffset(0)] - internal XKeymapEvent KeymapEvent; + public XKeymapEvent KeymapEvent; //[MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=24)] - //[ FieldOffset(0) ] internal int[] pad; + //[ FieldOffset(0) ] public int[] pad; [FieldOffset(0)] - internal XEventPad Pad; + public XEventPad Pad; public override string ToString() { switch (type) @@ -651,51 +651,51 @@ namespace OpenTK.Platform.X11 } [StructLayout(LayoutKind.Sequential)] - internal struct XSetWindowAttributes + public struct XSetWindowAttributes { - internal IntPtr background_pixmap; - internal IntPtr background_pixel; - internal IntPtr border_pixmap; - internal IntPtr border_pixel; - internal Gravity bit_gravity; - internal Gravity win_gravity; - internal int backing_store; - internal IntPtr backing_planes; - internal IntPtr backing_pixel; - internal bool save_under; - internal IntPtr event_mask; - internal IntPtr do_not_propagate_mask; - internal bool override_redirect; - internal IntPtr colormap; - internal IntPtr cursor; + public IntPtr background_pixmap; + public IntPtr background_pixel; + public IntPtr border_pixmap; + public IntPtr border_pixel; + public Gravity bit_gravity; + public Gravity win_gravity; + public int backing_store; + public IntPtr backing_planes; + public IntPtr backing_pixel; + public bool save_under; + public IntPtr event_mask; + public IntPtr do_not_propagate_mask; + public bool override_redirect; + public IntPtr colormap; + public IntPtr cursor; } [StructLayout(LayoutKind.Sequential)] - internal struct XWindowAttributes + public struct XWindowAttributes { - internal int x; - internal int y; - internal int width; - internal int height; - internal int border_width; - internal int depth; - internal IntPtr visual; - internal IntPtr root; - internal int c_class; - internal Gravity bit_gravity; - internal Gravity win_gravity; - internal int backing_store; - internal IntPtr backing_planes; - internal IntPtr backing_pixel; - internal bool save_under; - internal IntPtr colormap; - internal bool map_installed; - internal MapState map_state; - internal IntPtr all_event_masks; - internal IntPtr your_event_mask; - internal IntPtr do_not_propagate_mask; - internal bool override_direct; - internal IntPtr screen; + public int x; + public int y; + public int width; + public int height; + public int border_width; + public int depth; + public IntPtr visual; + public IntPtr root; + public int c_class; + public Gravity bit_gravity; + public Gravity win_gravity; + public int backing_store; + public IntPtr backing_planes; + public IntPtr backing_pixel; + public bool save_under; + public IntPtr colormap; + public bool map_installed; + public MapState map_state; + public IntPtr all_event_masks; + public IntPtr your_event_mask; + public IntPtr do_not_propagate_mask; + public bool override_direct; + public IntPtr screen; public override string ToString() { @@ -704,21 +704,21 @@ namespace OpenTK.Platform.X11 } [StructLayout(LayoutKind.Sequential)] - internal struct XTextProperty + public struct XTextProperty { - internal string value; - internal IntPtr encoding; - internal int format; - internal IntPtr nitems; + public string value; + public IntPtr encoding; + public int format; + public IntPtr nitems; } - internal enum XWindowClass + public enum XWindowClass { InputOutput = 1, InputOnly = 2 } - internal enum XEventName + public enum XEventName { KeyPress = 2, KeyRelease = 3, @@ -758,7 +758,7 @@ namespace OpenTK.Platform.X11 } [Flags] - internal enum SetWindowValuemask + public enum SetWindowValuemask { Nothing = 0, BackPixmap = 1, @@ -778,7 +778,7 @@ namespace OpenTK.Platform.X11 Cursor = 16384 } - internal enum CreateWindowArgs + public enum CreateWindowArgs { CopyFromParent = 0, ParentRelative = 1, @@ -786,7 +786,7 @@ namespace OpenTK.Platform.X11 InputOnly = 2 } - internal enum Gravity + public enum Gravity { ForgetGravity = 0, NorthWestGravity = 1, @@ -801,7 +801,7 @@ namespace OpenTK.Platform.X11 StaticGravity = 10 } - internal enum XKeySym : uint + public enum XKeySym : uint { XK_BackSpace = 0xFF08, XK_Tab = 0xFF09, @@ -834,7 +834,7 @@ namespace OpenTK.Platform.X11 } [Flags] - internal enum EventMask + public enum EventMask { NoEventMask = 0, KeyPressMask = 1 << 0, @@ -864,39 +864,39 @@ namespace OpenTK.Platform.X11 OwnerGrabButtonMask = 1 << 24 } - internal enum GrabMode + public enum GrabMode { GrabModeSync = 0, GrabModeAsync = 1 } [StructLayout(LayoutKind.Sequential)] - internal struct XStandardColormap + public struct XStandardColormap { - internal IntPtr colormap; - internal IntPtr red_max; - internal IntPtr red_mult; - internal IntPtr green_max; - internal IntPtr green_mult; - internal IntPtr blue_max; - internal IntPtr blue_mult; - internal IntPtr base_pixel; - internal IntPtr visualid; - internal IntPtr killid; + public IntPtr colormap; + public IntPtr red_max; + public IntPtr red_mult; + public IntPtr green_max; + public IntPtr green_mult; + public IntPtr blue_max; + public IntPtr blue_mult; + public IntPtr base_pixel; + public IntPtr visualid; + public IntPtr killid; } [StructLayout(LayoutKind.Sequential, Pack = 2)] - internal struct XColor + public struct XColor { - internal IntPtr pixel; - internal ushort red; - internal ushort green; - internal ushort blue; - internal byte flags; - internal byte pad; + public IntPtr pixel; + public ushort red; + public ushort green; + public ushort blue; + public byte flags; + public byte pad; } - internal enum Atom + public enum Atom { AnyPropertyType = 0, XA_PRIMARY = 1, @@ -972,32 +972,32 @@ namespace OpenTK.Platform.X11 } [StructLayout(LayoutKind.Sequential)] - internal struct XScreen + public struct XScreen { - internal IntPtr ext_data; - internal IntPtr display; - internal IntPtr root; - internal int width; - internal int height; - internal int mwidth; - internal int mheight; - internal int ndepths; - internal IntPtr depths; - internal int root_depth; - internal IntPtr root_visual; - internal IntPtr default_gc; - internal IntPtr cmap; - internal IntPtr white_pixel; - internal IntPtr black_pixel; - internal int max_maps; - internal int min_maps; - internal int backing_store; - internal bool save_unders; - internal IntPtr root_input_mask; + public IntPtr ext_data; + public IntPtr display; + public IntPtr root; + public int width; + public int height; + public int mwidth; + public int mheight; + public int ndepths; + public IntPtr depths; + public int root_depth; + public IntPtr root_visual; + public IntPtr default_gc; + public IntPtr cmap; + public IntPtr white_pixel; + public IntPtr black_pixel; + public int max_maps; + public int min_maps; + public int backing_store; + public bool save_unders; + public IntPtr root_input_mask; } [Flags] - internal enum ChangeWindowFlags + public enum ChangeWindowFlags { CWX = 1 << 0, CWY = 1 << 1, @@ -1008,7 +1008,7 @@ namespace OpenTK.Platform.X11 CWStackMode = 1 << 6 } - internal enum StackMode + public enum StackMode { Above = 0, Below = 1, @@ -1018,33 +1018,33 @@ namespace OpenTK.Platform.X11 } [StructLayout(LayoutKind.Sequential)] - internal struct XWindowChanges + public struct XWindowChanges { - internal int x; - internal int y; - internal int width; - internal int height; - internal int border_width; - internal IntPtr sibling; - internal StackMode stack_mode; + public int x; + public int y; + public int width; + public int height; + public int border_width; + public IntPtr sibling; + public StackMode stack_mode; } [Flags] - internal enum ColorFlags + public enum ColorFlags { DoRed = 1 << 0, DoGreen = 1 << 1, DoBlue = 1 << 2 } - internal enum NotifyMode + public enum NotifyMode { NotifyNormal = 0, NotifyGrab = 1, NotifyUngrab = 2 } - internal enum NotifyDetail + public enum NotifyDetail { NotifyAncestor = 0, NotifyVirtual = 1, @@ -1057,13 +1057,13 @@ namespace OpenTK.Platform.X11 } [StructLayout(LayoutKind.Sequential)] - internal struct MotifWmHints + public struct MotifWmHints { - internal IntPtr flags; - internal IntPtr functions; - internal IntPtr decorations; - internal IntPtr input_mode; - internal IntPtr status; + public IntPtr flags; + public IntPtr functions; + public IntPtr decorations; + public IntPtr input_mode; + public IntPtr status; public override string ToString() { @@ -1072,7 +1072,7 @@ namespace OpenTK.Platform.X11 } [Flags] - internal enum MotifFlags + public enum MotifFlags { Functions = 1, Decorations = 2, @@ -1081,7 +1081,7 @@ namespace OpenTK.Platform.X11 } [Flags] - internal enum MotifFunctions + public enum MotifFunctions { All = 0x01, Resize = 0x02, @@ -1092,7 +1092,7 @@ namespace OpenTK.Platform.X11 } [Flags] - internal enum MotifDecorations + public enum MotifDecorations { All = 0x01, Border = 0x02, @@ -1105,7 +1105,7 @@ namespace OpenTK.Platform.X11 } [Flags] - internal enum MotifInputMode + public enum MotifInputMode { Modeless = 0, ApplicationModal = 1, @@ -1114,7 +1114,7 @@ namespace OpenTK.Platform.X11 } [Flags] - internal enum KeyMasks + public enum KeyMasks { ShiftMask = (1 << 0), LockMask = (1 << 1), @@ -1129,13 +1129,13 @@ namespace OpenTK.Platform.X11 } [StructLayout(LayoutKind.Sequential)] - internal struct XModifierKeymap + public struct XModifierKeymap { public int max_keypermod; public IntPtr modifiermap; } - internal enum PropertyMode + public enum PropertyMode { Replace = 0, Prepend = 1, @@ -1143,7 +1143,7 @@ namespace OpenTK.Platform.X11 } [StructLayout(LayoutKind.Sequential)] - internal struct XKeyBoardState + public struct XKeyBoardState { public int key_click_percent; public int bell_percent; @@ -1164,7 +1164,7 @@ namespace OpenTK.Platform.X11 } [Flags] - internal enum GCFunction + public enum GCFunction { GCFunction = 1 << 0, GCPlaneMask = 1 << 1, @@ -1191,21 +1191,21 @@ namespace OpenTK.Platform.X11 GCArcMode = 1 << 22 } - internal enum GCJoinStyle + public enum GCJoinStyle { JoinMiter = 0, JoinRound = 1, JoinBevel = 2 } - internal enum GCLineStyle + public enum GCLineStyle { LineSolid = 0, LineOnOffDash = 1, LineDoubleDash = 2 } - internal enum GCCapStyle + public enum GCCapStyle { CapNotLast = 0, CapButt = 1, @@ -1213,7 +1213,7 @@ namespace OpenTK.Platform.X11 CapProjecting = 3 } - internal enum GCFillStyle + public enum GCFillStyle { FillSolid = 0, FillTiled = 1, @@ -1221,53 +1221,53 @@ namespace OpenTK.Platform.X11 FillOpaqueStppled = 3 } - internal enum GCFillRule + public enum GCFillRule { EvenOddRule = 0, WindingRule = 1 } - internal enum GCArcMode + public enum GCArcMode { ArcChord = 0, ArcPieSlice = 1 } - internal enum GCSubwindowMode + public enum GCSubwindowMode { ClipByChildren = 0, IncludeInferiors = 1 } [StructLayout(LayoutKind.Sequential)] - internal struct XGCValues + public struct XGCValues { - internal GXFunction function; - internal IntPtr plane_mask; - internal IntPtr foreground; - internal IntPtr background; - internal int line_width; - internal GCLineStyle line_style; - internal GCCapStyle cap_style; - internal GCJoinStyle join_style; - internal GCFillStyle fill_style; - internal GCFillRule fill_rule; - internal GCArcMode arc_mode; - internal IntPtr tile; - internal IntPtr stipple; - internal int ts_x_origin; - internal int ts_y_origin; - internal IntPtr font; - internal GCSubwindowMode subwindow_mode; - internal bool graphics_exposures; - internal int clip_x_origin; - internal int clib_y_origin; - internal IntPtr clip_mask; - internal int dash_offset; - internal byte dashes; + public GXFunction function; + public IntPtr plane_mask; + public IntPtr foreground; + public IntPtr background; + public int line_width; + public GCLineStyle line_style; + public GCCapStyle cap_style; + public GCJoinStyle join_style; + public GCFillStyle fill_style; + public GCFillRule fill_rule; + public GCArcMode arc_mode; + public IntPtr tile; + public IntPtr stipple; + public int ts_x_origin; + public int ts_y_origin; + public IntPtr font; + public GCSubwindowMode subwindow_mode; + public bool graphics_exposures; + public int clip_x_origin; + public int clib_y_origin; + public IntPtr clip_mask; + public int dash_offset; + public byte dashes; } - internal enum GXFunction + public enum GXFunction { GXclear = 0x0, /* 0 */ GXand = 0x1, /* src AND dst */ @@ -1287,28 +1287,28 @@ namespace OpenTK.Platform.X11 GXset = 0xf /* 1 */ } - internal enum NetWindowManagerState + public enum NetWindowManagerState { Remove = 0, Add = 1, Toggle = 2 } - internal enum RevertTo + public enum RevertTo { None = 0, PointerRoot = 1, Parent = 2 } - internal enum MapState + public enum MapState { IsUnmapped = 0, IsUnviewable = 1, IsViewable = 2 } - internal enum CursorFontShape + public enum CursorFontShape { XC_X_cursor = 0, XC_arrow = 2, @@ -1396,7 +1396,7 @@ namespace OpenTK.Platform.X11 XC_num_glyphs = 154 } - internal enum SystrayRequest + public enum SystrayRequest { SYSTEM_TRAY_REQUEST_DOCK = 0, SYSTEM_TRAY_BEGIN_MESSAGE = 1, @@ -1404,7 +1404,7 @@ namespace OpenTK.Platform.X11 } [Flags] - internal enum XSizeHintsFlags + public enum XSizeHintsFlags { USPosition = (1 << 0), USSize = (1 << 1), @@ -1420,30 +1420,30 @@ namespace OpenTK.Platform.X11 } [StructLayout(LayoutKind.Sequential)] - internal struct XSizeHints + public struct XSizeHints { - internal IntPtr flags; - internal int x; - internal int y; - internal int width; - internal int height; - internal int min_width; - internal int min_height; - internal int max_width; - internal int max_height; - internal int width_inc; - internal int height_inc; - internal int min_aspect_x; - internal int min_aspect_y; - internal int max_aspect_x; - internal int max_aspect_y; - internal int base_width; - internal int base_height; - internal int win_gravity; + public IntPtr flags; + public int x; + public int y; + public int width; + public int height; + public int min_width; + public int min_height; + public int max_width; + public int max_height; + public int width_inc; + public int height_inc; + public int min_aspect_x; + public int min_aspect_y; + public int max_aspect_x; + public int max_aspect_y; + public int base_width; + public int base_height; + public int win_gravity; } [Flags] - internal enum XWMHintsFlags + public enum XWMHintsFlags { InputHint = (1 << 0), StateHint = (1 << 1), @@ -1455,7 +1455,7 @@ namespace OpenTK.Platform.X11 AllHints = (InputHint | StateHint | IconPixmapHint | IconWindowHint | IconPositionHint | IconMaskHint | WindowGroupHint) } - internal enum XInitialState + public enum XInitialState { DontCareState = 0, NormalState = 1, @@ -1465,33 +1465,33 @@ namespace OpenTK.Platform.X11 } [StructLayout(LayoutKind.Sequential)] - internal struct XWMHints + public struct XWMHints { - internal IntPtr flags; - internal bool input; - internal XInitialState initial_state; - internal IntPtr icon_pixmap; - internal IntPtr icon_window; - internal int icon_x; - internal int icon_y; - internal IntPtr icon_mask; - internal IntPtr window_group; + public IntPtr flags; + public bool input; + public XInitialState initial_state; + public IntPtr icon_pixmap; + public IntPtr icon_window; + public int icon_x; + public int icon_y; + public IntPtr icon_mask; + public IntPtr window_group; } [StructLayout(LayoutKind.Sequential)] - internal struct XIconSize + public struct XIconSize { - internal int min_width; - internal int min_height; - internal int max_width; - internal int max_height; - internal int width_inc; - internal int height_inc; + public int min_width; + public int min_height; + public int max_width; + public int max_height; + public int width_inc; + public int height_inc; } - internal delegate int XErrorHandler(IntPtr DisplayHandle, ref XErrorEvent error_event); + public delegate int XErrorHandler(IntPtr DisplayHandle, ref XErrorEvent error_event); - internal enum XRequest : byte + public enum XRequest : byte { X_CreateWindow = 1, X_ChangeWindowAttributes = 2, @@ -1616,7 +1616,7 @@ namespace OpenTK.Platform.X11 } [Flags] - internal enum XIMProperties + public enum XIMProperties { XIMPreeditArea = 0x0001, XIMPreeditCallbacks = 0x0002, @@ -1630,14 +1630,14 @@ namespace OpenTK.Platform.X11 } [Flags] - internal enum WindowType + public enum WindowType { Client = 1, Whole = 2, Both = 3 } - internal enum XEmbedMessage + public enum XEmbedMessage { EmbeddedNotify = 0, WindowActivate = 1, diff --git a/Source/OpenTK/Platform/X11/WindowInfo.cs b/Source/OpenTK/Platform/X11/WindowInfo.cs index c396c1bc..ae161f78 100644 --- a/Source/OpenTK/Platform/X11/WindowInfo.cs +++ b/Source/OpenTK/Platform/X11/WindowInfo.cs @@ -14,14 +14,14 @@ namespace OpenTK.Platform.X11 /// Describes an X11 window. /// This class supports OpenTK, and is not intended for use by OpenTK programs. /// - internal class WindowInfo : IWindowInfo + public class WindowInfo : IWindowInfo { - internal WindowInfo() + public WindowInfo() { visinfo = new VisualInfo(); } - - internal WindowInfo(WindowInfo parent) + + public WindowInfo(WindowInfo parent) { this.Handle = parent.Handle; this.TopLevelWindow = parent.TopLevelWindow; @@ -37,14 +37,14 @@ namespace OpenTK.Platform.X11 private WindowInfo parent; private VisualInfo visinfo; - internal IntPtr RootWindow { get { return rootWindow; } set { rootWindow = value; } } - internal IntPtr TopLevelWindow { get { return topLevelWindow; } set { topLevelWindow = value; } } - internal IntPtr Display { get { return display; } set { display = value; } } - internal int Screen { get { return screen; } set { screen = value; } } - internal VisualInfo VisualInfo { get { return visinfo; } set { visinfo = value; } } + public IntPtr RootWindow { get { return rootWindow; } set { rootWindow = value; } } + public IntPtr TopLevelWindow { get { return topLevelWindow; } set { topLevelWindow = value; } } + public IntPtr Display { get { return display; } set { display = value; } } + public int Screen { get { return screen; } set { screen = value; } } + public VisualInfo VisualInfo { get { return visinfo; } set { visinfo = value; } } - public IntPtr Handle { get { return handle; } internal set { handle = value; } } - public IWindowInfo Parent { get { return parent; } internal set { parent = value as WindowInfo; } } + public IntPtr Handle { get { return handle; } set { handle = value; } } + public IWindowInfo Parent { get { return parent; } set { parent = value as WindowInfo; } } public override string ToString() { diff --git a/Source/OpenTK/Platform/X11/X11GLContext.cs b/Source/OpenTK/Platform/X11/X11GLContext.cs index 9b509f34..6dd92eb9 100644 --- a/Source/OpenTK/Platform/X11/X11GLContext.cs +++ b/Source/OpenTK/Platform/X11/X11GLContext.cs @@ -76,20 +76,6 @@ namespace OpenTK.Platform.X11 Debug.Print("Preparing visual for DisplayMode: {0}", mode.ToString()); - /* -int[] attrib = - { - (int)Glx.Enums.GLXAttribute.RGBA, - (int)Glx.Enums.GLXAttribute.RED_SIZE, 1, - (int)Glx.Enums.GLXAttribute.GREEN_SIZE, 1, - (int)Glx.Enums.GLXAttribute.BLUE_SIZE, 1, - (int)Glx.Enums.GLXAttribute.DEPTH_SIZE, 1, - (int)Glx.Enums.GLXAttribute.DOUBLEBUFFER, - 0 - }; -visual = Glx.ChooseVisual(windowInfo.Display, windowInfo.Screen, attrib); -*/ - List visualAttributes = new List(); visualAttributes.Add((int)Glx.Enums.GLXAttribute.RGBA); visualAttributes.Add((int)Glx.Enums.GLXAttribute.RED_SIZE); @@ -98,8 +84,8 @@ visual = Glx.ChooseVisual(windowInfo.Display, windowInfo.Screen, attrib); visualAttributes.Add((int)mode.Color.Green); visualAttributes.Add((int)Glx.Enums.GLXAttribute.BLUE_SIZE); visualAttributes.Add((int)mode.Color.Blue); - visualAttributes.Add((int)Glx.Enums.GLXAttribute.ALPHA_SIZE); - visualAttributes.Add((int)mode.Color.Alpha); + //visualAttributes.Add((int)Glx.Enums.GLXAttribute.ALPHA_SIZE); + //visualAttributes.Add((int)mode.Color.Alpha); visualAttributes.Add((int)Glx.Enums.GLXAttribute.DEPTH_SIZE); visualAttributes.Add((int)mode.DepthBits); visualAttributes.Add((int)1); diff --git a/Source/OpenTK/Platform/X11/X11GLNative.cs b/Source/OpenTK/Platform/X11/X11GLNative.cs index c03256a5..d04322c7 100644 --- a/Source/OpenTK/Platform/X11/X11GLNative.cs +++ b/Source/OpenTK/Platform/X11/X11GLNative.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Diagnostics; +using System.Reflection; //using OpenTK.OpenGL; @@ -52,6 +53,14 @@ namespace OpenTK.Platform.X11 { Debug.Print("Native window driver: {0}", this.ToString()); window = new WindowInfo(); + Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms"); + if (xplatui != null) + { + FieldInfo f = xplatui.GetField("ErrorExceptions", + System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic); + if (f != null) + f.SetValue(null, true); + } } #endregion @@ -87,6 +96,11 @@ namespace OpenTK.Platform.X11 this.OnCreate(EventArgs.Empty); break; + + case XEventName.MapNotify: + Debug.WriteLine("Window mapped."); + return; + case XEventName.CreateNotify: // A child was was created - nothing to do break; @@ -254,10 +268,10 @@ namespace OpenTK.Platform.X11 XSetWindowAttributes attributes = new XSetWindowAttributes(); attributes.background_pixel = IntPtr.Zero; attributes.border_pixel = IntPtr.Zero; - attributes.colormap = API.CreateColormap(window.Display, window.RootWindow, - window.VisualInfo.visual, 0/*AllocNone*/); //glContext.colormap; - attributes.event_mask = (IntPtr)(EventMask.StructureNotifyMask | - EventMask.SubstructureNotifyMask | EventMask.ExposureMask); + attributes.colormap = + API.CreateColormap(window.Display, window.RootWindow, window.VisualInfo.visual, 0/*AllocNone*/); + attributes.event_mask = + (IntPtr)(EventMask.StructureNotifyMask | EventMask.SubstructureNotifyMask | EventMask.ExposureMask); uint mask = (uint)SetWindowValuemask.ColorMap | (uint)SetWindowValuemask.EventMask | (uint)SetWindowValuemask.BackPixel | (uint)SetWindowValuemask.BorderPixel; @@ -270,54 +284,31 @@ namespace OpenTK.Platform.X11 { throw new ApplicationException("XCreateWindow call failed (returned 0)."); } - /* + // Set the window hints XSizeHints hints = new XSizeHints(); hints.x = 0; hints.y = 0; - hints.width = 640; - hints.height = 480; + hints.width = mode.Width; + hints.height = mode.Height; hints.flags = (IntPtr)(XSizeHintsFlags.USSize | XSizeHintsFlags.USPosition); Functions.XSetWMNormalHints(window.Display, window.Handle, ref hints); - XTextProperty text = new XTextProperty(); - text.value = "OpenTK Game Window"; - text.format = 8; - Functions.XSetWMName(window.Display, window.Handle, ref text); - Functions.XSetWMProperties( - display, - window, - name, - name, - 0, // None - null, - 0, - hints - );*/ + + //XTextProperty text = new XTextProperty(); + //text.value = "OpenTK Game Window"; + //text.format = 8; + //Functions.XSetWMName(window.Display, window.Handle, ref text); + //Functions.XSetWMProperties(display, window, name, name, 0, /*None*/ null, 0, hints); Debug.Print("done! (id: {0})", window.Handle); - /* - XEvent ev = new XEvent(); - API.IfEvent(window.Display, ref ev, - delegate(IntPtr display, ref XEvent @event, IntPtr arg) - { - Debug.Print("Checking event: {0}", @event.type); - if (@event.type == XEventName.MapNotify) - { - Debug.Print("Map event for window: {0}", @event.MapEvent.window); - } - return (@event.type == XEventName.MapNotify) && (@event.MapEvent.window == arg); - }, - window.Handle); - */ glContext.windowInfo.Handle = window.Handle; glContext.CreateContext(null, true); - API.MapRaised(window.Display, window.Handle); - Debug.WriteLine("Mapped window."); - glContext.MakeCurrent(); + API.MapRaised(window.Display, window.Handle); + Debug.Unindent(); Debug.WriteLine("GameWindow creation completed successfully!"); exists = true; @@ -330,7 +321,7 @@ namespace OpenTK.Platform.X11 public event CreateEvent Create; - public void OnCreate(EventArgs e) + private void OnCreate(EventArgs e) { if (this.Create != null) { @@ -363,7 +354,9 @@ namespace OpenTK.Platform.X11 #region OnDestroy - public void OnDestroy(EventArgs e) + public event DestroyEvent Destroy; + + private void OnDestroy(EventArgs e) { Debug.Print("Destroy event fired from window: {0}", window.ToString()); if (this.Destroy != null) @@ -372,8 +365,6 @@ namespace OpenTK.Platform.X11 } } - public event DestroyEvent Destroy; - #endregion #endregion diff --git a/Source/OpenTK/Platform/X11/X11Keyboard.cs b/Source/OpenTK/Platform/X11/X11Keyboard.cs index 3f062030..812059e1 100644 --- a/Source/OpenTK/Platform/X11/X11Keyboard.cs +++ b/Source/OpenTK/Platform/X11/X11Keyboard.cs @@ -165,6 +165,8 @@ namespace OpenTK.Platform.X11 this.window = window; Initialize(); + //Debug.Print("Info: {0}", window.ToString()); + API.DisplayKeycodes(window.Display, ref firstKeyCode, ref lastKeyCode); Debug.Print("First keycode: {0}, last {1}", firstKeyCode, lastKeyCode);