Skip to content

Commit 84f49ca

Browse files
authored
Merge pull request opentk#1769 from NogginBops/fix-macos
Fix starting window hidden on macos
2 parents 540c454 + a411b37 commit 84f49ca

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/OpenTK.Windowing.Desktop/NativeWindow.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,18 @@ public unsafe NativeWindow(NativeWindowSettings settings)
998998
InitialiseJoystickStates();
999999

10001000
_isFocused = settings.StartFocused;
1001-
if (settings.StartFocused)
1001+
// Workaround for glfw issue: https://github.com/glfw/glfw/issues/1300
1002+
// where glfwFocusWindow makes the window visible on macOS even without calling glfwShowWindow.
1003+
// This is here to make sure the window actually starts hidden.
1004+
// - Noggin_bops 2024-11-25
1005+
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
1006+
{
1007+
if (_isVisible == false)
1008+
{
1009+
_isFocused = false;
1010+
}
1011+
}
1012+
if (_isFocused)
10021013
{
10031014
Focus();
10041015
}

0 commit comments

Comments
 (0)