Added debug information to XOpenDisplay etc calls.

This commit is contained in:
the_fiddler 2008-01-25 13:42:51 +00:00
parent a62e0fb6a6
commit 9d1316c51d

View file

@ -38,6 +38,7 @@ namespace OpenTK.Platform.X11
using Rotation = System.UInt16; using Rotation = System.UInt16;
using Status = System.Int32; using Status = System.Int32;
using SizeID = System.UInt16; using SizeID = System.UInt16;
using System.Diagnostics;
#endregion #endregion
@ -47,10 +48,10 @@ namespace OpenTK.Platform.X11
{ {
#region --- Fields --- #region --- Fields ---
static Display defaultDisplay = Functions.XOpenDisplay(IntPtr.Zero); static Display defaultDisplay;
static int defaultScreen = Functions.XDefaultScreen(defaultDisplay); static int defaultScreen;
static Window rootWindow = Functions.XRootWindow(defaultDisplay, defaultScreen); static Window rootWindow;
static int screenCount = Functions.XScreenCount(defaultDisplay); static int screenCount;
internal static Display DefaultDisplay { get { return defaultDisplay; } } internal static Display DefaultDisplay { get { return defaultDisplay; } }
internal static int DefaultScreen { get { return defaultScreen; } } internal static int DefaultScreen { get { return defaultScreen; } }
@ -62,13 +63,17 @@ namespace OpenTK.Platform.X11
static API() static API()
{ {
AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit); AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
defaultDisplay = Functions.XOpenDisplay(IntPtr.Zero);
defaultScreen = Functions.XDefaultScreen(DefaultDisplay);
rootWindow = Functions.XRootWindow(DefaultDisplay, DefaultScreen);
screenCount = Functions.XScreenCount(DefaultDisplay);
Debug.Print("Default Display: {0}, Default Screen: {1}, Default Root Window: {2}, Screen Count: {3}",
DefaultDisplay, DefaultScreen, RootWindow, ScreenCount);
} }
static void CurrentDomain_ProcessExit(object sender, EventArgs e) static void CurrentDomain_ProcessExit(object sender, EventArgs e)
{ {
if (defaultDisplay != IntPtr.Zero) { Functions.XCloseDisplay(defaultDisplay); defaultDisplay = IntPtr.Zero; } if (defaultDisplay != IntPtr.Zero) { Functions.XCloseDisplay(defaultDisplay); defaultDisplay = IntPtr.Zero; }
if (defaultDisplay != IntPtr.Zero) { Functions.XCloseDisplay(defaultDisplay); defaultDisplay = IntPtr.Zero; }
if (defaultDisplay != IntPtr.Zero) { Functions.XCloseDisplay(defaultDisplay); defaultDisplay = IntPtr.Zero; }
} }
private const string _dll_name = "libX11"; private const string _dll_name = "libX11";