Added X11 structs and functions from Mono's x11 bindings. Updated several items to use these bindings. Debugging crash on XCheckIfEvent callback.
This commit is contained in:
parent
ce23ae19c8
commit
4f35768779
8 changed files with 2170 additions and 487 deletions
|
@ -56,6 +56,7 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
//glWindow.Context.MakeCurrent();
|
//glWindow.Context.MakeCurrent();
|
||||||
|
|
||||||
|
if (driver == null)
|
||||||
driver = new InputDriver(this.WindowInfo);
|
driver = new InputDriver(this.WindowInfo);
|
||||||
glWindow.Create -= glWindow_CreateInputDriver;
|
glWindow.Create -= glWindow_CreateInputDriver;
|
||||||
|
|
||||||
|
@ -80,12 +81,7 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (driver == null)
|
return InputDriver.Keyboard;
|
||||||
{
|
|
||||||
Debug.WriteLine("WARNING: Requested the list of Keyboard devices, without creating an InputDriver first. Continuing by creating an input driver, but this may indicate a prorgamming error.");
|
|
||||||
driver = new InputDriver(this.WindowInfo);
|
|
||||||
}
|
|
||||||
return driver.Keyboard;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,17 +96,25 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (driver == null)
|
return InputDriver.InputDevices;
|
||||||
{
|
|
||||||
Debug.WriteLine("WARNING: Requested available InputDevices, without creating an InputDriver first. Continuing by creating an input driver, but this may indicate a prorgamming error.");
|
|
||||||
driver = new InputDriver(this.WindowInfo);
|
|
||||||
}
|
|
||||||
return driver.InputDevices;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
internal InputDriver InputDriver
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (driver == null)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("WARNING: Accessed null InputDriver - creating new. This may indicate a prorgamming error.");
|
||||||
|
driver = new InputDriver(this.WindowInfo);
|
||||||
|
}
|
||||||
|
return driver;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region --- INativeGLWindow Members ---
|
#region --- INativeGLWindow Members ---
|
||||||
|
@ -279,8 +283,9 @@ namespace OpenTK
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public void ProcessEvents()
|
public void ProcessEvents()
|
||||||
{
|
{
|
||||||
glWindow.ProcessEvents();
|
if (driver != null)
|
||||||
driver.ProcessEvents();
|
driver.ProcessEvents();
|
||||||
|
glWindow.ProcessEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace OpenTK.Platform.X11
|
||||||
using KeyCode = System.Byte; // Or maybe ushort?
|
using KeyCode = System.Byte; // Or maybe ushort?
|
||||||
|
|
||||||
using Display = System.IntPtr;
|
using Display = System.IntPtr;
|
||||||
|
using XPointer = System.IntPtr;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -145,7 +146,7 @@ namespace OpenTK.Platform.X11
|
||||||
[DllImport(_dll_name, EntryPoint = "XPeekEvent")]
|
[DllImport(_dll_name, EntryPoint = "XPeekEvent")]
|
||||||
extern internal static void PeekEvent(
|
extern internal static void PeekEvent(
|
||||||
Display display,
|
Display display,
|
||||||
[In, Out]Event event_return
|
[In, Out]XEvent event_return
|
||||||
);
|
);
|
||||||
|
|
||||||
[DllImport(_dll_name, EntryPoint = "XSendEvent")]
|
[DllImport(_dll_name, EntryPoint = "XSendEvent")]
|
||||||
|
@ -156,7 +157,7 @@ namespace OpenTK.Platform.X11
|
||||||
bool propagate,
|
bool propagate,
|
||||||
[MarshalAs(UnmanagedType.SysInt)]
|
[MarshalAs(UnmanagedType.SysInt)]
|
||||||
EventMask event_mask,
|
EventMask event_mask,
|
||||||
ref Event event_send
|
ref XEvent event_send
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -183,6 +184,22 @@ namespace OpenTK.Platform.X11
|
||||||
[DllImport(_dll_name, EntryPoint = "XSelectInput")]
|
[DllImport(_dll_name, EntryPoint = "XSelectInput")]
|
||||||
internal static extern void SelectInput(Display display, Window w, EventMask event_mask);
|
internal 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.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="display">Specifies the connection to the X server.</param>
|
||||||
|
/// <param name="event_return">Returns a copy of the matched event's associated structure.</param>
|
||||||
|
/// <param name="predicate">Specifies the procedure that is to be called to determine if the next event in the queue matches what you want</param>
|
||||||
|
/// <param name="arg">Specifies the user-supplied argument that will be passed to the predicate procedure.</param>
|
||||||
|
/// <returns>true if the predicate returns true for some event, false otherwise</returns>
|
||||||
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
internal static extern bool CheckIfEvent(Display display, ref XEvent event_return,
|
||||||
|
/*[MarshalAs(UnmanagedType.FunctionPtr)] */ CheckEventPredicate predicate, /*XPointer*/ IntPtr arg);
|
||||||
|
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
internal delegate bool CheckEventPredicate(Display display, ref XEvent @event, IntPtr arg);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Pointer and Keyboard functions
|
#region Pointer and Keyboard functions
|
||||||
|
@ -626,220 +643,6 @@ XF86VidModeGetGammaRampSize(
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Event structures
|
|
||||||
|
|
||||||
#region XEvent
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
//[StructLayout(LayoutKind.Explicit)]
|
|
||||||
internal class Event
|
|
||||||
{
|
|
||||||
internal EventType Type;
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=192)]
|
|
||||||
byte[] pad = new byte[192];
|
|
||||||
/*[FieldOffset(0)]internal EventType Type;*/
|
|
||||||
/*[FieldOffset(0)]
|
|
||||||
IntPtr
|
|
||||||
pad1 , pad2 , pad3 , pad4 , pad5 , pad6 ,
|
|
||||||
pad7 , pad8 , pad9 , pad10, pad11, pad12,
|
|
||||||
pad13, pad14, pad15, pad16, pad17, pad18,
|
|
||||||
pad19, pad20, pad21, pad22, pad23, pad24;*/
|
|
||||||
|
|
||||||
/*private ConfigureNotifyEvent cne = new ConfigureNotifyEvent();
|
|
||||||
internal ConfigureNotifyEvent ConfigureEvent
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
cne.type = this.Type;
|
|
||||||
cne.serial = this.pad1;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
//[FieldOffset(0)]internal AnyEvent Any;
|
|
||||||
//[FieldOffset(0)]internal KeyEvent Key;
|
|
||||||
//[FieldOffset(0)]internal DestroyWindowEvent DestroyWindow;
|
|
||||||
//[FieldOffset(0)]internal CreateWindowEvent CreateWindow;
|
|
||||||
//[FieldOffset(0)]internal ResizeRequestEvent ResizeRequest;
|
|
||||||
//[FieldOffset(0)]internal ConfigureNotifyEvent ConfigureNotify;
|
|
||||||
//[FieldOffset(0)]internal ReparentNotifyEvent ReparentNotify;
|
|
||||||
//[FieldOffset(0)]internal ExposeEvent Expose;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region XAnyEvent
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal class AnyEvent
|
|
||||||
{
|
|
||||||
internal EventType type;
|
|
||||||
//[MarshalAs(UnmanagedType.SysUInt)]
|
|
||||||
internal IntPtr serial; /* # of last request processed by server */
|
|
||||||
[MarshalAs(UnmanagedType.Bool)]
|
|
||||||
internal bool send_event; /* true if this came from a SendEvent request */
|
|
||||||
internal Display display; /* Display the event was read from */
|
|
||||||
internal Window window;
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=192)]
|
|
||||||
byte[] pad = new byte[192];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region XKeyEvent
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal class KeyEvent
|
|
||||||
{
|
|
||||||
internal EventType type; /* KeyPress or KeyRelease */
|
|
||||||
[MarshalAs(UnmanagedType.SysUInt)]
|
|
||||||
internal ulong serial; /* # of last request processed by server */
|
|
||||||
[MarshalAs(UnmanagedType.Bool)]
|
|
||||||
internal bool send_event; /* true if this came from a SendEvent request */
|
|
||||||
internal Display display; /* Display the event was read from */
|
|
||||||
internal Window window; /* ``event'' window it is reported relative to */
|
|
||||||
internal Window root; /* root window that the event occurred on */
|
|
||||||
internal Window subwindow; /* child window */
|
|
||||||
[MarshalAs(UnmanagedType.SysUInt)]
|
|
||||||
internal Time time; /* milliseconds */
|
|
||||||
internal int x, y; /* pointer x, y coordinates in event window */
|
|
||||||
internal int x_root, y_root; /* coordinates relative to root */
|
|
||||||
internal uint state; /* key or button mask */
|
|
||||||
internal uint keycode; /* detail */
|
|
||||||
[MarshalAs(UnmanagedType.Bool)]
|
|
||||||
internal bool same_screen; /* same screen flag */
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=192)]
|
|
||||||
byte[] pad = new byte[192];
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region XDestroyWindowEvent
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal class DestroyWindowEvent
|
|
||||||
{
|
|
||||||
internal EventType type; /* DestroyNotify */
|
|
||||||
internal ulong serial; /* # of last request processed by server */
|
|
||||||
[MarshalAs(UnmanagedType.Bool)]
|
|
||||||
internal bool send_event; /* true if this came from a SendEvent request */
|
|
||||||
internal Display display; /* Display the event was read from */
|
|
||||||
internal Window @event;
|
|
||||||
internal Window window;
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=192)]
|
|
||||||
byte[] pad = new byte[192];
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region XCreateWindowEvent
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal class CreateWindowEvent
|
|
||||||
{
|
|
||||||
internal EventType type; /* CreateNotify */
|
|
||||||
internal ulong serial; /* # of last request processed by server */
|
|
||||||
[MarshalAs(UnmanagedType.Bool)]
|
|
||||||
internal bool send_event; /* true if this came from a SendEvent request */
|
|
||||||
internal Display display; /* Display the event was read from */
|
|
||||||
internal Window parent; /* parent of the window */
|
|
||||||
internal Window window; /* window id of window created */
|
|
||||||
internal int x, y; /* window location */
|
|
||||||
internal int width, height; /* size of window */
|
|
||||||
internal int border_width; /* border width */
|
|
||||||
[MarshalAs(UnmanagedType.Bool)]
|
|
||||||
internal bool override_redirect; /* creation should be overridden */
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=192)]
|
|
||||||
byte[] pad = new byte[192];
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region XResizeRequestEvent
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal class ResizeRequestEvent
|
|
||||||
{
|
|
||||||
internal EventType type; /* ResizeRequest */
|
|
||||||
internal ulong serial; /* # of last request processed by server */
|
|
||||||
[MarshalAs(UnmanagedType.Bool)]
|
|
||||||
internal bool send_event; /* true if this came from a SendEvent request */
|
|
||||||
internal Display display; /* Display the event was read from */
|
|
||||||
internal Window window;
|
|
||||||
internal int width, height;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region XConfigureNotifyEvent
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal class ConfigureNotifyEvent
|
|
||||||
{
|
|
||||||
internal EventType type; /* ConfigureNotify */
|
|
||||||
internal ulong serial; /* # of last request processed by server */
|
|
||||||
[MarshalAs(UnmanagedType.Bool)]
|
|
||||||
internal bool send_event; /* true if this came from a SendEvent request */
|
|
||||||
internal Display display; /* Display the event was read from */
|
|
||||||
internal Window @event;
|
|
||||||
internal Window window;
|
|
||||||
internal int x, y;
|
|
||||||
internal int width, height;
|
|
||||||
internal int border_width;
|
|
||||||
internal Window above;
|
|
||||||
[MarshalAs(UnmanagedType.Bool)]
|
|
||||||
internal bool override_redirect;
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=192)]
|
|
||||||
byte[] pad = new byte[192];
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region XReparentNotifyEvent
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal class ReparentNotifyEvent
|
|
||||||
{
|
|
||||||
internal EventType type; /* ReparentNotify */
|
|
||||||
//[MarshalAs(UnmanagedType.SysUInt)]
|
|
||||||
internal IntPtr serial; /* # of last request processed by server */
|
|
||||||
//[MarshalAs(UnmanagedType.Bool)]
|
|
||||||
internal bool send_event; /* true if this came from a SendEvent request */
|
|
||||||
internal Display display; /* Display the event was read from */
|
|
||||||
internal Window @event;
|
|
||||||
internal Window window;
|
|
||||||
internal Window parent;
|
|
||||||
internal int x, y;
|
|
||||||
//[MarshalAs(UnmanagedType.Bool)]
|
|
||||||
internal bool override_redirect;
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=192)]
|
|
||||||
byte[] pad = new byte[192];
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region XExposeEvent
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal class ExposeEvent
|
|
||||||
{
|
|
||||||
internal EventType type; /* Expose */
|
|
||||||
internal ulong serial; /* # of last request processed by server */
|
|
||||||
[MarshalAs(UnmanagedType.Bool)]
|
|
||||||
internal bool send_event; /* true if this came from a SendEvent request */
|
|
||||||
internal Display display; /* Display the event was read from */
|
|
||||||
internal Window window;
|
|
||||||
internal int x, y;
|
|
||||||
internal int width, height;
|
|
||||||
internal int count; /* if nonzero, at least this many more */
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=192)]
|
|
||||||
byte[] pad = new byte[192];
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region X11 Constants and Enums
|
#region X11 Constants and Enums
|
||||||
|
@ -856,45 +659,6 @@ XF86VidModeGetGammaRampSize(
|
||||||
internal const int InputOnly = 2;
|
internal const int InputOnly = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal enum EventType : int
|
|
||||||
{
|
|
||||||
NoEventMask = 0,
|
|
||||||
FocusOut = 10,
|
|
||||||
KeymapNotify = 11,
|
|
||||||
Expose = 12,
|
|
||||||
GraphicsExpose = 13,
|
|
||||||
NoExpose = 14,
|
|
||||||
VisibilityNotify = 15,
|
|
||||||
CreateNotify = 16,
|
|
||||||
DestroyNotify = 17,
|
|
||||||
UnmapNotify = 18,
|
|
||||||
MapNotify = 19,
|
|
||||||
KeyPress = 2,
|
|
||||||
MapRequest = 20,
|
|
||||||
ReparentNotify = 21,
|
|
||||||
ConfigureNotify = 22,
|
|
||||||
ConfigureRequest = 23,
|
|
||||||
GravityNotify = 24,
|
|
||||||
ResizeRequest = 25,
|
|
||||||
CirculateNotify = 26,
|
|
||||||
CirculateRequest = 27,
|
|
||||||
PropertyNotify = 28,
|
|
||||||
SelectionClear = 29,
|
|
||||||
KeyRelease = 3,
|
|
||||||
SelectionRequest = 30,
|
|
||||||
SelectionNotify = 31,
|
|
||||||
ColormapNotify = 32,
|
|
||||||
ClientMessage = 33,
|
|
||||||
MappingNotify = 34,
|
|
||||||
LASTEvent = 35,
|
|
||||||
ButtonPress = 4,
|
|
||||||
ButtonRelease = 5,
|
|
||||||
MotionNotify = 6,
|
|
||||||
EnterNotify = 7,
|
|
||||||
LeaveNotify = 8,
|
|
||||||
FocusIn = 9,
|
|
||||||
}
|
|
||||||
|
|
||||||
internal enum ErrorCodes : int
|
internal enum ErrorCodes : int
|
||||||
{
|
{
|
||||||
Success = 0,
|
Success = 0,
|
||||||
|
@ -917,42 +681,6 @@ XF86VidModeGetGammaRampSize(
|
||||||
BadImplementation = 17,
|
BadImplementation = 17,
|
||||||
}
|
}
|
||||||
|
|
||||||
internal enum GrabMode : int
|
|
||||||
{
|
|
||||||
Sync = 0,
|
|
||||||
Async = 1,
|
|
||||||
}
|
|
||||||
|
|
||||||
[Flags]
|
|
||||||
internal enum EventMask : long //: ulong
|
|
||||||
{
|
|
||||||
NoEventMask = 0,
|
|
||||||
KeyPressMask = (1L<<0),
|
|
||||||
KeyReleaseMask = (1L<<1),
|
|
||||||
Button3MotionMask = (1L<<10),
|
|
||||||
Button4MotionMask = (1L<<11),
|
|
||||||
Button5MotionMask = (1L<<12),
|
|
||||||
ButtonMotionMask = (1L<<13),
|
|
||||||
KeymapStateMask = (1L<<14),
|
|
||||||
ExposureMask = (1L<<15),
|
|
||||||
VisibilityChangeMask = (1L<<16),
|
|
||||||
StructureNotifyMask = (1L<<17),
|
|
||||||
ResizeRedirectMask = (1L<<18),
|
|
||||||
SubstructureNotifyMask = (1L<<19),
|
|
||||||
ButtonPressMask = (1L<<2),
|
|
||||||
SubstructureRedirectMask = (1L<<20),
|
|
||||||
FocusChangeMask = (1L<<21),
|
|
||||||
PropertyChangeMask = (1L<<22),
|
|
||||||
CoormapChangeMask = (1L<<23),
|
|
||||||
ButtonReleaseMask = (1L<<3),
|
|
||||||
EnterWindowMask = (1L<<4),
|
|
||||||
LeaveWindowMask = (1L<<5),
|
|
||||||
PointerMotionMask = (1L<<6),
|
|
||||||
PointerMotionHintMask = (1L<<7),
|
|
||||||
Button1MotionMask = (1L<<8),
|
|
||||||
Button2MotionMask = (1L<<9),
|
|
||||||
}
|
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
internal enum CreateWindowMask : long//: ulong
|
internal enum CreateWindowMask : long//: ulong
|
||||||
{
|
{
|
||||||
|
|
317
Source/OpenTK/Platform/X11/Functions.cs
Normal file
317
Source/OpenTK/Platform/X11/Functions.cs
Normal file
|
@ -0,0 +1,317 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace OpenTK.Platform.X11
|
||||||
|
{
|
||||||
|
class Functions
|
||||||
|
{
|
||||||
|
[DllImport("libX11", EntryPoint = "XOpenDisplay")]
|
||||||
|
internal extern static IntPtr XOpenDisplay(IntPtr display);
|
||||||
|
[DllImport("libX11", EntryPoint = "XCloseDisplay")]
|
||||||
|
internal extern static int XCloseDisplay(IntPtr display);
|
||||||
|
[DllImport("libX11", EntryPoint = "XSynchronize")]
|
||||||
|
internal 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);
|
||||||
|
[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);
|
||||||
|
[DllImport("libX11", EntryPoint = "XMapWindow")]
|
||||||
|
internal extern static int XMapWindow(IntPtr display, IntPtr window);
|
||||||
|
[DllImport("libX11", EntryPoint = "XUnmapWindow")]
|
||||||
|
internal extern static int XUnmapWindow(IntPtr display, IntPtr window);
|
||||||
|
[DllImport("libX11", EntryPoint = "XMapSubwindows")]
|
||||||
|
internal extern static int XMapSubindows(IntPtr display, IntPtr window);
|
||||||
|
[DllImport("libX11", EntryPoint = "XUnmapSubwindows")]
|
||||||
|
internal extern static int XUnmapSubwindows(IntPtr display, IntPtr window);
|
||||||
|
[DllImport("libX11", EntryPoint = "XRootWindow")]
|
||||||
|
internal extern static IntPtr XRootWindow(IntPtr display, int screen_number);
|
||||||
|
[DllImport("libX11", EntryPoint = "XNextEvent")]
|
||||||
|
internal extern static IntPtr XNextEvent(IntPtr display, ref XEvent xevent);
|
||||||
|
[DllImport("libX11")]
|
||||||
|
internal extern static int XConnectionNumber(IntPtr diplay);
|
||||||
|
[DllImport("libX11")]
|
||||||
|
internal extern static int XPending(IntPtr diplay);
|
||||||
|
[DllImport("libX11", EntryPoint = "XSelectInput")]
|
||||||
|
internal extern static IntPtr XSelectInput(IntPtr display, IntPtr window, IntPtr mask);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XDestroyWindow")]
|
||||||
|
internal 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);
|
||||||
|
[DllImport("libX11", EntryPoint = "XMoveResizeWindow")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XGetWindowAttributes")]
|
||||||
|
internal extern static int XGetWindowAttributes(IntPtr display, IntPtr window, ref XWindowAttributes attributes);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XFlush")]
|
||||||
|
internal extern static int XFlush(IntPtr display);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XSetWMName")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XFetchName")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XFree")]
|
||||||
|
internal extern static int XFree(IntPtr data);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XRaiseWindow")]
|
||||||
|
internal extern static int XRaiseWindow(IntPtr display, IntPtr window);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XLowerWindow")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XInternAtom")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XSetWMProtocols")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XUngrabPointer")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XClearWindow")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
// Colormaps
|
||||||
|
[DllImport("libX11", EntryPoint = "XDefaultScreenOfDisplay")]
|
||||||
|
internal extern static IntPtr XDefaultScreenOfDisplay(IntPtr display);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XScreenNumberOfScreen")]
|
||||||
|
internal extern static int XScreenNumberOfScreen(IntPtr display, IntPtr Screen);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XDefaultVisual")]
|
||||||
|
internal extern static IntPtr XDefaultVisual(IntPtr display, int screen_number);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XDefaultDepth")]
|
||||||
|
internal extern static uint XDefaultDepth(IntPtr display, int screen_number);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XDefaultScreen")]
|
||||||
|
internal extern static int XDefaultScreen(IntPtr display);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XDefaultColormap")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XAllocColor")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XDeleteProperty")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XFreeGC")]
|
||||||
|
internal extern static int XFreeGC(IntPtr display, IntPtr gc);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XSetFunction")]
|
||||||
|
internal extern static int XSetFunction(IntPtr display, IntPtr gc, GXFunction function);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XSetLineAttributes")]
|
||||||
|
internal extern static int XSetLineAttributes(IntPtr display, IntPtr gc, int line_width, GCLineStyle line_style, GCCapStyle cap_style, GCJoinStyle join_style);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XDrawLine")]
|
||||||
|
internal extern static int XDrawLine(IntPtr display, IntPtr drawable, IntPtr gc, int x1, int y1, int x2, int y2);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XDrawRectangle")]
|
||||||
|
internal extern static int XDrawRectangle(IntPtr display, IntPtr drawable, IntPtr gc, int x1, int y1, int width, int height);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XFillRectangle")]
|
||||||
|
internal extern static int XFillRectangle(IntPtr display, IntPtr drawable, IntPtr gc, int x1, int y1, int width, int height);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XSetWindowBackground")]
|
||||||
|
internal extern static int XSetWindowBackground(IntPtr display, IntPtr window, IntPtr background);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XSetInputFocus")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XDefineCursor")]
|
||||||
|
internal extern static int XDefineCursor(IntPtr display, IntPtr window, IntPtr cursor);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XUndefineCursor")]
|
||||||
|
internal extern static int XUndefineCursor(IntPtr display, IntPtr window);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XFreeCursor")]
|
||||||
|
internal extern static int XFreeCursor(IntPtr display, IntPtr cursor);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XCreateFontCursor")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XCreatePixmapFromBitmapData")]
|
||||||
|
internal extern static IntPtr XCreatePixmapFromBitmapData(IntPtr display, IntPtr drawable, byte[] data, int width, int height, IntPtr fg, IntPtr bg, int depth);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XCreatePixmap")]
|
||||||
|
internal extern static IntPtr XCreatePixmap(IntPtr display, IntPtr d, int width, int height, int depth);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XFreePixmap")]
|
||||||
|
internal extern static IntPtr XFreePixmap(IntPtr display, IntPtr pixmap);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XWhitePixel")]
|
||||||
|
internal extern static IntPtr XWhitePixel(IntPtr display, int screen_no);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XBlackPixel")]
|
||||||
|
internal extern static IntPtr XBlackPixel(IntPtr display, int screen_no);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XGrabServer")]
|
||||||
|
internal extern static void XGrabServer(IntPtr display);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XUngrabServer")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XSetWMNormalHints")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XSetWMHints")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XSetErrorHandler")]
|
||||||
|
internal extern static IntPtr XSetErrorHandler(XErrorHandler error_handler);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XGetErrorText")]
|
||||||
|
internal extern static IntPtr XGetErrorText(IntPtr display, byte code, StringBuilder buffer, int length);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XInitThreads")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XGetSelectionOwner")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XSetPlaneMask")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XSetBackground")]
|
||||||
|
internal extern static int XSetBackground(IntPtr display, IntPtr gc, UIntPtr background);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XBell")]
|
||||||
|
internal 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);
|
||||||
|
|
||||||
|
[DllImport("libX11", EntryPoint = "XFilterEvent")]
|
||||||
|
internal extern static bool XFilterEvent(ref XEvent xevent, IntPtr window);
|
||||||
|
|
||||||
|
[DllImport("libX11")]
|
||||||
|
internal extern static void XkbSetDetectableAutoRepeat(IntPtr display, bool detectable, IntPtr supported);
|
||||||
|
|
||||||
|
[DllImport("libX11")]
|
||||||
|
internal extern static void XPeekEvent(IntPtr display, ref XEvent xevent);
|
||||||
|
}
|
||||||
|
}
|
1657
Source/OpenTK/Platform/X11/Structs.cs
Normal file
1657
Source/OpenTK/Platform/X11/Structs.cs
Normal file
File diff suppressed because it is too large
Load diff
|
@ -24,7 +24,7 @@ namespace OpenTK.Platform.X11
|
||||||
private int screenNo;
|
private int screenNo;
|
||||||
|
|
||||||
private DisplayMode mode;// = new DisplayMode();
|
private DisplayMode mode;// = new DisplayMode();
|
||||||
internal WindowInfo windowInfo = new WindowInfo();
|
internal WindowInfo windowInfo;
|
||||||
private VisualInfo visualInfo;
|
private VisualInfo visualInfo;
|
||||||
|
|
||||||
//private IntPtr desktopResolution = IntPtr.Zero;
|
//private IntPtr desktopResolution = IntPtr.Zero;
|
||||||
|
@ -45,14 +45,9 @@ namespace OpenTK.Platform.X11
|
||||||
this.mode = new DisplayMode();
|
this.mode = new DisplayMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal X11GLContext(WindowInfo info, DisplayMode mode)
|
internal X11GLContext(WindowInfo window, DisplayMode mode)
|
||||||
{
|
{
|
||||||
this.windowInfo.Handle = info.Handle;
|
this.windowInfo = new WindowInfo(window);
|
||||||
this.windowInfo.RootWindow = info.RootWindow;
|
|
||||||
this.windowInfo.TopLevelWindow = info.TopLevelWindow;
|
|
||||||
this.windowInfo.Display = info.Display;
|
|
||||||
this.windowInfo.Screen = info.Screen;
|
|
||||||
|
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,12 +264,5 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
get { return this.x11context; }
|
get { return this.x11context; }
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
public IntPtr ContainingWindow
|
|
||||||
{
|
|
||||||
get { return info.Window; }
|
|
||||||
internal set { info.Window = value; }
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace OpenTK.Platform.X11
|
||||||
#region --- Fields ---
|
#region --- Fields ---
|
||||||
|
|
||||||
private X11GLContext glContext;
|
private X11GLContext glContext;
|
||||||
private WindowInfo info = new WindowInfo();
|
private WindowInfo window = new WindowInfo();
|
||||||
private DisplayMode mode = new DisplayMode();
|
private DisplayMode mode = new DisplayMode();
|
||||||
|
|
||||||
// Number of pending events.
|
// Number of pending events.
|
||||||
|
@ -33,17 +33,8 @@ namespace OpenTK.Platform.X11
|
||||||
private ResizeEventArgs resizeEventArgs = new ResizeEventArgs();
|
private ResizeEventArgs resizeEventArgs = new ResizeEventArgs();
|
||||||
|
|
||||||
// Low level X11 resize request
|
// Low level X11 resize request
|
||||||
private X11.Event xresize = new Event();
|
|
||||||
// Event used for event loop.
|
// Event used for event loop.
|
||||||
private Event e = new Event();
|
private XEvent e = new XEvent();
|
||||||
// This is never written in the code. If at some point it gets != 0,
|
|
||||||
// then memory corruption is taking place from the xresize struct.
|
|
||||||
int memGuard = 0;
|
|
||||||
private ConfigureNotifyEvent configure = new ConfigureNotifyEvent();
|
|
||||||
private ReparentNotifyEvent reparent = new ReparentNotifyEvent();
|
|
||||||
private ExposeEvent expose = new ExposeEvent();
|
|
||||||
private CreateWindowEvent createWindow = new CreateWindowEvent();
|
|
||||||
private DestroyWindowEvent destroyWindow = new DestroyWindowEvent();
|
|
||||||
|
|
||||||
private bool disposed;
|
private bool disposed;
|
||||||
private bool created;
|
private bool created;
|
||||||
|
@ -79,76 +70,66 @@ namespace OpenTK.Platform.X11
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public void CreateWindow(DisplayMode mode)
|
public void CreateWindow(DisplayMode mode)
|
||||||
|
{
|
||||||
|
if (created)
|
||||||
|
{
|
||||||
|
throw new ApplicationException("Render window already exists!");
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Debug.Print("Creating native window with mode: {0}", mode.ToString());
|
Debug.Print("Creating native window with mode: {0}", mode.ToString());
|
||||||
Debug.Indent();
|
Debug.Indent();
|
||||||
|
|
||||||
info.Display = API.OpenDisplay(null); // null == default display
|
window.Display = API.OpenDisplay(null); // null == default display
|
||||||
if (info.Display == IntPtr.Zero)
|
if (window.Display == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
throw new Exception("Could not open connection to X");
|
throw new Exception("Could not open connection to X");
|
||||||
}
|
}
|
||||||
info.Screen = API.DefaultScreen(info.Display);
|
window.Screen = API.DefaultScreen(window.Display);
|
||||||
info.RootWindow = API.RootWindow(info.Display, info.Screen);
|
window.RootWindow = API.RootWindow(window.Display, window.Screen);
|
||||||
|
|
||||||
Debug.Print(
|
Debug.Print(
|
||||||
"Display: {0}, Screen {1}, Root window: {2}",
|
"Display: {0}, Screen {1}, Root window: {2}",
|
||||||
info.Display,
|
window.Display,
|
||||||
info.Screen,
|
window.Screen,
|
||||||
info.RootWindow
|
window.RootWindow
|
||||||
);
|
);
|
||||||
|
|
||||||
glContext = new X11GLContext(info, mode);
|
glContext = new X11GLContext(window, mode);
|
||||||
info.VisualInfo = glContext.CreateVisual();
|
window.VisualInfo = glContext.CreateVisual();
|
||||||
|
|
||||||
// Create a window on this display using the visual above
|
// Create a window on this display using the visual above
|
||||||
Debug.Write("Creating output window... ");
|
Debug.Write("Creating output window... ");
|
||||||
|
|
||||||
SetWindowAttributes wnd_attributes = new SetWindowAttributes();
|
XSetWindowAttributes attributes = new XSetWindowAttributes();
|
||||||
wnd_attributes.background_pixel = 0;
|
attributes.colormap = glContext.colormap;
|
||||||
wnd_attributes.border_pixel = 0;
|
attributes.event_mask = (IntPtr)(EventMask.StructureNotifyMask);
|
||||||
wnd_attributes.colormap = glContext.XColormap;
|
|
||||||
//API.CreateColormap(display, rootWindow, glxVisualInfo.visual, 0/*AllocNone*/);
|
|
||||||
wnd_attributes.event_mask =
|
|
||||||
EventMask.StructureNotifyMask;// |
|
|
||||||
//EventMask.SubstructureNotifyMask |
|
|
||||||
//EventMask.ExposureMask;
|
|
||||||
|
|
||||||
CreateWindowMask cw_mask =
|
SetWindowValuemask mask = SetWindowValuemask.ColorMap | SetWindowValuemask.EventMask;
|
||||||
CreateWindowMask.CWBackPixel |
|
|
||||||
CreateWindowMask.CWBorderPixel |
|
|
||||||
CreateWindowMask.CWColormap |
|
|
||||||
CreateWindowMask.CWEventMask;
|
|
||||||
|
|
||||||
info.Handle = API.CreateWindow(
|
window.Handle = Functions.XCreateWindow(window.Display, window.RootWindow,
|
||||||
info.Display,
|
0, 0, mode.Width, mode.Height, 0, glContext.XVisualInfo.depth,
|
||||||
info.RootWindow,
|
(int)CreateWindowArgs.InputOutput, glContext.XVisualInfo.visual, (UIntPtr)mask,
|
||||||
0, 0,
|
ref attributes);
|
||||||
mode.Width, mode.Height,
|
|
||||||
0,
|
|
||||||
glContext.XVisualInfo.depth,
|
|
||||||
Constants.InputOutput,
|
|
||||||
glContext.XVisualInfo.visual,
|
|
||||||
cw_mask,
|
|
||||||
wnd_attributes
|
|
||||||
);
|
|
||||||
|
|
||||||
if (info.Handle == IntPtr.Zero)
|
if (window.Handle == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
throw new Exception("Could not create window.");
|
throw new Exception("Could not create window.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.WriteLine("done! (id: " + info.Handle + ")");
|
|
||||||
/*
|
/*
|
||||||
// Set the window hints
|
// Set the window hints
|
||||||
SizeHints hints = new SizeHints();
|
XSizeHints hints = new XSizeHints();
|
||||||
hints.x = 0;
|
hints.x = 0;
|
||||||
hints.y = 0;
|
hints.y = 0;
|
||||||
hints.width = 640;
|
hints.width = 640;
|
||||||
hints.height = 480;
|
hints.height = 480;
|
||||||
hints.flags = USSize | USPosition;
|
hints.flags = (IntPtr)(XSizeHintsFlags.USSize | XSizeHintsFlags.USPosition);
|
||||||
API.SetNormalHints(display, window, hints);
|
Functions.XSetWMNormalHints(window.Display, window.Handle, ref hints);
|
||||||
API.SetStandardProperties(
|
XTextProperty text = new XTextProperty();
|
||||||
|
text.value = "OpenTK Game Window";
|
||||||
|
text.format = 8;
|
||||||
|
Functions.XSetWMName(window.Display, window.Handle, ref text);
|
||||||
|
Functions.XSetWMProperties(
|
||||||
display,
|
display,
|
||||||
window,
|
window,
|
||||||
name,
|
name,
|
||||||
|
@ -157,15 +138,14 @@ namespace OpenTK.Platform.X11
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
hints
|
hints
|
||||||
);
|
);*/
|
||||||
|
|
||||||
//glContext.ContainingWindow = info.Window;
|
Debug.Print("done! (id: {0})", window.Handle);
|
||||||
*/
|
|
||||||
|
|
||||||
glContext.windowInfo.Handle = info.Handle;
|
glContext.windowInfo.Handle = window.Handle;
|
||||||
glContext.CreateContext(null, true);
|
glContext.CreateContext(null, true);
|
||||||
|
|
||||||
API.MapRaised(info.Display, info.Handle);
|
API.MapRaised(window.Display, window.Handle);
|
||||||
|
|
||||||
Debug.WriteLine("Mapped window.");
|
Debug.WriteLine("Mapped window.");
|
||||||
|
|
||||||
|
@ -175,6 +155,7 @@ namespace OpenTK.Platform.X11
|
||||||
Debug.Unindent();
|
Debug.Unindent();
|
||||||
created = true;
|
created = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -200,70 +181,60 @@ namespace OpenTK.Platform.X11
|
||||||
// Process all pending events
|
// Process all pending events
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
pending = API.Pending(info.Display);
|
//pending = Functions.XPending(info.Display);
|
||||||
|
pending = Functions.XPending(window.Display);
|
||||||
|
|
||||||
if (pending == 0)
|
if (pending == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//API.NextEvent(info.Display, e);
|
Functions.XNextEvent(window.Display, ref e);
|
||||||
API.PeekEvent(info.Display, e);
|
|
||||||
//API.NextEvent(info.Display, eventPtr);
|
|
||||||
|
|
||||||
|
Debug.WriteLine(String.Format("Event: {0} ({1} pending)", e.type, pending));
|
||||||
Debug.WriteLine(String.Format("Event: {0} ({1} pending)", e.Type, pending));
|
|
||||||
//Debug.WriteLine(String.Format("Event: {0} ({1} pending)", eventPtr, pending));
|
|
||||||
|
|
||||||
// Check whether memory was corrupted by the NextEvent call.
|
|
||||||
Debug.Assert(memGuard == 0, "memGuard2 tripped", String.Format("Guard: {0}", memGuard));
|
|
||||||
memGuard = 0;
|
|
||||||
|
|
||||||
// Respond to the event e
|
// Respond to the event e
|
||||||
switch (e.Type)
|
switch (e.type)
|
||||||
{
|
{
|
||||||
case EventType.ReparentNotify:
|
case XEventName.ReparentNotify:
|
||||||
API.NextEvent(info.Display, reparent);
|
|
||||||
|
|
||||||
// TODO: Is there a more suitable place to raise the Create event?
|
// TODO: Is there a more suitable place to raise the Create event?
|
||||||
// ReparentNotify seems to be the first event raised on window creation.
|
// ReparentNotify seems to be the first event raised on window creation.
|
||||||
this.OnCreate(EventArgs.Empty);
|
this.OnCreate(EventArgs.Empty);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EventType.CreateNotify:
|
case XEventName.CreateNotify:
|
||||||
API.NextEvent(info.Display, createWindow);
|
|
||||||
// A child was created - nothing to do
|
// A child was created - nothing to do
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EventType.DestroyNotify:
|
case XEventName.DestroyNotify:
|
||||||
API.NextEvent(info.Display, destroyWindow);
|
glContext.Dispose();
|
||||||
|
Functions.XDestroyWindow(window.Display, window.Handle);
|
||||||
|
window = null;
|
||||||
|
glContext = null;
|
||||||
quit = true;
|
quit = true;
|
||||||
Debug.WriteLine("Window destroyed, shutting down.");
|
Debug.WriteLine("Window destroyed, shutting down.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case EventType.ConfigureNotify:
|
case XEventName.ConfigureNotify:
|
||||||
API.NextEvent(info.Display, configure);
|
|
||||||
|
|
||||||
// If the window size changed, raise the C# Resize event.
|
// If the window size changed, raise the C# Resize event.
|
||||||
if (configure.width != mode.Width ||
|
if (e.ConfigureEvent.width != mode.Width ||
|
||||||
configure.height != mode.Height)
|
e.ConfigureEvent.height != mode.Height)
|
||||||
{
|
{
|
||||||
Debug.WriteLine(
|
Debug.WriteLine(
|
||||||
String.Format(
|
String.Format(
|
||||||
"New res: {0}x{1}",
|
"New res: {0}x{1}",
|
||||||
configure.width,
|
e.ConfigureEvent.width,
|
||||||
configure.height
|
e.ConfigureEvent.height
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
resizeEventArgs.Width = configure.width;
|
resizeEventArgs.Width = e.ConfigureEvent.width;
|
||||||
resizeEventArgs.Height = configure.height;
|
resizeEventArgs.Height = e.ConfigureEvent.height;
|
||||||
this.OnResize(resizeEventArgs);
|
this.OnResize(resizeEventArgs);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
API.NextEvent(info.Display, e);
|
Debug.WriteLine(String.Format("{0} event was not handled", e.type));
|
||||||
Debug.WriteLine(String.Format("{0} event was not handled", e.Type));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,7 +250,7 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
if (this.Create != null)
|
if (this.Create != null)
|
||||||
{
|
{
|
||||||
Debug.Print("Create event fired from window: {0}", info.ToString());
|
Debug.Print("Create event fired from window: {0}", window.ToString());
|
||||||
this.Create(this, e);
|
this.Create(this, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -351,7 +322,7 @@ namespace OpenTK.Platform.X11
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr Handle
|
public IntPtr Handle
|
||||||
{
|
{
|
||||||
get { return this.info.Handle; }
|
get { return this.window.Handle; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -360,7 +331,7 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
public IWindowInfo WindowInfo
|
public IWindowInfo WindowInfo
|
||||||
{
|
{
|
||||||
get { return info; }
|
get { return window; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -457,13 +428,15 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
if (!disposed)
|
if (!disposed)
|
||||||
{
|
{
|
||||||
API.DestroyWindow(info.Display, info.Handle);
|
if (window != null)
|
||||||
|
Functions.XDestroyWindow(window.Display, window.Handle);
|
||||||
// Kills connection to the X-Server. We don't want that,
|
// Kills connection to the X-Server. We don't want that,
|
||||||
// 'cause it kills the ExampleLauncher too.
|
// 'cause it kills the ExampleLauncher too.
|
||||||
//API.CloseDisplay(display);
|
//API.CloseDisplay(display);
|
||||||
|
|
||||||
if (manuallyCalled)
|
if (manuallyCalled)
|
||||||
{
|
{
|
||||||
|
if (glContext != null)
|
||||||
glContext.Dispose();
|
glContext.Dispose();
|
||||||
}
|
}
|
||||||
disposed = true;
|
disposed = true;
|
||||||
|
|
|
@ -16,9 +16,7 @@ namespace OpenTK.Platform.X11
|
||||||
private X11Keyboard keyboardDriver;
|
private X11Keyboard keyboardDriver;
|
||||||
private WindowInfo window;
|
private WindowInfo window;
|
||||||
|
|
||||||
Event e = new Event();
|
XEvent e = new XEvent();
|
||||||
KeyEvent keyEvent = new KeyEvent();
|
|
||||||
int pending;
|
|
||||||
|
|
||||||
#region --- Constructors ---
|
#region --- Constructors ---
|
||||||
|
|
||||||
|
@ -37,14 +35,15 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
throw new ArgumentException("A valid parent window must be defined, in order to create an X11Input driver.");
|
throw new ArgumentException("A valid parent window must be defined, in order to create an X11Input driver.");
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
Debug.WriteLine("Creating hidden input window.");
|
Debug.WriteLine("Creating hidden input window.");
|
||||||
|
|
||||||
SetWindowAttributes wnd_attributes = new SetWindowAttributes();
|
SetWindowAttributes wnd_attributes = new SetWindowAttributes();
|
||||||
wnd_attributes.background_pixel = 0;
|
wnd_attributes.background_pixel = 0;
|
||||||
wnd_attributes.border_pixel = 0;
|
wnd_attributes.border_pixel = 0;
|
||||||
wnd_attributes.colormap = IntPtr.Zero;
|
wnd_attributes.colormap = IntPtr.Zero;
|
||||||
wnd_attributes.event_mask = EventMask.KeyPressMask | EventMask.KeyReleaseMask;
|
wnd_attributes.event_mask = EventMask.KeyPressMask | EventMask.KeyReleaseMask |
|
||||||
|
EventMask.FocusChangeMask;
|
||||||
|
|
||||||
CreateWindowMask cw_mask =
|
CreateWindowMask cw_mask =
|
||||||
CreateWindowMask.CWEventMask;
|
CreateWindowMask.CWEventMask;
|
||||||
|
@ -55,10 +54,11 @@ namespace OpenTK.Platform.X11
|
||||||
window.Display,
|
window.Display,
|
||||||
window.Parent.Handle,
|
window.Parent.Handle,
|
||||||
0, 0,
|
0, 0,
|
||||||
0, 0,
|
1, 1,
|
||||||
0, 0,
|
0, 0,
|
||||||
Constants.InputOnly,
|
Constants.InputOnly,
|
||||||
window.VisualInfo.visual,
|
//window.VisualInfo.visual,
|
||||||
|
(IntPtr)0,
|
||||||
cw_mask,
|
cw_mask,
|
||||||
wnd_attributes
|
wnd_attributes
|
||||||
);
|
);
|
||||||
|
@ -69,14 +69,20 @@ namespace OpenTK.Platform.X11
|
||||||
}
|
}
|
||||||
|
|
||||||
API.MapWindow(window.Display, window.Handle);
|
API.MapWindow(window.Display, window.Handle);
|
||||||
|
API.GrabKeyboard(window.Display, window.Handle, false, GrabMode.GrabModeAsync, GrabMode.GrabModeAsync, 0);
|
||||||
|
|
||||||
Debug.WriteLine("done! (id: " + window + ")");
|
Debug.WriteLine("done! (id: " + window + ")");
|
||||||
|
|
||||||
// Select input events to be reported here.
|
// Select input events to be reported here.
|
||||||
//API.SelectInput(window.Display, window.Handle,
|
//API.SelectInput(window.Display, window.Parent.Handle,
|
||||||
// EventMask.KeyReleaseMask | EventMask.KeyPressMask);
|
// EventMask.KeyReleaseMask | EventMask.KeyPressMask);
|
||||||
|
|
||||||
keyboardDriver = new X11Keyboard(window);
|
keyboardDriver = new X11Keyboard(window);
|
||||||
|
*/
|
||||||
|
|
||||||
|
keyboardDriver = new X11Keyboard(parent);
|
||||||
|
API.SelectInput(parent.Display, parent.Handle,
|
||||||
|
EventMask.KeyReleaseMask | EventMask.KeyPressMask);
|
||||||
|
|
||||||
Debug.Unindent();
|
Debug.Unindent();
|
||||||
}
|
}
|
||||||
|
@ -118,29 +124,35 @@ namespace OpenTK.Platform.X11
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ProcessEvents()
|
public void ProcessEvents()
|
||||||
{
|
{
|
||||||
pending = API.Pending(window.Display);
|
try
|
||||||
|
|
||||||
if (pending == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
API.PeekEvent(window.Display, e);
|
|
||||||
Debug.Write(String.Format("Input window received {0} event... ", e.Type.ToString()));
|
|
||||||
|
|
||||||
switch (e.Type)
|
|
||||||
{
|
{
|
||||||
case EventType.KeyPress:
|
while (API.CheckIfEvent(window.Display, ref e, check, IntPtr.Zero))
|
||||||
case EventType.KeyRelease:
|
{
|
||||||
API.NextEvent(window.Display, keyEvent);
|
Debug.Print("Input window received {0} event... ", e.type.ToString());
|
||||||
Debug.WriteLine(" consumed!");
|
keyboardDriver.ProcessKeyboardEvent(e.KeyEvent);
|
||||||
keyboardDriver.ProcessKeyboardEvent(keyEvent);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
API.NextEvent(window.Display, e);
|
|
||||||
Debug.WriteLine(" not consumed.");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Print("DANGER: Possible callback exception: {0}", e.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
API.CheckEventPredicate check = KeyEventPredicate;
|
||||||
|
|
||||||
|
private static bool KeyEventPredicate(IntPtr display, ref XEvent @event, IntPtr arg)
|
||||||
|
{
|
||||||
|
bool ret = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ret = (@event.type == XEventName.KeyRelease || @event.type == XEventName.KeyPress);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Print("DANGER: Exception caught during unmanaged callback: {0}", e.ToString());
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,8 +103,11 @@ namespace OpenTK.Platform.X11
|
||||||
Initialize();
|
Initialize();
|
||||||
|
|
||||||
API.DisplayKeycodes(window.Display, ref firstKeyCode, ref lastKeyCode);
|
API.DisplayKeycodes(window.Display, ref firstKeyCode, ref lastKeyCode);
|
||||||
|
Debug.Print("First keycode: {0}, last {1}", firstKeyCode, lastKeyCode);
|
||||||
|
|
||||||
IntPtr keysym_ptr = API.GetKeyboardMapping(window.Display, (byte)firstKeyCode,
|
IntPtr keysym_ptr = API.GetKeyboardMapping(window.Display, (byte)firstKeyCode,
|
||||||
lastKeyCode - firstKeyCode + 1, ref keysyms_per_keycode);
|
lastKeyCode - firstKeyCode + 1, ref keysyms_per_keycode);
|
||||||
|
Debug.Print("{0} keysyms per keycode.", keysyms_per_keycode);
|
||||||
|
|
||||||
keysyms = new IntPtr[(lastKeyCode - firstKeyCode + 1) * keysyms_per_keycode];
|
keysyms = new IntPtr[(lastKeyCode - firstKeyCode + 1) * keysyms_per_keycode];
|
||||||
Marshal.PtrToStructure(keysym_ptr, keysyms);
|
Marshal.PtrToStructure(keysym_ptr, keysyms);
|
||||||
|
@ -125,11 +128,11 @@ namespace OpenTK.Platform.X11
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="e">The X11.KeyEvent to process</param>
|
/// <param name="e">The X11.KeyEvent to process</param>
|
||||||
/// <returns>True if the event was processed, false otherwise.</returns>
|
/// <returns>True if the event was processed, false otherwise.</returns>
|
||||||
internal bool ProcessKeyboardEvent(X11.KeyEvent e)
|
internal bool ProcessKeyboardEvent(X11.XKeyEvent e)
|
||||||
{
|
{
|
||||||
int keysym = keysyms[(e.keycode - firstKeyCode) * keysyms_per_keycode].ToInt32();
|
int keysym = keysyms[(e.keycode - firstKeyCode) * keysyms_per_keycode].ToInt32();
|
||||||
int keysym2 = keysyms[(e.keycode - firstKeyCode) * keysyms_per_keycode].ToInt32();
|
int keysym2 = keysyms[(e.keycode - firstKeyCode) * keysyms_per_keycode].ToInt32();
|
||||||
bool pressed = e.type == EventType.KeyPress;
|
bool pressed = e.type == XEventName.KeyPress;
|
||||||
|
|
||||||
switch (keysym)
|
switch (keysym)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue