mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 18:45:34 +00:00
Restore previous window size when leaving fullscreen mode.
This commit is contained in:
parent
a98c1f9ae2
commit
6ffe87813a
|
@ -62,8 +62,10 @@ namespace OpenTK.Platform.Windows
|
||||||
WindowBorder windowBorder = WindowBorder.Resizable, previous_window_border;
|
WindowBorder windowBorder = WindowBorder.Resizable, previous_window_border;
|
||||||
WindowState windowState = WindowState.Normal;
|
WindowState windowState = WindowState.Normal;
|
||||||
|
|
||||||
System.Drawing.Rectangle bounds = new System.Drawing.Rectangle();
|
System.Drawing.Rectangle
|
||||||
System.Drawing.Rectangle client_rectangle = new System.Drawing.Rectangle();
|
bounds = new System.Drawing.Rectangle(),
|
||||||
|
client_rectangle = new System.Drawing.Rectangle(),
|
||||||
|
previous_bounds = new System.Drawing.Rectangle(); // Used to restore previous size when leaving fullscreen mode.
|
||||||
Icon icon;
|
Icon icon;
|
||||||
|
|
||||||
static readonly ClassStyle ClassStyle =
|
static readonly ClassStyle ClassStyle =
|
||||||
|
@ -835,6 +837,7 @@ namespace OpenTK.Platform.Windows
|
||||||
// previous_window_border == Hidden.
|
// previous_window_border == Hidden.
|
||||||
// After the trick, we store the 'real' previous border, to allow state changes to work
|
// After the trick, we store the 'real' previous border, to allow state changes to work
|
||||||
// as expected.
|
// as expected.
|
||||||
|
previous_bounds = Bounds;
|
||||||
WindowBorder temp = WindowBorder;
|
WindowBorder temp = WindowBorder;
|
||||||
previous_window_border = WindowBorder.Hidden;
|
previous_window_border = WindowBorder.Hidden;
|
||||||
WindowBorder = WindowBorder.Hidden;
|
WindowBorder = WindowBorder.Hidden;
|
||||||
|
@ -848,6 +851,14 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
if (command != 0)
|
if (command != 0)
|
||||||
Functions.ShowWindow(window.WindowHandle, command);
|
Functions.ShowWindow(window.WindowHandle, command);
|
||||||
|
|
||||||
|
// Restore previous window size when leaving fullscreen mode
|
||||||
|
if (command == ShowWindowCommand.RESTORE &&
|
||||||
|
previous_bounds != System.Drawing.Rectangle.Empty)
|
||||||
|
{
|
||||||
|
Bounds = previous_bounds;
|
||||||
|
previous_bounds = System.Drawing.Rectangle.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue