| Summary: | Main thread gets stuck on left mouse down | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Amruth Raj <amruthraj.p> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P1 | CC: | ewasylishen |
| Version: | HG 2.1 | ||
| Hardware: | x86 | ||
| OS: | Other | ||
| Attachments: |
Fix
Fix exiting fullscreen desktop |
||
|
Description
Amruth Raj
2017-07-07 07:21:24 UTC
I am increasing the priority since it is a very common use case and it easily repros. Once reproduced, it makes the application stop rendering anything on screen. Here is my patch where I verified the issue no longer occurs:
diff -r 9dda3f3e9794 src/video/cocoa/SDL_cocoawindow.m
--- a/src/video/cocoa/SDL_cocoawindow.m Wed Jul 05 12:04:37 2017 -0400
+++ b/src/video/cocoa/SDL_cocoawindow.m Fri Jul 07 15:08:16 2017 +0530
@@ -674,6 +674,7 @@
pendingWindowOperation = PENDING_OPERATION_NONE;
[self setFullscreenSpace:NO];
} else {
+ SetWindowStyle(window, 0);
if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) {
[NSMenu setMenuBarVisible:NO];
}
Created attachment 2793 [details]
Fix
Fixed, thanks! https://hg.libsdl.org/SDL/rev/81e6d0f852fc (In reply to Sam Lantinga from comment #4) > Fixed, thanks! > https://hg.libsdl.org/SDL/rev/81e6d0f852fc Unfortunately this commit seems to have broken exiting desktop-fullscreen. - Launch testgl2. - Press alt+enter to go fullscreen-desktop - Press alt+enter again. The spinning cube will freeze, and the window stays fullscreen desktop. Problem is that the main thread gets stuck in Cocoa_SetWindowFullscreenSpace for 30 seconds while coming out of full screen. This is happening because NSWindowWillExitFullScreenNotification fails to come after resizable: false flag is set. I tried explicitly setting this flag before doing toggleFullscreen and a few other places, but that didn't help. I am unsure why the WillExit notification itself cannot come. Created attachment 2815 [details] Fix exiting fullscreen desktop I think I found a better fix. The problem with https://hg.libsdl.org/SDL/rev/81e6d0f852fc is setting the styleMask to 0 clears the NSWindowStyleMaskFullScreen bit, which then confuses Cocoa later when you try to leave fullscreen. Instead I'm just clearing the NSWindowStyleMaskResizable bit, although SetWindowStyle(window, NSWindowStyleMaskFullScreen); seems to also work. This is in, thanks! https://hg.libsdl.org/SDL/rev/6709dc9adb16 |