Cocoa: Fix window title being lost when untitled

The window title was lost and could not be updated while the window did
not have NSWindowStyleMaskTitled set.

Fixes #1082.
This commit is contained in:
Camilla Löwy 2017-09-28 18:44:04 +02:00
parent da68ec56c3
commit 5aeb37d1b8
2 changed files with 9 additions and 1 deletions

View File

@ -237,6 +237,7 @@ information on what to include when reporting a bug.
- [Cocoa] Bugfix: A hidden or disabled cursor would become visible when a user - [Cocoa] Bugfix: A hidden or disabled cursor would become visible when a user
notification was shown (#971,#1028) notification was shown (#971,#1028)
- [Cocoa] Bugfix: Some characters did not repeat due to Press and Hold (#1010) - [Cocoa] Bugfix: Some characters did not repeat due to Press and Hold (#1010)
- [Cocoa] Bugfix: Window title was lost when full screen or undecorated (#1082)
- [WGL] Added support for `WGL_EXT_colorspace` for OpenGL ES contexts - [WGL] Added support for `WGL_EXT_colorspace` for OpenGL ES contexts
- [WGL] Added support for `WGL_ARB_create_context_no_error` - [WGL] Added support for `WGL_ARB_create_context_no_error`
- [GLX] Added support for `GLX_ARB_create_context_no_error` - [GLX] Added support for `GLX_ARB_create_context_no_error`

View File

@ -1182,7 +1182,11 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char *title) void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char *title)
{ {
[window->ns.object setTitle:[NSString stringWithUTF8String:title]]; NSString* string = [NSString stringWithUTF8String:title];
[window->ns.object setTitle:string];
// HACK: Set the miniwindow title explicitly as setTitle: doesn't update it
// if the window lacks NSWindowStyleMaskTitled
[window->ns.object setMiniwindowTitle:string];
} }
void _glfwPlatformSetWindowIcon(_GLFWwindow* window, void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
@ -1427,6 +1431,9 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
[window->ns.object setLevel:NSNormalWindowLevel]; [window->ns.object setLevel:NSNormalWindowLevel];
[window->ns.object setHasShadow:YES]; [window->ns.object setHasShadow:YES];
// HACK: Clearing NSWindowStyleMaskTitled resets and disables the window
// title property but the miniwindow title property is unaffected
[window->ns.object setTitle:[window->ns.object miniwindowTitle]];
} }
} }