mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-09 14:05:29 +00:00
Merge pull request #597 from ppy/fix-white-flash
Fix white flash when starting GameWindow based application on windows
This commit is contained in:
commit
302ec5001a
|
@ -1421,9 +1421,8 @@ namespace OpenTK.Platform.Windows
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
[DllImport("gdi32.dll", SetLastError = true)]
|
||||
internal static extern IntPtr GetStockObject(int index);
|
||||
internal static extern IntPtr GetStockObject(StockObjects fnObject);
|
||||
|
||||
[DllImport("gdi32.dll", SetLastError = true)]
|
||||
internal static extern BOOL DeleteObject([In]IntPtr hObject);
|
||||
|
@ -3944,6 +3943,33 @@ namespace OpenTK.Platform.Windows
|
|||
Baltic = 186,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identifiers for the GetStockObject method.
|
||||
/// </summary>
|
||||
internal enum StockObjects
|
||||
{
|
||||
WHITE_BRUSH = 0,
|
||||
LTGRAY_BRUSH = 1,
|
||||
GRAY_BRUSH = 2,
|
||||
DKGRAY_BRUSH = 3,
|
||||
BLACK_BRUSH = 4,
|
||||
NULL_BRUSH = 5,
|
||||
HOLLOW_BRUSH = NULL_BRUSH,
|
||||
WHITE_PEN = 6,
|
||||
BLACK_PEN = 7,
|
||||
NULL_PEN = 8,
|
||||
OEM_FIXED_FONT = 10,
|
||||
ANSI_FIXED_FONT = 11,
|
||||
ANSI_VAR_FONT = 12,
|
||||
SYSTEM_FONT = 13,
|
||||
DEVICE_DEFAULT_FONT = 14,
|
||||
DEFAULT_PALETTE = 15,
|
||||
SYSTEM_FIXED_FONT = 16,
|
||||
DEFAULT_GUI_FONT = 17,
|
||||
DC_BRUSH = 18,
|
||||
DC_PEN = 19,
|
||||
}
|
||||
|
||||
internal enum MapVirtualKeyType
|
||||
{
|
||||
/// <summary>uCode is a virtual-key code and is translated into a scan code. If it is a virtual-key code that does not distinguish between left- and right-hand keys, the left-hand scan code is returned. If there is no translation, the function returns 0.</summary>
|
||||
|
|
|
@ -727,7 +727,9 @@ namespace OpenTK.Platform.Windows
|
|||
break;
|
||||
|
||||
case WindowMessage.ERASEBKGND:
|
||||
return new IntPtr(1);
|
||||
// This is triggered only when the client area changes.
|
||||
// As such it does not affect steady-state performance.
|
||||
break;
|
||||
|
||||
case WindowMessage.WINDOWPOSCHANGED:
|
||||
HandleWindowPositionChanged(handle, message, wParam, lParam);
|
||||
|
@ -934,6 +936,8 @@ namespace OpenTK.Platform.Windows
|
|||
{
|
||||
ExtendedWindowClass wc = new ExtendedWindowClass();
|
||||
wc.Size = ExtendedWindowClass.SizeInBytes;
|
||||
// Setting the background here ensures the window doesn't flash gray/white until the first frame is rendered.
|
||||
wc.Background = Functions.GetStockObject(StockObjects.BLACK_BRUSH);
|
||||
wc.Style = DefaultClassStyle;
|
||||
wc.Instance = Instance;
|
||||
wc.WndProc = WindowProcedureDelegate;
|
||||
|
|
Loading…
Reference in a new issue