mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-24 10:51:08 +00:00
Merge pull request #598 from ppy/no-child-window
Remove child_window to support exclusive full screen in more scenarios
This commit is contained in:
commit
bde5badee9
|
@ -55,7 +55,7 @@ namespace OpenTK.Platform.Windows
|
||||||
private bool class_registered;
|
private bool class_registered;
|
||||||
private bool disposed;
|
private bool disposed;
|
||||||
private bool exists;
|
private bool exists;
|
||||||
private WinWindowInfo window, child_window;
|
private WinWindowInfo window;
|
||||||
private WindowBorder windowBorder = WindowBorder.Resizable;
|
private WindowBorder windowBorder = WindowBorder.Resizable;
|
||||||
private Nullable<WindowBorder> previous_window_border; // Set when changing to fullscreen state.
|
private Nullable<WindowBorder> previous_window_border; // Set when changing to fullscreen state.
|
||||||
private Nullable<WindowBorder> deferred_window_border; // Set to avoid changing borders during fullscreen state.
|
private Nullable<WindowBorder> deferred_window_border; // Set to avoid changing borders during fullscreen state.
|
||||||
|
@ -128,18 +128,11 @@ namespace OpenTK.Platform.Windows
|
||||||
scale_y = ScaleY(y);
|
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(
|
window = new WinWindowInfo(
|
||||||
CreateWindow(
|
CreateWindow(
|
||||||
scale_x, scale_y, scale_width, scale_height,
|
scale_x, scale_y, scale_width, scale_height,
|
||||||
title, options, device, IntPtr.Zero),
|
title, options, device, IntPtr.Zero),
|
||||||
null);
|
null);
|
||||||
child_window = new WinWindowInfo(
|
|
||||||
CreateWindow(
|
|
||||||
0, 0, ClientSize.Width, ClientSize.Height,
|
|
||||||
title, options, device, window.Handle),
|
|
||||||
window);
|
|
||||||
Functions.DragAcceptFiles(window.Handle, true);
|
Functions.DragAcceptFiles(window.Handle, true);
|
||||||
|
|
||||||
exists = true;
|
exists = true;
|
||||||
|
@ -276,7 +269,7 @@ namespace OpenTK.Platform.Windows
|
||||||
Functions.GetClientRect(handle, out rect);
|
Functions.GetClientRect(handle, out rect);
|
||||||
client_rectangle = rect.ToRectangle();
|
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.NOZORDER | SetWindowPosFlags.NOOWNERZORDER |
|
||||||
SetWindowPosFlags.NOACTIVATE | SetWindowPosFlags.NOSENDCHANGING);
|
SetWindowPosFlags.NOACTIVATE | SetWindowPosFlags.NOSENDCHANGING);
|
||||||
|
|
||||||
|
@ -535,7 +528,7 @@ namespace OpenTK.Platform.Windows
|
||||||
{
|
{
|
||||||
// If the mouse is captured we get spurious MOUSELEAVE events.
|
// If the mouse is captured we get spurious MOUSELEAVE events.
|
||||||
// So ignore WM_MOUSELEAVE if capture count != 0.
|
// So ignore WM_MOUSELEAVE if capture count != 0.
|
||||||
if (mouse_capture_count == 0 )
|
if (mouse_capture_count == 0)
|
||||||
{
|
{
|
||||||
mouse_outside_window = true;
|
mouse_outside_window = true;
|
||||||
// Mouse tracking is disabled automatically by the OS
|
// Mouse tracking is disabled automatically by the OS
|
||||||
|
@ -688,7 +681,6 @@ namespace OpenTK.Platform.Windows
|
||||||
Functions.UnregisterClass(ClassName, Instance);
|
Functions.UnregisterClass(ClassName, Instance);
|
||||||
}
|
}
|
||||||
window.Dispose();
|
window.Dispose();
|
||||||
child_window.Dispose();
|
|
||||||
|
|
||||||
OnClosed(EventArgs.Empty);
|
OnClosed(EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
@ -855,7 +847,7 @@ namespace OpenTK.Platform.Windows
|
||||||
{
|
{
|
||||||
if (mouse_capture_count == 0)
|
if (mouse_capture_count == 0)
|
||||||
{
|
{
|
||||||
Functions.SetCapture(child_window.Handle);
|
Functions.SetCapture(window.Handle);
|
||||||
}
|
}
|
||||||
mouse_capture_count++;
|
mouse_capture_count++;
|
||||||
}
|
}
|
||||||
|
@ -875,7 +867,7 @@ namespace OpenTK.Platform.Windows
|
||||||
{
|
{
|
||||||
TrackMouseEventStructure me = new TrackMouseEventStructure();
|
TrackMouseEventStructure me = new TrackMouseEventStructure();
|
||||||
me.Size = TrackMouseEventStructure.SizeInBytes;
|
me.Size = TrackMouseEventStructure.SizeInBytes;
|
||||||
me.TrackWindowHandle = child_window.Handle;
|
me.TrackWindowHandle = window.Handle;
|
||||||
me.Flags = TrackMouseEventFlags.LEAVE;
|
me.Flags = TrackMouseEventFlags.LEAVE;
|
||||||
|
|
||||||
if (!Functions.TrackMouseEvent(ref me))
|
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
|
public override MouseCursor Cursor
|
||||||
{
|
{
|
||||||
|
@ -1441,7 +1433,7 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
// Make sure client size doesn't change when changing the border style.
|
// Make sure client size doesn't change when changing the border style.
|
||||||
Size client_size = ClientSize;
|
Size client_size = ClientSize;
|
||||||
Win32Rectangle rect = Win32Rectangle.From(client_size);
|
Win32Rectangle rect = Win32Rectangle.From(bounds);
|
||||||
Functions.AdjustWindowRectEx(ref rect, new_style, false, ParentStyleEx);
|
Functions.AdjustWindowRectEx(ref rect, new_style, false, ParentStyleEx);
|
||||||
|
|
||||||
// This avoids leaving garbage on the background window.
|
// This avoids leaving garbage on the background window.
|
||||||
|
@ -1522,7 +1514,7 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
public override IWindowInfo WindowInfo
|
public override IWindowInfo WindowInfo
|
||||||
{
|
{
|
||||||
get { return child_window; }
|
get { return window; }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool calledManually)
|
protected override void Dispose(bool calledManually)
|
||||||
|
|
Loading…
Reference in a new issue