diff --git a/OpenTK/Platform/Windows/WinGLNative.cs b/OpenTK/Platform/Windows/WinGLNative.cs index 630cdceed..bdec8344d 100644 --- a/OpenTK/Platform/Windows/WinGLNative.cs +++ b/OpenTK/Platform/Windows/WinGLNative.cs @@ -47,7 +47,7 @@ namespace OpenTK.Platform.Windows readonly WindowProcedure WindowProcedureDelegate; bool class_registered, disposed, exists; - WinWindowInfo window; + WinWindowInfo window, child_window; WindowState windowState = WindowState.Normal; bool focused; bool mouse_outside_window = true; @@ -66,8 +66,13 @@ namespace OpenTK.Platform.Windows public WinGLNative(int x, int y, int width, int height, string title, GameWindowFlags options, DisplayDevice device) { WindowProcedureDelegate = WindowProcedure; + // To avoid issues with Ati drivers on Windows 6+ with compositing enabled, the context will not be + // bound to the top-level window, but rather to a child window docked in the parent. window = new WinWindowInfo( CreateWindow(x, y, width, height, title, options, device, IntPtr.Zero), null); + child_window = new WinWindowInfo( + CreateWindow(0, 0, ClientSize.Width, ClientSize.Height, title, options, device, window.WindowHandle), window); + exists = true; } @@ -117,7 +122,7 @@ namespace OpenTK.Platform.Windows API.GetClientRect(handle, out rect); client_rectangle = rect.ToRectangle(); - API.SetWindowPos(window.WindowHandle, IntPtr.Zero, 0, 0, ClientRectangle.Width, ClientRectangle.Height, + API.SetWindowPos(child_window.WindowHandle, IntPtr.Zero, 0, 0, ClientRectangle.Width, ClientRectangle.Height, SetWindowPosFlags.NOZORDER | SetWindowPosFlags.NOOWNERZORDER | SetWindowPosFlags.NOACTIVATE | SetWindowPosFlags.NOSENDCHANGING); if (suppress_resize <= 0 && Resize != null) @@ -348,6 +353,7 @@ namespace OpenTK.Platform.Windows API.UnregisterClass(ClassName, Instance); window.Dispose(); + child_window.Dispose(); if (Closed != null) Closed(this, EventArgs.Empty); @@ -362,7 +368,7 @@ namespace OpenTK.Platform.Windows private void EnableMouseTracking() { TrackMouseEventStructure me = new TrackMouseEventStructure(); me.Size = TrackMouseEventStructure.SizeInBytes; - me.TrackWindowHandle = window.WindowHandle; + me.TrackWindowHandle = child_window.WindowHandle; me.Flags = TrackMouseEventFlags.LEAVE; if (!API.TrackMouseEvent(ref me)) @@ -688,7 +694,7 @@ namespace OpenTK.Platform.Windows } public IWindowInfo WindowInfo { - get { return window; } + get { return child_window; } } public KeyboardDevice Keyboard {