From 950cef3eaedc52c9da7e72c4c7f0716e80e46acf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Jul 2017 11:37:16 +0900 Subject: [PATCH] Remove child_window to support exclusive full screen in more scenarios --- src/OpenTK/Platform/Windows/WinGLNative.cs | 24 ++++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/OpenTK/Platform/Windows/WinGLNative.cs b/src/OpenTK/Platform/Windows/WinGLNative.cs index af9aa37f..79d30b5a 100644 --- a/src/OpenTK/Platform/Windows/WinGLNative.cs +++ b/src/OpenTK/Platform/Windows/WinGLNative.cs @@ -55,7 +55,7 @@ namespace OpenTK.Platform.Windows private bool class_registered; private bool disposed; private bool exists; - private WinWindowInfo window, child_window; + private WinWindowInfo window; private WindowBorder windowBorder = WindowBorder.Resizable; private Nullable previous_window_border; // Set when changing to fullscreen state. private Nullable deferred_window_border; // Set to avoid changing borders during fullscreen state. @@ -128,18 +128,11 @@ namespace OpenTK.Platform.Windows scale_y = ScaleY(y); } - // 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( scale_x, scale_y, scale_width, scale_height, title, options, device, IntPtr.Zero), null); - child_window = new WinWindowInfo( - CreateWindow( - 0, 0, ClientSize.Width, ClientSize.Height, - title, options, device, window.Handle), - window); Functions.DragAcceptFiles(window.Handle, true); exists = true; @@ -276,7 +269,7 @@ namespace OpenTK.Platform.Windows Functions.GetClientRect(handle, out rect); client_rectangle = rect.ToRectangle(); - Functions.SetWindowPos(child_window.Handle, IntPtr.Zero, 0, 0, ClientRectangle.Width, ClientRectangle.Height, + Functions.SetWindowPos(window.Handle, IntPtr.Zero, bounds.X, bounds.Y, bounds.Width, bounds.Height, SetWindowPosFlags.NOZORDER | SetWindowPosFlags.NOOWNERZORDER | SetWindowPosFlags.NOACTIVATE | SetWindowPosFlags.NOSENDCHANGING); @@ -535,7 +528,7 @@ namespace OpenTK.Platform.Windows { // If the mouse is captured we get spurious MOUSELEAVE events. // So ignore WM_MOUSELEAVE if capture count != 0. - if (mouse_capture_count == 0 ) + if (mouse_capture_count == 0) { mouse_outside_window = true; // Mouse tracking is disabled automatically by the OS @@ -688,7 +681,6 @@ namespace OpenTK.Platform.Windows Functions.UnregisterClass(ClassName, Instance); } window.Dispose(); - child_window.Dispose(); OnClosed(EventArgs.Empty); } @@ -855,7 +847,7 @@ namespace OpenTK.Platform.Windows { if (mouse_capture_count == 0) { - Functions.SetCapture(child_window.Handle); + Functions.SetCapture(window.Handle); } mouse_capture_count++; } @@ -875,7 +867,7 @@ namespace OpenTK.Platform.Windows { TrackMouseEventStructure me = new TrackMouseEventStructure(); me.Size = TrackMouseEventStructure.SizeInBytes; - me.TrackWindowHandle = child_window.Handle; + me.TrackWindowHandle = window.Handle; me.Flags = TrackMouseEventFlags.LEAVE; if (!Functions.TrackMouseEvent(ref me)) @@ -1161,7 +1153,7 @@ namespace OpenTK.Platform.Windows } } - public override bool Exists { get { return exists; } } + public override bool Exists { get { return exists; } } public override MouseCursor Cursor { @@ -1441,7 +1433,7 @@ namespace OpenTK.Platform.Windows // Make sure client size doesn't change when changing the border style. Size client_size = ClientSize; - Win32Rectangle rect = Win32Rectangle.From(client_size); + Win32Rectangle rect = Win32Rectangle.From(bounds); Functions.AdjustWindowRectEx(ref rect, new_style, false, ParentStyleEx); // This avoids leaving garbage on the background window. @@ -1522,7 +1514,7 @@ namespace OpenTK.Platform.Windows public override IWindowInfo WindowInfo { - get { return child_window; } + get { return window; } } protected override void Dispose(bool calledManually)