Debugging crash on X11 32bits.

This commit is contained in:
the_fiddler 2007-08-07 20:32:26 +00:00
parent 53f2e4c48f
commit d19466956b
8 changed files with 48 additions and 41 deletions

View file

@ -78,7 +78,7 @@ namespace OpenTK.Platform
/// Constructs a new DisplayMode with default values.
/// </summary>
public DisplayMode()
: this(0, 0, new ColorDepth(32), 0, 0, 0, 0, false, false, false, 0.0f)
: this(0, 0, new ColorDepth(32), 16, 0, 0, 0, false, false, false, 0.0f)
{
}
@ -88,7 +88,7 @@ namespace OpenTK.Platform
/// <param name="width">The Width of the DisplayMode in pixels.</param>
/// <param name="height">The Height of the DisplayMode in pixels.</param>
public DisplayMode(int width, int height)
: this(width, height, new ColorDepth(32), 0, 0, 0, 0, false, false, false, 0.0f)
: this(width, height, new ColorDepth(32), 16, 0, 0, 0, false, false, false, 0.0f)
{
}
@ -199,9 +199,10 @@ namespace OpenTK.Platform
{
return string.Format(
CultureInfo.CurrentCulture,
"{0}x{1}, {2}, {3}Hz",
"{0}x{1}, rgba: {2}, depth: {3}, refresh {4}Hz",
Width, Height,
Color.ToString(),
DepthBits,
RefreshRate
);
}

View file

@ -552,7 +552,7 @@ XF86VidModeGetGammaRampSize(
public override string ToString()
{
// return base.ToString();
return String.Format("VisualInfo: id ({0}), screen ({1}), depth ({2}), class ({3})",
return String.Format("id ({0}), screen ({1}), depth ({2}), class ({3})",
visualid, screen, depth, @class);
}
}

View file

@ -305,15 +305,12 @@ namespace OpenTK.Platform.X11
internal static IntPtr ChooseVisual(IntPtr dpy, int screen, int[] attriblist)
{
GCHandle h0 = GCHandle.Alloc(attriblist, GCHandleType.Pinned);
try
unsafe
{
return ChooseVisual(dpy, screen, h0.AddrOfPinnedObject());
fixed (int* attriblist_ptr = attriblist)
{
return ChooseVisual(dpy, screen, (IntPtr)attriblist_ptr);
}
finally
{
h0.Free();
}
}

View file

@ -834,7 +834,7 @@ namespace OpenTK.Platform.X11
}
[Flags]
internal enum EventMask : long
internal enum EventMask
{
NoEventMask = 0,
KeyPressMask = 1 << 0,

View file

@ -10,7 +10,11 @@ namespace OpenTK.Platform.X11
/// </summary>
internal class WindowInfo : IWindowInfo
{
internal WindowInfo() { }
internal WindowInfo()
{
visinfo = new VisualInfo();
}
internal WindowInfo(WindowInfo parent)
{
this.TopLevelWindow = parent.TopLevelWindow;

View file

@ -187,7 +187,7 @@ namespace OpenTK.Platform.X11
{
Debug.WriteLine("Creating visual.");
Debug.Indent();
/*
ColorDepth color = new ColorDepth(24);
int depthBits = 16;
@ -206,9 +206,14 @@ namespace OpenTK.Platform.X11
visualAttributes.Add((int)depthBits);
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
visualAttributes.Add((int)Glx.Enums.GLXAttribute.NONE);
*/
Debug.Print("Requesting visual: {0}... ", mode.ToString());
/*
Debug.Print("Requesting DisplayMode: {0}. ", mode.ToString());
// Hack; Temp workaround for invalid depth of 24
if (mode.DepthBits == 24)
{
mode.DepthBits = 16;
Debug.WriteLine("Temporary workaround applied: depth changed to 16.");
}
List<int> visualAttributes = new List<int>();
visualAttributes.Add((int)Glx.Enums.GLXAttribute.RGBA);
@ -224,18 +229,18 @@ namespace OpenTK.Platform.X11
visualAttributes.Add((int)mode.DepthBits);
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
visualAttributes.Add((int)Glx.Enums.GLXAttribute.NONE);
*/
visual = Glx.ChooseVisual(windowInfo.Display, windowInfo.Screen, visualAttributes.ToArray());
if (visual == IntPtr.Zero)
{
throw new Exception("Requested visual not available.");
throw new ApplicationException("Requested mode not available.");
}
visualInfo = (VisualInfo)Marshal.PtrToStructure(visual, typeof(VisualInfo));
Debug.Print("Got visual: {0}", visualInfo.ToString());
windowInfo.VisualInfo = (VisualInfo)Marshal.PtrToStructure(visual, typeof(VisualInfo));
Debug.Print("Got visual: {0}", windowInfo.VisualInfo.ToString());
Debug.Unindent();
return visualInfo;
return windowInfo.VisualInfo;
}
#endregion
@ -247,7 +252,7 @@ namespace OpenTK.Platform.X11
internal VisualInfo XVisualInfo
{
get { return this.visualInfo; }
get { return windowInfo.VisualInfo; }
}
internal IntPtr XColormap

View file

@ -250,20 +250,20 @@ namespace OpenTK.Platform.X11
Debug.Write("Creating output window... ");
XSetWindowAttributes attributes = new XSetWindowAttributes();
attributes.colormap = glContext.colormap;
//attributes.colormap = glContext.colormap;
attributes.event_mask = (IntPtr)(EventMask.StructureNotifyMask |
EventMask.SubstructureNotifyMask | EventMask.ExposureMask);
SetWindowValuemask mask = SetWindowValuemask.ColorMap | SetWindowValuemask.EventMask;
uint mask = (uint)SetWindowValuemask.ColorMap | (uint)SetWindowValuemask.EventMask;
window.Handle = Functions.XCreateWindow(window.Display, window.RootWindow,
0, 0, mode.Width, mode.Height, 0, glContext.XVisualInfo.depth,
(int)CreateWindowArgs.InputOutput, glContext.XVisualInfo.visual, (UIntPtr)mask,
window.Handle = Functions.XCreateWindow(window.Display, /*window.RootWindow*/0,
0, 0, mode.Width, mode.Height, 0, /*window.VisualInfo.depth*/(int)CreateWindowArgs.CopyFromParent,
(int)CreateWindowArgs.InputOutput, window.VisualInfo.visual, (UIntPtr)mask,
ref attributes);
if (window.Handle == IntPtr.Zero)
{
throw new Exception("Could not create window.");
throw new ApplicationException("Could not create window.");
}
/*
// Set the window hints