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.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(); //glWindow.Context.MakeCurrent();
driver = new InputDriver(this.WindowInfo); driver = new InputDriver(this.WindowInfo);
glWindow.Create -= glWindow_CreateInputDriver;
this.OnCreate(e); this.OnCreate(e);
} }

View file

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

View file

@ -124,7 +124,7 @@ namespace OpenTK.Platform.X11
info.Display, info.Display,
info.RootWindow, info.RootWindow,
0, 0, 0, 0,
640, 480, mode.Width, mode.Height,
0, 0,
//glxVisualInfo.depth, //glxVisualInfo.depth,
glContext.XVisualInfo.depth, glContext.XVisualInfo.depth,
@ -226,19 +226,15 @@ namespace OpenTK.Platform.X11
{ {
case EventType.ReparentNotify: case EventType.ReparentNotify:
API.NextEvent(info.Display, reparent); 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; break;
case EventType.CreateNotify: case EventType.CreateNotify:
API.NextEvent(info.Display, createWindow); API.NextEvent(info.Display, createWindow);
// A child was created - nothing to do
// 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)
);
break; break;
case EventType.DestroyNotify: case EventType.DestroyNotify:
@ -288,6 +284,7 @@ namespace OpenTK.Platform.X11
if (this.Create != null) if (this.Create != null)
{ {
this.Create(this, e); this.Create(this, e);
Debug.Print("OnCreate fired, from window: {0}", info.ToString());
} }
} }