src/video/cocoa/SDL_cocoawindow.m


Log

Author Commit Date CI Message
Ryan C. Gordon 9bbf92e3 2017-10-25T18:02:11 cocoa: Don't change the NSWindow background color. Changing the background color causes the titlebar to blend against it on modern macOS releases, making all SDL windows look wrong by default. This was set to make the window not flash white before a GL context is ready, but we can accomplish this in our window's view's drawRect implementation, too.
Sam Lantinga b2ba8963 2017-09-09T11:00:25 Fixed bug 3809 - Restore after maximize leads to wrong size Andreas Falkenhahn My app opens a 640x480 window. When I click on the window's maximize button, the window correctly fills the entire screen and loses its borders. But clicking on the restore button now doesn't restore the window to its original 640x480 size. Instead, the window size is identical to the screen size now. The only difference to the previous state is that the window now has borders again but it isn't restored to 640x480.
Sam Lantinga 676c3a92 2017-09-09T10:31:44 Fixed bug 3719 - Cocoa - Incorrect window size when leaving fullscreen bastien.bouclet The window is now resized to its specified size, but it moves to the top left corner of the screen. That is unexpected because neither the user nor the program moved it there. Test program attached (the same one as before).
David Ludwig 532446a6 2017-09-03T17:33:49 macOS: bug-fix for #3793, "fullscreen toggle does not maintain SDL_Renderer's logical size" This also seems to fix the follow-up issue in bug #3719, whereby the initial fix caused the SDL window to move, after transitioning from fullscreen to windowed-mode
Alex Szpakowski d7ae3131 2017-08-31T21:34:29 macOS: Fix menubar items being enabled when they shouldn't be.
Alex Szpakowski cfd7a7fa 2017-08-31T21:13:32 macOS: Prevent unwanted native fullscreen (Spaces) toggles when the window is in fullscreen or isn't resizable. Fixes bug #3691.
Sam Lantinga 8fc1fb08 2017-08-29T21:42:22 Fixed bug 3719 - Cocoa - Incorrect window size when leaving fullscreen bastien.bouclet When exiting a "fullscreen space" on OS X, windows don't go to their defined "windowed mode size", but go back to their previous size. Steps to reproduce: 1. Create a windowed mode SDL window 2. Toggle it to fullscreen with the SDL_WINDOW_FULLSCREEN_DESKTOP flag 3. While in fullscreen, change the windowed mode size using SDL_SetWindowSize 4. Toggle the window back to windowed mode Expected result: - The window has the size specified during step 3. Actual result: - The window has the size specified when creating the window in step 1. Attached is a minimal reproduction test case. The attached test case works as expected on X11 and Windows.
Sam Lantinga 997c69b9 2017-08-01T20:16:10 Fixed bug 3697 - Main thread gets stuck on left mouse down Eric Wasylishen I think I found a better fix. The problem with https://hg.libsdl.org/SDL/rev/ebdc0738b1b5 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.
Sam Lantinga 6391cc3f 2017-08-01T20:09:23 Backed out changeset ebdc0738b1b5 for bug 3697 Eric Wasylishen 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.
Alex Szpakowski bc3ede1e 2017-07-13T22:59:02 macOS: Replace uses of deprecated Cocoa enum names with modern/consistent equivalents.
Sam Lantinga 37722d01 2017-07-10T17:07:19 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.
Philipp Wiesemann 266816b4 2017-03-26T21:00:19 Removed newlines from error messages.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Alex Szpakowski fd85f574 2016-12-23T22:49:37 Mac: back out commit 3e9b2ae41adf. It causes significant overhead on many GPUs.
Alex Szpakowski d719374c 2016-12-23T22:08:18 Mac: Fix over-saturated colors on P3 displays (e.g. the 2016 MBPs).
Sam Lantinga 354a8f27 2016-11-26T10:26:22 SDL for Mac - only enable global event tap when actually necessary (app has focus and has requested relative mouse mode or has asked for a mouse grab). in other situations the event tap impacts system performance and battery life with no benefit.
Sam Lantinga 27d4f099 2016-10-07T23:40:44 Implemented SDL_GetHintBoolean() to make it easier to check boolean hints
Ryan C. Gordon 4f4c4b62 2016-09-29T22:52:41 Added SDL_SetWindowResizable(). (thanks, Ethan!)
Sam Lantinga a13da2fa 2016-09-29T13:34:49 Generalized the hint for whether the application gets a mouse event when clicking on the window to activate it, and is now named SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH. The behavior is defined to not receive the click event, and this hint allows you to override that.
Alex Szpakowski 450fa8cd 2016-09-24T18:46:34 Use OS-provided click counts on macOS and iOS for mouse press and release events.
Sam Lantinga 29214826 2016-09-16T22:27:58 Fixed warning with Xcode 7.3.0
Alex Szpakowski 86708c3c 2016-09-13T19:51:10 Enable more compiler warnings in the Xcode projects (based on Xcode 8's suggestion), made some integer downcasts explicit.
Ryan C. Gordon 5bcf1d25 2016-08-28T19:06:31 cocoa: Fixed incorrect autorelease, noted by static analysis.
Alex Szpakowski 4a468739 2016-05-21T00:20:52 Removed Mac OS 10.5 support (bug #3137). Also fixed a warning about deprecated Carbon code when using SDL_audio (bug #3127, thanks Dominik!)
Alex Szpakowski b15efce2 2016-05-01T21:41:30 Cocoa mouse code: Replaced NSPointInRect with NSMouseInRect (thanks Eric Wasylishen!) Fixes bug #3312.
Alex Szpakowski d3835026 2016-05-01T19:51:10 Mac: replaced a deprecated CGSetLocalEventsSuppressionInterval call that I missed in commit 2f72bdfee9bb
Alex Szpakowski 88372277 2016-04-02T11:54:05 Add a new hint SDL_HINT_MAC_MOUSE_FOCUS_CLICKTHROUGH, which allows mouse click events to occur when clicking to focus a window in Mac OS X. Fixes bug #3300.
Ryan C. Gordon 3bdaf4c6 2016-01-05T02:46:10 Added SDL_SetWindowOpacity() and SDL_GetWindowOpacity(). This is currently implemented for X11, Cocoa, Windows, and DirectFB. This patch is based on work in Unreal Engine 4's fork of SDL, compliments of Epic Games.
Ryan C. Gordon 8e855f2f 2016-01-05T01:42:00 Added SDL_DROPBEGIN and SDL_DROPCOMPLETE events, plus window IDs for drops. This allows an app to know when a set of drops are coming in a grouping of some sort (for example, a user selected multiple files and dropped them all on the window with a single drag), and when that set is complete. This also adds a window ID to the drop events, so the app can determine to which window a given drop was delivered. For application-level drops (for example, you launched an app by dropping a file on its icon), the window ID will be zero.
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
Ryan C. Gordon 326b3578 2015-12-29T01:09:58 Mac: don't ignore mouse clicks on the top pixel of a window (thanks, Joshua!). Fixes Bugzilla #3190.
Ryan C. Gordon 257b7af2 2015-12-28T13:07:44 Sync up the caps/numlock state properly without sending key events. Partially fixes Bugzilla #2736 and #3125.
Ryan C. Gordon d3b323f8 2015-12-27T23:39:43 Mac: Fix keyboard state if capslock was toggled while app wasn't in foreground.
Alex Szpakowski 6a50d333 2015-11-30T03:30:35 Removed some debug prints.
Alex Szpakowski 9ddc6c34 2015-11-30T03:30:07 Mac: Fixed SDL_SetWindowFullscreen not restoring the window's original size when exiting a Space.
Sam Lantinga 5103ae9f 2015-11-09T08:55:07 one last SDL fix: restore menu bar if we destroy a fullscreen window without transitioning it back to a non-fullscreen window first
Sam Lantinga eeddb7c5 2015-11-09T08:54:56 more SDL fullscreen state tracking fixes, don't update fullscreen flags on failure to change fullscreen state
Sam Lantinga 792354d6 2015-11-09T08:54:49 SDL OSX implementation must account for the fact that going fullscreen can fail. improve the logic around retrying, make a few attempts before failing.
Sam Lantinga 2d884656 2015-11-09T08:54:42 add hacky support for failed fullscreen transitions. SDL doesn't have the concept of a fullscreen transition that failed. if the user is actively changing spaces while the app goes fullscreen, it fails to go fullscreen; now it will just try again instead of hanging around with the wrong window styles.
Alex Szpakowski f8824cb9 2015-10-23T03:37:53 Mac: Fix returning to the window's Space in OS X 10.11+ when SDL_WINDOW_FULLSCREEN_DESKTOP is used (bug #3152.)
Alex Szpakowski 6a32ca7a 2015-09-09T13:55:11 Mac: Fixed SDL_SetWindowSize to set the size of the content area of the window, rather than the total size including decorations.
Ryan C. Gordon 9e2b90e2 2015-08-14T01:20:41 Cocoa: Keep the window's screen position through SDL_SetWindowSize(). The Y coordinate is flipped in Cocoa, so if you change the height, the window will move and maybe clip against the screen edge if you don't adjust its Y coordinate to match. Possibly fixes Bugzilla #3066.
Sam Lantinga 396b3b89 2015-07-05T15:45:48 Better fix for bug 3048, don't crash if the window title is NULL
David Ludwig d0ba0c1d 2015-07-04T21:04:49 Fixed bug 3048, "Crashes in Cocoa_SetWindowTitle"
Ryan C. Gordon 65a1a3e7 2015-07-04T14:09:09 Cocoa: support drag-and-drop of multiple objects.
Sam Lantinga e8954d5d 2015-06-30T19:30:02 Hack to fix missing window decorations after toggling fullscreen mode in Mac OS X 10.10
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Ryan C. Gordon 870df8ad 2015-05-31T00:50:30 Cocoa: ignore mouseDown events in a window's titlebar. These events accidentally slipping in sometimes appears to be a bug (or maybe new behavior) in 10.10, as previous versions of Mac OS X don't appear to ever trigger this. Thanks to Paulo Marques for pointing out the fix on the SDL mailing list! Fixes Bugzilla #2842 (again).
Sam Lantinga 6e67c949 2015-05-28T12:55:01 Fixed bug 2054 - SDL_GetError: "Unknown touch device" Volumetric The "Unknown touch device" message appears because the initial touch device setup loop uses SDL_GetTouch() as a guard for calling SDL_AddTouch(). SDL_GetTouch() will always report "Unknown touch device" since the device hasn't been added yet. The SDL_GetTouch() call is unnecessary since SDL_AddTouch() calls SDL_GetTouchIndex() to verify that the device hasn't been added yet, and SDL_GetTouchIndex() has the benefit of not reporting an error for a device it can't find.
Alex Szpakowski 262e8ef3 2015-05-26T21:51:47 Mac: Send a window resize event when the window's backing scale factor changes. The backing scale factor can change when the window moves between retina and non-retina displays. The only other way to detect such a change is to compare the output of SDL_GL_GetDrawableSize or SDL_GetRendererOutputSize every frame, which is less than desirable, especially since the necessary app logic is likely already being executed when a window resize event is received.
Ryan C. Gordon 80916e01 2015-05-26T11:38:04 Cocoa: Fixed relative mouse mode when app loses/regains focus (thanks, Eric!). Fixes Bugzilla #2718.
Ryan C. Gordon bb437f02 2015-05-26T11:01:19 Cocoa: report SDL_WINDOWEVENT_EXPOSED events to the app (thanks, David!). Fixes Bugzilla #2644.
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Alex Szpakowski 4fc40266 2015-05-05T19:01:55 Replaced all remaining uses of NSAutoreleasePool with @autoreleasepool blocks (bugzilla #2680.)
Ryan C. Gordon aa4952fd 2015-04-21T10:10:59 Added SDL_WINDOWEVENT_HIT_TEST. This lets windows know when they are dropping a mouse event because their hit test reported something other than SDL_HITTEST_NORMAL. It lets them know exactly where in the event queue this happened. This patch is based on work in Unreal Engine 4's fork of SDL, compliments of Epic Games.
Ryan C. Gordon e0e04542 2015-04-21T09:46:48 Added a few FIXMEs.
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Ryan C. Gordon 6e53bc9b 2015-04-08T02:00:14 SDL_SetWindowTitle() should never set a NULL pointer for the title string. Various backends reacted differently (or not at all) in the presence of a NULL pointer. This simplifies things. Fixes Bugzilla #2902.
Ryan C. Gordon b42c2597 2015-03-22T01:25:12 Cocoa: Handle more cases of lost focus when Key window closes (thanks, Alex!). Sort of fixes Bugzilla #1825 a little more. It's an ongoing effort. :)
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
J?rgen P. Tjern? 94539137 2014-11-24T11:46:20 Mac: Add drag & drop support. Fixes bug https://bugzilla.libsdl.org/show_bug.cgi?id=2757 Thanks to Alex Szpakowski for the patch!
Edward Rudd 084642d3 2014-11-23T15:48:52 Cocoa: add in handling of "lost" touches on OS X. [bug #2635] This scenario can occur, for example, when the 4-finger touch sequence is used to switch spaces. the SDL window does not receive the touch up events and ends up thinking there are far more fingers on the pad than there are. So the solution here is everytime a new "touch" appears we can through and check if there are any existing known touches by the OS and if there are none, abut SDL things there are, we simply go through and cancel the SDL touches. Side affects. - the "touch up" won't occur until the users sends a new touch (could be well after the actual release really did occur)
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
Sam Lantinga 5e501804 2014-08-17T14:57:52 Fixed bug 2655 - OSX: Window position and global mouse coord spaces are different Tim McDaniel On OSX, with revision 8729, the coordinate space for window position and the coordinate space for global mouse position don't match. For a non-fullscreen window, the window position is global relative to the bottom of the menubar. The global mouse position is relative to the top of the screen. This affects Cocoa_WarpMouse and potentially other things as well. Further, the coordinate system for window position is now affected by what screen it is on. For example, if I have two equal size screens oriented side by side such that the tops of the screens are equal in global space, with the menubar on one screen, and a window straddles the two screens, the window's y position makes no sense. The window's y position depends on what screen "most" of the window is on. So if I move the window horizontally just a bit, the y position of my window is now different by the size of the menubar, even though the window was not moved vertically. I'd like to reiterate that this was a fairly fundamental change (and a breaking change for us). If SDL OSX is to really support multi-display configurations, this is especially problematic. If the real concern is preventing windows from going under the menubar, then perhaps a solution involving something like overriding [NSWindow constrainFrameRect] would be less problematic than redefining the global window coord space for the main display.
Alfred Reynolds 87b8c8d1 2014-07-31T12:46:23 SDL - when raising the window under OSX also force the app to activate. This fixes a fullscreen window on a separate space not coming front when raisewindow is called.
Sam Lantinga fc4e798d 2014-07-07T12:48:25 Fixed bug 2631 - Mac: minor code cleanup Alex Szpakowski Some minor changes to the Mac-specific backend code: - Fixed up some code style issues (mostly brace style inconsistencies). - Fixed a compiler warning in SDL_cocoaevents.m. - Removed some useless code now that the 10.7 SDK is required to build SDL. - Removed Gestalt(gestaltSystemVersion, ...) call and switched to NSAppKitVersionNumber for version checking code. Using Gestalt with gestaltSystemVersion will give 0x1090 in Mac OS 10.10+, and the whole Gestalt function was deprecated in Mac OS 10.8.
Sam Lantinga d44f3922 2014-07-07T10:33:32 Fixed bug 2629 - Mac: crash when calling SDL_DestroyWindow with an active OpenGL context Alex Szpakowski Since this commit https://hg.libsdl.org/SDL/rev/59b543340d63 , calling SDL_DestroyWindow will crash the program if the window has an active OpenGL context. This is because the Cocoa_DestroyWindow code sets the window's driverdata to NULL and then calls [context setWindow:NULL], which tries to access the window's driverdata, resulting in a null pointer dereference. I have attached a patch which fixes the issue by moving the line which sets the driverdata to NULL to after the lines which call functions that use the driverdata pointer.
Ryan C. Gordon b29740b8 2014-06-25T17:06:12 Merged Ryan's SDL-gui-backend branch. Adds three APIs, and implements them on X11, Cocoa, and Windows: - SDL_CaptureMouse() - SDL_GetGlobalMouseState() - SDL_SetWindowHitTest()
Sam Lantinga 704d9bd3 2014-06-25T02:08:37 Fixed bug 2525 - Keyboard focus crash Todd Seiler Call Stack: #0 0x0000000101c29291 in Cocoa_StartTextInput at /Users/Todd/Desktop/codes/sources/SDL/src/video/cocoa/SDL_cocoakeyboard.m:512 #1 0x0000000101c110c5 in SDL_SetKeyboardFocus at /Users/Todd/Desktop/codes/sources/SDL/src/events/SDL_keyboard.c:643 #2 0x0000000101c32be4 in SetupWindowData at /Users/Todd/Desktop/codes/sources/SDL/src/video/cocoa/SDL_cocoawindow.m:981 #3 0x0000000101c32d2a in Cocoa_CreateWindowFrom at /Users/Todd/Desktop/codes/sources/SDL/src/video/cocoa/SDL_cocoawindow.m:1092 #4 0x0000000101c99999 in SDL_CreateWindowFrom_REAL at /Users/Todd/Desktop/codes/sources/SDL/src/video/SDL_video.c:1338 #5 0x0000000101ce1484 in SDL_CreateWindowFrom at /Users/Todd/Desktop/codes/sources/SDL/src/dynapi/SDL_dynapi_procs.h:547 #6 0x0000000100018a5e in SceneRenderer at /Users/Todd/Desktop/codes/sources/tseiler_Todds-MacBook-Pro_3405/AppName/src/SceneRenderer.cpp:138 #7 0x0000000100017ca5 in SceneRenderer at /Users/Todd/Desktop/codes/sources/tseiler_Todds-MacBook-Pro_3405/AppName/src/SceneRenderer.cpp:145 #8 0x000000010000cd96 in App::execute(int, char**) at /Users/Todd/Desktop/codes/sources/tseiler_Todds-MacBook-Pro_3405/AppName/src/App.cpp:28 #9 0x0000000100004402 in main at /Users/Todd/Desktop/codes/sources/tseiler_Todds-MacBook-Pro_3405/AppName/src/main.cpp:8 This issue occurred when using Ogre3D Graphics engine on Mac (cocoa) to create the window. Then handing the window handle off to SDL_CreateWindowFrom(). In Ogre3D application you do the following: window_ = root_->initialise(true, "Ogre Window 2"); loadOgreResources(); Ogre::WindowEventUtilities::addWindowEventListener(window_, this); #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE NSWindow* Data = 0; window_->getCustomAttribute("WINDOW", &Data); sdl_window_ = SDL_CreateWindowFrom((void*)Data); #endif It results in a crash in this function: SDL_cocoakeyboard.m void Cocoa_StartTextInput(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; SDL_Window *window = SDL_GetKeyboardFocus(); NSWindow *nswindow = nil; if (window) nswindow = ((SDL_WindowData*)window->driverdata)->nswindow; // ... } The crash occurred because "driverdata" was nil. Before this function call, a call to SetupWindowData is called: SDL_cocoawindow.m static int SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created) { // ... if ([nswindow isKeyWindow]) { window->flags |= SDL_WINDOW_INPUT_FOCUS; SDL_SetKeyboardFocus(data->window); } /* Prevents the window's "window device" from being destroyed when it is * hidden. See http://www.mikeash.com/pyblog/nsopenglcontext-and-one-shot.html */ [nswindow setOneShot:NO]; /* All done! */ [pool release]; window->driverdata = data; return 0; } As you can see: "window->driverdata = data" is performed after the "SDL_SetKeyboardFocus()" call, which eventually leads to "Cocoa_StartTextInput()" where the crash occurs.
Sam Lantinga b7b6d8ab 2014-06-22T02:30:36 Fixed crash initializing OpenGL ES renderer if OpenGL renderer fails
Sam Lantinga 65133ebc 2014-06-04T09:39:08 Wait for the fullscreen transition to complete before allowing the application to continue. This fixes Alt-Enter in the Steam streaming client, which sets the window size and position immediately after switching out of fullscreen mode.
Sam Lantinga 16360b19 2014-06-04T01:56:14 Fixed escape cancelling fullscreen mode now that the SDL window is the first res ponder.
Sam Lantinga a8fcbc46 2014-06-02T09:09:40 Fixed bug 2534 - Mac: black bar at top of screen in SDL_WINDOW_FULLSCREEN mode Alex Szpakowski Patch to fix the y component of the position of fullscreen windows in OS X. In Mac OS X with the latest Mercurial code, when a window is in exclusive-fullscreen the y component of its position is offset by the same amount that is normally taken up by the menubar, resulting in a black bar at the top of the screen. The recent changes to the internal ConvertNSRect function make it treat the bottom of the menubar as 0 for the y component of window positions, even when the window is fullscreen and 'above' the menubar. I have attached a patch which fixes the issue by only making the window position relative to the menubar in windowed modes.
Sam Lantinga 3905b910 2014-06-02T09:01:10 Fixed bug 2479 - [OS X] SDL_SetWindowFullscreen fails to switch to windowed Eric Wasylishen The problem seems to be the spaces handling code in -setFullscreenSpace: (SDL_cocoawindow.m) is incorrectly reporting that the SDL_WINDOW_FULLSCREEN -> windowed transition has already happened. i.e. I saw this case was getting hit when trying to leave SDL_WINDOW_FULLSCREEN: "else if (state == isFullscreenSpace) { return YES; /* already there. */ }" With the attached patch, both Control+Enter (SDL_WINDOW_FULLSCREEN toggle) and Option+Enter (SDL_WINDOW_FULLSCREEN_DESKTOP toggle) work in an sdl test app (I tried testwm2). Tested on OS X 10.9.2.
Ryan C. Gordon 98c03f39 2014-05-28T01:22:47 Changed drag area API to a hit-testing API. There were several good arguments for this: it's how Windows works with WM_NCHITTEST, SDL doesn't need to manage a list of rects, it allows more control over the regions (how do you use rects to cleanly surround a circular button?), the callback can be more optimized than a iterating a list of rects, and you don't have to send an updated list of rects whenever the window resizes or layout changes.
Ryan C. Gordon 3cbc83ef 2014-05-27T01:27:42 First shot at SDL_SetWindowDragAreas(). Only Cocoa implemented right now.
Ryan C. Gordon ded970f7 2014-05-24T18:23:56 Flip this around to do the simpler condition first.
J?rgen P. Tjern? 8b280091 2014-04-24T21:05:51 Mac: Correct the y-axis position after 870c7d21004b This fixes a bug where we'd offset positions by the height of the dock, if it was along the bottom of the screen. Fixes https://bugzilla.libsdl.org/show_bug.cgi?id=2509 Thanks to Alex Szpakowski for bug & patch.
J?rgen P. Tjern? beff5cec 2014-04-19T13:15:53 Mac: SDL_SetWindowPosition is now relative to the menubar. It used to be that SDL_SetWindowPosition was relative to the top of the screen, which didn't make sense. In addition, borderless windows can be positioned *below* the menubar, so SDL_SetWindowPosition(win, 0, 0) on a borderless window would hide ~30ish pixels of the window below the menubar.
David Ludwig 3dcb451f 2014-04-09T21:29:19 Added a README file regarding WinRT support To note, this file is currently formatted with CRLF line endings, rather than LF, to allow the file to be viewed with Notepad.
Ryan C. Gordon 84b919a2 2014-03-20T11:22:57 Static analysis fix: dereference of a NULL pointer.
Sam Lantinga 9245c930 2014-03-15T16:27:06 Only show the window if it's supposed to be shown.
Ryan C. Gordon c663d731 2014-03-15T15:35:15 Mac: Make sure window is still showing when we exit a fullscreen space.
Sam Lantinga 26e8e387 2014-03-14T18:06:09 Fixed Mac OS X window level when leaving fullscreen mode
Ryan C. Gordon 9e67444a 2014-03-03T21:25:16 Mac: Added a hint to opt-out of new Spaces code.
Ryan C. Gordon 3889d478 2014-03-02T22:55:12 Removed unused variable.
Ryan C. Gordon 0e5cc8df 2014-03-02T22:51:31 Mac: Don't lose the menu/dock when switching back to a resizable window Space.
Ryan C. Gordon 86be8321 2014-03-02T22:16:49 Mac: only programmatically create Spaces if we're FULLSCREEN_DESKTOP. (coming back from fullscreen in any state is okay).
Ryan C. Gordon 460f97ff 2014-03-02T16:36:40 A bunch of fixes for the new Spaces code.
Ryan C. Gordon 5eccbac4 2014-03-02T15:35:24 Mac: Manage menubar and dock as FULLSCREEN_DESKTOP windows become/resign key.
Ryan C. Gordon 51faf449 2014-03-02T12:45:51 Reworked fullscreen policy on Mac OS X. - SDL_WINDOW_FULLSCREEN works as always (change resolution, lock to window). - SDL_WINDOW_FULLSCREEN_DESKTOP now puts the window in its own Space, and hides the menu bar, but you can slide between Spaces and Command-Tab between apps without the window minimizing, etc. - SDL_WINDOW_RESIZABLE windows will get the new 10.7+ "toggle fullscreen" window decoration and menubar item. As far as the app is concerned, this is no different than resizing a window, but it gives the end-user more power. - The hint for putting fullscreen windows into the Spaces system is gone, since Spaces can't enforce the requested resolution. It's a perfect match for FULLSCREEN_DESKTOP, though, so this is all automated now.
J?rgen P. Tjern? 4850d259 2014-02-26T11:35:02 Mac: Redo cursor warp handling. This fixes bugs related to getting unnaturally large xrel/yrel for SDL_MOUSEMOTION after warps and enabling / disabling relative mode. Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=1836
J?rgen P. Tjern? 52a63e82 2014-02-25T17:27:41 Mac: Improve moving relative mode windows. This makes it possible to move windows by their title bar, even if they're in relative mode, if you click the title bar when the window does not have focus. Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2396
J?rgen P. Tjern? 95f7e242 2014-02-25T15:28:12 Mac: Immediately update current OpenGL context's shape. Previously we were postponing our -[NSOpenGLContext update] call to the next SDL_GL_SwapWindow, even if the context was current on the current thread. This changes it so that we will do the update immediately if it's the current context. If you're rendering on another thread, you need to call SDL_GL_SwapWindow once after a resize event to ensure your drawable will produce non-garbage data. Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2339
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
J?rgen P. Tjern? bc92383e 2014-01-15T11:31:56 Mac: Don't give windows focus back when we're closing them. Fixes bug #1840 (https://bugzilla.libsdl.org/show_bug.cgi?id=1840)