Corrected the OnCreate infinite loop between X11GLNative and X11Input.

This commit is contained in:
the_fiddler 2007-08-05 17:54:11 +00:00
parent ad97683c80
commit 22c3eb187f
3 changed files with 329 additions and 327 deletions

View file

@ -49,13 +49,15 @@ namespace OpenTK
}
glWindow.Resize += new ResizeEvent(glWindow_Resize);
glWindow.Create += new CreateEvent(glWindow_Create);
glWindow.Create += new CreateEvent(glWindow_CreateInputDriver);
}
void glWindow_Create(object sender, EventArgs e)
void glWindow_CreateInputDriver(object sender, EventArgs e)
{
//glWindow.Context.MakeCurrent();
driver = new InputDriver(this.WindowInfo);
glWindow.Create -= glWindow_CreateInputDriver;
this.OnCreate(e);
}

View file

@ -63,10 +63,13 @@ namespace OpenTK.Platform.X11
Display display,
Window parent,
int x, int y,
uint width, uint height,
uint border_width,
//uint width, uint height,
int width, int height,
//uint border_width,
int border_width,
int depth,
uint @class,
//uint @class,
int @class,
IntPtr visual,
[MarshalAs(UnmanagedType.SysUInt)] CreateWindowMask valuemask,
SetWindowAttributes attributes

View file

@ -124,7 +124,7 @@ namespace OpenTK.Platform.X11
info.Display,
info.RootWindow,
0, 0,
640, 480,
mode.Width, mode.Height,
0,
//glxVisualInfo.depth,
glContext.XVisualInfo.depth,
@ -226,19 +226,15 @@ namespace OpenTK.Platform.X11
{
case EventType.ReparentNotify:
API.NextEvent(info.Display, reparent);
// Do nothing
// TODO: Is there a more suitable place to raise the Create event?
// ReparentNotify seems to be the first event raised on window creation.
this.OnCreate(EventArgs.Empty);
break;
case EventType.CreateNotify:
API.NextEvent(info.Display, createWindow);
// Set window width/height
mode.Width = createWindow.width;
mode.Height = createWindow.height;
this.OnCreate(EventArgs.Empty);
Debug.WriteLine(
String.Format("OnCreate fired: {0}x{1}", mode.Width, mode.Height)
);
// A child was created - nothing to do
break;
case EventType.DestroyNotify:
@ -288,6 +284,7 @@ namespace OpenTK.Platform.X11
if (this.Create != null)
{
this.Create(this, e);
Debug.Print("OnCreate fired, from window: {0}", info.ToString());
}
}