SDL/src/video
Sam Lantinga 37722d01a8 Fixed bug 3697 - Main thread gets stuck on left mouse down
Amruth Raj

- My app runs in full screen to play video(I use SDL_WINDOW_FULLSCREEN_DESKTOP)
- Cmd-tab to go out of full screen to another app
- Cmd-tab again to get back to my app
- Press left mouse button at one of the edges of the screen, don't release yet.
After this point the main thread is stuck until I release the left mouse button and hence video rendering doesn't happen anymore.

On debugging more, I see that thread 0 is stuck as shown below with sendEvent processing left mouse down. It comes out only after it receives a left mouse up. There are some frames below which show NSWindowResizing, but my window flag doesn't have SDL_WINDOW_RESIZABLE set.

Thread 0:: CrBrowserMain Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fffbe13d34a mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fffbe13c797 mach_msg + 55
2 com.apple.CoreFoundation 0x00007fffa889d434 __CFRunLoopServiceMachPort + 212
3 com.apple.CoreFoundation 0x00007fffa889c8c1 __CFRunLoopRun + 1361
4 com.apple.CoreFoundation 0x00007fffa889c114 CFRunLoopRunSpecific + 420
5 com.apple.HIToolbox 0x00007fffa7dfdebc RunCurrentEventLoopInMode + 240
6 com.apple.HIToolbox 0x00007fffa7dfdcf1 ReceiveNextEventCommon + 432
7 com.apple.HIToolbox 0x00007fffa7dfdb26 _BlockUntilNextEventMatchingListInModeWithFilter + 71
8 com.apple.AppKit 0x00007fffa6396a54 _DPSNextEvent + 1120
9 com.apple.AppKit 0x00007fffa6b127ee -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2796
10 com.apple.AppKit 0x00007fffa66f568d +[NSWindow(NSWindowResizing) _mouseHysteresisCheck:withExpiration:andDistance:finalMouseLocation:] + 525
11 com.apple.AppKit 0x00007fffa65eedb5 -[NSWindow(NSWindowResizing) _hitTestWithHysteresisCheck:forEvent:allowWindowDragging:] + 394
12 com.apple.AppKit 0x00007fffa6c8f0db -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 1873
13 com.apple.AppKit 0x00007fffa6c8ca6c -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 1942
14 com.apple.AppKit 0x00007fffa6c8bf0a -[NSWindow(NSEventRouting) sendEvent:] + 541
15 org.libsdl.SDL2 0x000000010d46d74a -[SDLWindow sendEvent:] + 90
16 com.apple.AppKit 0x00007fffa6b10681 -[NSApplication(NSEvent) sendEvent:] + 1145
17 org.libsdl.SDL2 0x000000010d46532b -[SDLApplication sendEvent:] + 139
18 org.libsdl.SDL2 0x000000010d466b2f Cocoa_PumpEvents + 495
19 org.libsdl.SDL2 0x000000010d44c1d5 SDL_PumpEvents_REAL + 53
20 org.libsdl.SDL2 0x000000010d44c2f5 SDL_WaitEventTimeout_REAL + 53
21 org.libsdl.SDL2 0x000000010d44c2b7 SDL_PollEvent_REAL + 23
22 org.libsdl.SDL2 0x000000010d51bb24 SDL_PollEvent + 36
23 libTest.dylib 0x000000010cf3e0e8 SDLEventProcessor::processEvents(int) + 568
24 Test 0x000000010cde6bba BrowserApp::RunAppMessageLoop(BAInstData*, CefStringBase, CefStringBase) + 810
25 Test 0x000000010ce04bbc main + 17980
26 libdyld.dylib 0x00007fffbe016235 start + 1

I further noticed that while entering full screen in SDL_cocoawindow.m NSResizableWindowMask is set. If I clear it inside windowDidEnterFullScreen, then, the issue doesn't repro.

This is discussed at https://discourse.libsdl.org/t/main-thread-gets-stuck-on-left-mouse-down/22753/3 and thanks to Eric for the pointers.
2017-07-10 17:07:19 -07:00
..
android SDL - add SDL_WINDOW_VULKAN and make Android_CreateWindow only create an EGLSurface when SDL_WINDOW_VULKAN is not present. This makes it so the ANativeWindow* can be used with vkCreateAndroidSurfaceKHR, otherwise it will fail because having both an EGLSurface and VkSurfaceKHR attached to a window is not allowed according to the Vulkan spec: 2017-05-16 06:30:39 -07:00
cocoa Fixed bug 3697 - Main thread gets stuck on left mouse down 2017-07-10 17:07:19 -07:00
directfb directfb: Fixed quitting keyboard twice. 2017-06-16 23:30:30 +02:00
dummy Updated copyright for 2017 2017-01-01 18:33:28 -08:00
emscripten emscripten: listen for pointerlockchange events on the #document specifically. 2017-06-05 21:30:25 -04:00
haiku haiku: Fixed compiling without OpenGL support. 2017-07-07 23:00:22 +02:00
mir Removed redundant mouse clean up on quit for some platforms. 2017-05-19 23:30:59 +02:00
nacl nacl: Fixed unnecessary large input text array. 2017-06-16 23:30:13 +02:00
pandora pandora: Fixed compile error. 2017-06-16 23:30:38 +02:00
psp Fixed SDL_GetWindowWMInfo() returning success on three unsupported platforms. 2017-06-15 23:30:29 +02:00
qnx qnx: fixed potential buffer overflow. 2017-07-01 19:52:12 -04:00
raspberry Fixed SDL_GetWindowWMInfo() returning success on three unsupported platforms. 2017-06-15 23:30:29 +02:00
uikit Expose display refresh rate on iOS/tvOS 10.3+. 2017-06-10 21:29:37 -03:00
vivante Removed newlines from error messages. 2017-03-26 21:00:19 +02:00
wayland Fixed missing error messages for SDL_GetWindowWMInfo(). 2017-06-11 22:30:39 +02:00
windows Get the parent of non-SDL-created windows, for completeness 2017-06-16 11:14:08 -07:00
winrt winrt: Fixed SDL include. 2017-06-24 23:45:44 +02:00
x11 x11: pass a long to XChangeProperty, not an int. 2017-07-04 20:44:07 -04:00
SDL_blit.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit.h Really fixed blit issue for capehill 2017-01-07 16:51:48 -08:00
SDL_blit_0.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_1.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_A.c Fix some more compiler warnings on armcc. 2017-03-03 16:38:17 -05:00
SDL_blit_auto.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_auto.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_copy.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_copy.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_N.c Fixed comment style. 2017-02-26 21:20:39 +01:00
SDL_blit_slow.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_slow.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_bmp.c Fix some more compiler warnings on armcc. 2017-03-03 16:38:17 -05:00
SDL_clipboard.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_egl.c Fixed warning in Android build 2017-02-10 09:41:16 -08:00
SDL_egl_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_fillrect.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_pixels.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_pixels_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_rect.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_rect_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_RLEaccel.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_RLEaccel_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_shape.c Fixed crash if calling SDL_CreateShapedWindow() on unsupported platforms. 2017-06-02 22:15:12 +02:00
SDL_shape_internals.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_stretch.c Removed newlines from error messages. 2017-03-26 21:00:19 +02:00
SDL_surface.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_sysvideo.h Support for QNX 7.0 (thanks, Elad!). 2017-07-01 17:50:47 -04:00
SDL_video.c Support for QNX 7.0 (thanks, Elad!). 2017-07-01 17:50:47 -04:00
sdlgenblit.pl Updated copyright for 2017 2017-01-01 18:33:28 -08:00