mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 07:45:37 +00:00
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.
This commit is contained in:
parent
7d5087f1f8
commit
0133eb1222
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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
|
|||
/// </summary>
|
||||
/// <param name="data">A pointer to the structure that will be freed.</param>
|
||||
[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);
|
||||
|
||||
/// <summary>
|
||||
|
@ -173,7 +173,7 @@ namespace OpenTK.Platform.X11
|
|||
/// <para>XSelectInput() can generate a BadWindow error.</para>
|
||||
/// </remarks>
|
||||
[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);
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
|||
/// <returns>true if the predicate returns true for some event, false otherwise</returns>
|
||||
[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);
|
||||
|
||||
/// <summary>
|
||||
/// The XGetKeyboardMapping() function returns the symbols for the specified number of KeyCodes starting with first_keycode.
|
||||
|
@ -240,7 +240,7 @@ namespace OpenTK.Platform.X11
|
|||
/// <para>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.</para>
|
||||
/// </remarks>
|
||||
[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);
|
||||
|
||||
/// <summary>
|
||||
|
@ -251,14 +251,14 @@ namespace OpenTK.Platform.X11
|
|||
/// <param name="max_keycodes_return">Returns the maximum number of KeyCodes.</param>
|
||||
/// <remarks> 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.</remarks>
|
||||
[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.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct XF86VidModeModeInfo
|
||||
public struct XF86VidModeModeInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Pixel clock.
|
||||
/// </summary>
|
||||
internal int dotclock;
|
||||
public int dotclock;
|
||||
|
||||
/// <summary>
|
||||
/// Number of display pixels horizontally
|
||||
/// </summary>
|
||||
internal short hdisplay;
|
||||
public short hdisplay;
|
||||
|
||||
/// <summary>
|
||||
/// Horizontal sync start
|
||||
/// </summary>
|
||||
internal short hsyncstart;
|
||||
public short hsyncstart;
|
||||
|
||||
/// <summary>
|
||||
/// Horizontal sync end
|
||||
/// </summary>
|
||||
internal short hsyncend;
|
||||
public short hsyncend;
|
||||
|
||||
/// <summary>
|
||||
/// Total horizontal pixel
|
||||
/// </summary>
|
||||
internal short htotal;
|
||||
public short htotal;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
internal short hskew;
|
||||
public short hskew;
|
||||
|
||||
/// <summary>
|
||||
/// Number of display pixels vertically
|
||||
/// </summary>
|
||||
internal short vdisplay;
|
||||
public short vdisplay;
|
||||
|
||||
/// <summary>
|
||||
/// Vertical sync start
|
||||
/// </summary>
|
||||
internal short vsyncstart;
|
||||
public short vsyncstart;
|
||||
|
||||
/// <summary>
|
||||
/// Vertical sync end
|
||||
/// </summary>
|
||||
internal short vsyncend;
|
||||
public short vsyncend;
|
||||
|
||||
/// <summary>
|
||||
/// Total vertical pixels
|
||||
/// </summary>
|
||||
internal short vtotal;
|
||||
public short vtotal;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
internal short vskew;
|
||||
public short vskew;
|
||||
|
||||
/// <summary>
|
||||
/// Mode flags
|
||||
/// </summary>
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// background, None, or ParentRelative
|
||||
/// </summary>
|
||||
internal Pixmap background_pixmap;
|
||||
public Pixmap background_pixmap;
|
||||
/// <summary>
|
||||
/// background pixel
|
||||
/// </summary>
|
||||
internal long background_pixel;
|
||||
public long background_pixel;
|
||||
/// <summary>
|
||||
/// border of the window or CopyFromParent
|
||||
/// </summary>
|
||||
internal Pixmap border_pixmap;
|
||||
public Pixmap border_pixmap;
|
||||
/// <summary>
|
||||
/// border pixel value
|
||||
/// </summary>
|
||||
internal long border_pixel;
|
||||
public long border_pixel;
|
||||
/// <summary>
|
||||
/// one of bit gravity values
|
||||
/// </summary>
|
||||
internal int bit_gravity;
|
||||
public int bit_gravity;
|
||||
/// <summary>
|
||||
/// one of the window gravity values
|
||||
/// </summary>
|
||||
internal int win_gravity;
|
||||
public int win_gravity;
|
||||
/// <summary>
|
||||
/// NotUseful, WhenMapped, Always
|
||||
/// </summary>
|
||||
internal int backing_store;
|
||||
public int backing_store;
|
||||
/// <summary>
|
||||
/// planes to be preserved if possible
|
||||
/// </summary>
|
||||
internal long backing_planes;
|
||||
public long backing_planes;
|
||||
/// <summary>
|
||||
/// value to use in restoring planes
|
||||
/// </summary>
|
||||
internal long backing_pixel;
|
||||
public long backing_pixel;
|
||||
/// <summary>
|
||||
/// should bits under be saved? (popups)
|
||||
/// </summary>
|
||||
internal bool save_under;
|
||||
public bool save_under;
|
||||
/// <summary>
|
||||
/// set of events that should be saved
|
||||
/// </summary>
|
||||
internal EventMask event_mask;
|
||||
public EventMask event_mask;
|
||||
/// <summary>
|
||||
/// set of events that should not propagate
|
||||
/// </summary>
|
||||
internal long do_not_propagate_mask;
|
||||
public long do_not_propagate_mask;
|
||||
/// <summary>
|
||||
/// boolean value for override_redirect
|
||||
/// </summary>
|
||||
internal bool override_redirect;
|
||||
public bool override_redirect;
|
||||
/// <summary>
|
||||
/// color map to be associated with window
|
||||
/// </summary>
|
||||
internal Colormap colormap;
|
||||
public Colormap colormap;
|
||||
/// <summary>
|
||||
/// cursor to be displayed (or None)
|
||||
/// </summary>
|
||||
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(
|
|||
/// <summary>
|
||||
/// Defines LATIN-1 and miscellaneous keys.
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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.
|
||||
/// </summary>
|
||||
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()
|
||||
{
|
||||
|
|
|
@ -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<int> visualAttributes = new List<int>();
|
||||
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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue