Hack to fix missing window decorations after toggling fullscreen mode in Mac OS X 10.10
authorSam Lantinga <slouken@libsdl.org>
Tue, 30 Jun 2015 19:30:02 -0700
changeset 9790 d968c87f2a5d
parent 9789 137993bad5c7
child 9791 bf1504455f2a
Hack to fix missing window decorations after toggling fullscreen mode in Mac OS X 10.10
src/video/cocoa/SDL_cocoawindow.m
--- a/src/video/cocoa/SDL_cocoawindow.m	Tue Jun 30 15:00:48 2015 -0400
+++ b/src/video/cocoa/SDL_cocoawindow.m	Tue Jun 30 19:30:02 2015 -0700
@@ -1456,6 +1456,11 @@
 
         if ([nswindow respondsToSelector: @selector(setStyleMask:)]) {
             [nswindow performSelector: @selector(setStyleMask:) withObject: (id)(uintptr_t)GetWindowStyle(window)];
+
+            /* Hack to restore window decorations on Mac OS X 10.10 */
+            NSRect frameRect = [nswindow frame];
+            [nswindow setFrame:NSMakeRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width + 1, frameRect.size.height) display:NO];
+            [nswindow setFrame:frameRect display:NO];
         } else {
             nswindow = Cocoa_RebuildWindow(data, nswindow, GetWindowStyle(window));
         }