src/video/cocoa


Log

Author Commit Date CI Message
Sam Lantinga 7b100001 2022-11-30T15:51:17 Reverted code formatting for Apple platforms We didn't get the merge right, and rather than tease out exactly what happened, I'm just reverting for now.
Sam Lantinga b8d85c69 2022-11-30T12:51:59 Update for SDL3 coding style (#6717) I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base. In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted. The script I ran for the src directory is added as build-scripts/clang-format-src.sh This fixes: #6592 #6593 #6594 (cherry picked from commit 5750bcb174300011b91d1de20edb288fcca70f8c)
pionere 72484511 2022-11-29T18:43:36 video: fix error messages - do not overwrite error message set by SDL_InitFormat (SDL_AllocFormat) - set proper error message (Cocoa_Metal_CreateView) - protect against allocation failure (UIKit_Metal_CreateView) (cherry picked from commit cf0cb44df88a4293805fdc926880155d58a46bea)
Joshua Root 2df39e64 2022-11-27T11:27:19 Fix build with Xcode < 7 The _Nullable attribute is not available in older versions. (cherry picked from commit 9a64aa6f95298bf459f8b9dca583df7064956cd9)
Ryan C. Gordon 3f5593d6 2022-11-26T13:57:12 cocoa: Patched to compile on macOS SDK < 10.10. Fixes #6586. (cherry picked from commit fa5adcafd52303fde86c64094462303404259d75)
Joshua Root f52e7199 2022-08-28T00:52:19 Check build-time SDK in LoadMainMenuNibIfAvailable Fixes building against OS X 10.7 SDK. (cherry picked from commit f8cebeea599ae65f36d388257a9d9a8ed8ada576)
Joshua Root e12c831b 2022-11-24T06:32:49 SDL_cocoaopengl.h: ensure CVDisplayLinkRef is defined The typedef seems to be pulled in coincidentally with newer SDKs, but older ones need to import the header explicitly. (cherry picked from commit d2910904fb4062c313636c7595e971f1bf248075)
Sam Lantinga 913e403f 2022-11-16T18:03:29 Fixed error message when trying to create an OpenGLES2 renderer on macOS Testing: testsprite2 --renderer opengles2 OpenGLES2 isn't available by default, and we want to see the error "Could not load EGL library"
Ryan C. Gordon 7ebdae5d 2022-11-16T11:45:41 cocoa: Fix OpenGL deprecation warning.
Ryan C. Gordon 7c760f7f 2022-11-16T11:32:08 cocoa: Update CVDisplayLink timing when screen changes. This handles both the window moving to a new display and changing the current display's refresh rate in System Preferences Reference Issue #4918.
Ryan C. Gordon 1fd66cc8 2022-11-16T10:15:21 Revert "cocoa: Backed out CVDisplayLink code for macOS vsync." This reverts commit 04b50f6c6bef67b744b192c78775771b51ff2141. It turns out OpenGL vsync has broken again in macOS 12, so we're reintroducing our CVDisplayLink code to deal with it, again. Reference Issue #4918.
Hubert Maier 5dc93451 2022-11-06T20:49:37 JANITORIAL : Correct some more spelling mistakes (#6489)
Sam Lantinga c2675d74 2022-11-06T10:52:20 Revert "cocoa: Discard the IME Candidate Window immediately when Escape is pressed" This reverts commit 0d76e2a8a1a8e6a2801123587c2205a288d49406, as it introduced other issues: https://github.com/libsdl-org/SDL/pull/6486#issuecomment-1304684865
Edward Li 0d76e2a8 2022-11-06T04:59:02 cocoa: Discard the IME Candidate Window immediately when Escape is pressed
Guldoman 084fa4c3 2022-11-01T10:55:17 cocoa: Reset IME when sending composed text This will send an empty `TEXTEDITING` event that is used to signal the end of the composition.
Ryan C. Gordon 41d38c0f 2022-10-26T09:43:04 shape: More robust handling of failure cases in CreateShaper.
Ryan C. Gordon c8d20f96 2022-10-25T23:13:34 shape: Free platform-specific shaped window data. Fixes #2128.
Steven Noonan d2300516 2022-09-07T06:49:02 cocoa: set sRGB colorspace on nswindow This makes the colorspace match across different graphics APIs. By default, OpenGL was getting a much more saturated colorspace (maybe Display P3?) and it was looking very different from the rendering done by Metal or MoltenVK.
Steven Noonan 019e9d4c 2022-08-25T23:15:58 SDL_cocoavideo.m: add missing SDL_cocoaopengles.h include
Deve 7e108816 2022-10-18T01:07:54 Fixed command modifier on macOS
Deve cdf312c8 2022-10-18T00:48:55 Fixed mouse warp after resizing window on macOS.
Sam Lantinga 91ff8845 2022-10-13T23:56:17 Disable "The key you just pressed is not recognized by SDL." message by default
slime bbeacd72 2022-10-02T22:57:03 Fix some credit comments.
Aaron Barany 5e654a4b 2022-10-01T16:10:46 Fixed Mac compile errors when OpenGL is disabled.
Ryan C. Gordon 57b20e7b 2022-09-27T14:23:42 cocoa: Fix new windows setting SDL_WINDOW_BORDERLESS flag incorrectly. Fixes #6172.
Noel Berry 00452e47 2022-08-24T11:25:13 Adding SDL_GetWindowSizeInPixels for window size in pixels (#6112)
slime b204db1e 2022-08-21T18:06:11 cocoa: change Shape data to use ObjC objects instead of C structs. Fixes #6089
Luke Street 2b93f6e1 2022-05-20T09:55:06 cocoa/uikit: Use VK_EXT_metal_surface in Vulkan_GetInstanceExtensions Replaces VK_MVK_macos_surface and VK_MVK_ios_surface
Luke Street 029a9b2f 2022-05-19T12:57:35 cocoa/uikit: Support VK_EXT_metal_surface Uses VK_EXT_metal_surface (vkCreateMetalSurfaceEXT) when possible, otherwise falls back to the obsoleted VK_MVK_macos_surface and VK_MVK_ios_surface. Fixes #3906
Ryan C. Gordon 26948f01 2022-08-15T20:09:09 cocoa: Make SDL_MinimizeWindow() work with borderless windows. Fixes #6046.
Cameron Gutman 3046d55d 2022-08-12T22:02:26 cocoa: Return an error if GetWindowDisplayIndex() is called too early SDL_CreateWindow() may call GetWindowDisplayIndex() to compute the position of a new window that the caller has requested to be placed on a certain display. Since we haven't fully constructed the window yet, our driverdata will be nil and we will fail to get the NSScreen (which is fine). However, we need to return an error (not 0, which is a valid display index) for SDL_GetWindowDisplayIndex() to know to figure out the display index itself. Fixes positioning new windows on secondary displays when using SDL_WINDOWPOS_CENTERED_DISPLAY() and SDL_WINDOWPOS_UNDEFINED_DISPLAY().
Sam Lantinga 08d17f47 2022-08-12T20:26:23 Removed unused variable
Ryan C. Gordon 3119d58f 2022-08-10T10:48:23 cocoa: Change the new sync_dispatch hint to async_dispatch. This is so the default is safer.
Ryan C. Gordon bdc7f958 2022-08-10T00:41:25 cocoa: Added hint to treat MacBook trackpads as touch devices, not mice. Fixes #5511.
Salman Ahmed b4660e9d 2022-08-10T03:40:00 macOS: Add hint for blocking thread on OpenGL context update dispatch (#5708)
Ryan C. Gordon 56c1481c 2022-08-08T20:33:44 cocoa: Don't mark fullscreen-desktop windows as non-resizable. Otherwise, we can't tile SDL apps in Spaces. Fixes #4883.
Shootfast 60d1944e 2022-07-06T20:12:30 SDL_video: Added SDL_GL_FLOATBUFFERS to allow Cocoa GL contexts to use EDR
Cameron Gutman 8b438f7b 2022-07-31T15:34:03 keyboard: Only send SDL_KEYMAPCHANGED when the keymap actually changes
diddily 1f276a51 2022-07-26T13:30:59 Fix Main Thread Checker warning on macOS Cache off NSWindow's windowNumber in SDL_WindowData on setup and use that in `Cocoa_SendWakeupEvent` to prevent accessing windowNumber off the main thread.
Ryan C. Gordon 218c3dbb 2022-07-26T14:45:26 cocoa: Don't crash if moving a message box created before SDL_Init. Fixes #5928.
Ryan C. Gordon 20a76b0e 2022-07-25T23:06:58 video: removed unused devindex argument from bootstrap's create method.
Sam Lantinga 4d665017 2022-07-24T18:04:26 Fixed building with 10.9 SDK Fixes https://github.com/libsdl-org/SDL/issues/5954
Dean Herbert 6bcde52d 2022-07-24T20:19:16 Further adjust implementation of `Cocoa_GetWindowDisplayIndex` As discussed in PR review, there may be an off-chance that the index returned doesn't match up with SDL's display indexing. This change ensures that the indices match and adds a safety check for off-screen windows.
Dean Herbert ce8aae14 2022-07-13T15:01:55 Fix `Cocoa_GetWindowDisplayIndex` failing and causing a catastrophic crash With the introduction of this function, it is possible that for certain monitor and window configurations, creating an SDL window will cause a native crash. ``` Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000050 Exception Codes: 0x0000000000000001, 0x0000000000000050 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11 Terminating Process: exc handler [56627] VM Region Info: 0x50 is not in any region. Bytes before following region: 140737486737328 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL UNUSED SPACE AT START ---> VM_ALLOCATE 7fffffe75000-7fffffe76000 [ 4K] r-x/r-x SM=ALI Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libSDL2.dylib 0x10247f665 SDL_UpdateFullscreenMode + 357 1 libSDL2.dylib 0x10247ec70 SDL_CreateWindow_REAL + 1504 2 ??? 0x111262de8 ??? 3 ??? 0x110c39fff ??? 4 libcoreclr.dylib 0x101fdf2a9 CallDescrWorkerInternal + 124 ``` Tracking thread from our end: https://github.com/ppy/osu-framework/issues/5190 Regressed with: https://github.com/libsdl-org/SDL/pull/5573 In testing, the window would not find a valid screen if created "hanging" off a primary display with a secondary display below it. In checking why this was the case, the `display_centre` was being calculated with a negative y origin, causing a final negative value falling outside all display bounds: ``` SDL error log [debug]: display_centre.y = -1296 + 1296 / 2 SDL error log [debug]: Display rect 0: 0 0 2560 1440 SDL error log [debug]: Display rect 1: 2560 -625 1080 2560 SDL error log [debug]: Display rect 2: 0 1440 1728 1296 ``` The method that was being used to find the current window using the frame origin/size seems unreliable, so I have opted to replace it with with a tried method (https://stackoverflow.com/a/40891902). Initial testing shows that this works with non-standard DPI screens, but further testing would be appreciated (cc @sezero / @misl6 from the original PR thread).
Sam Lantinga cef1514b 2022-07-17T09:07:04 Fixed some Xcode warnings
rohlem b085c182 2022-07-04T16:38:05 make SDL_SetTextInputRect take a pointer to const The documentation doesn't state that the argument is ever modified, and no implementation does so currently. This is a non-breaking change to guarantee as much to callers.
Pierre Wendling 6c536afd 2022-06-27T15:43:17 Fix C89 declaration for macOS modules. Since Clang 14, `-Wdeclaration-after-statement` is enforced on every standard.
Simon McVittie 412ceb84 2022-05-24T16:27:54 video: Only check major version in SDL_GetWindowWMInfo Since #5602, SDL is intended to have the same ABI across the whole major-version 2 cycle, so we should not check that the minor version matches the one that was used to compile an application. There are two checks that could make sense here. The first check is that the major version matches the expected major version. This is usually unnecessary and is not usually done (if we're calling into the wrong library we'll likely crash anyway), but since we have the information, we might as well continue to use it. The second check is whether the version provided by the caller is equal to or greater than a threshold version at which additional fields were added to the struct. If it is, we should populate those fields; if it is not, then we cannot. This is only useful on platforms where additional fields have genuinely been added during the lifetime of SDL 2, like Windows and DirectFB (but not X11). This commit changes the first check to be consistent about only looking at the minor version, while leaving the second check using SDL_VERSIONNUM (which will be removed or widened in SDL 3, but it's fine for now). Resolves: https://github.com/libsdl-org/SDL/issues/5711 Fixes: cd7c2f1 "Switch versioning scheme to be the same as GLib and Flatpak" Signed-off-by: Simon McVittie <smcv@collabora.com>
Ryan C. Gordon 56665e1d 2022-05-17T12:50:13 cocoa: Try to use better system cursors. These try to pull from the .pdf files that are installed with macOS, which fit our needs better, and fall back to the most reasonable defaults available from NSCursor if we can't load them. Since these are installed under /System, they should be sandbox accessible, and if this totally fails, it should still go on, albeit with a less good cursor. Reference Issue #2123.
Alex Szpakowski e9c7b519 2022-05-16T21:03:41 macOS: Fix reference counts of internal window data. Fixes crashes when destroying or recreating a window (#5664).
Alex Szpakowski f871c178 2022-05-10T17:32:24 macOS: remove dead code for supporting 10.6 at runtime.
Alex Szpakowski ec8fa577 2022-05-07T21:57:23 macOS: always use Objective-C ARC (automatic ref counting). Change Cocoa SDL_VideoData and SDL_WindowData implementations from C structs to Objective-C objects, since bridging between C and ObjC is easier that way.
Sam Lantinga 7e636b03 2022-04-29T10:16:14 Removed log message length limitation for Apple platforms This works in conjunction with https://github.com/libsdl-org/SDL/pull/5584
Mirko Galimberti b293888c 2022-04-26T19:44:34 Fixes an issue introduced via #5573 when building for i686
FriendlyAI 795744fc 2022-01-07T10:11:46 Turn off relative mouse before window checks as well
FriendlyAI e2d268a3 2022-01-06T23:42:44 SDL_cocoamouse.m: SetRelativeMouseMode even if out of focus Should fix #3087
Mirko Galimberti 76afb858 2022-04-25T10:35:56 Introduces Cocoa_GetWindowDisplayIndex. This enable a proper management for dpi when switching between retina and non-retina displays.
Sam Lantinga 8f964576 2022-03-19T11:01:55 Fixed parameter operation ordering for ease of reading
Sam Lantinga 0517b61e 2022-03-19T11:00:00 Relative mouse mode is tied to the window with keyboard focus This isn't obvious, but makes sense when thinking about how games actually use it. This is also in line with how Windows mouse relative mode is implemented. Fixes https://github.com/libsdl-org/SDL/issues/5340
uyjulian a164c9d2 2022-01-04T10:43:34 SDL_cocoawindow.m: update fullscreen toggle when SDL_SetWindowResizable called
Ozkan Sezer ea0bca57 2022-01-11T14:56:56 SDL_cocoamodes.m: fix build against older SDKs. Fixes https://github.com/libsdl-org/SDL/issues/5208
Sam Lantinga 4b38d4c9 2022-01-07T12:37:28 Leave the Metal view active on the window when recreating the Metal renderer Fixes https://github.com/libsdl-org/SDL/issues/5140 Also move the metal tag definition to SDL_syswm.h so it can be used by applications
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Ozkan Sezer 4b112620 2022-01-02T19:11:50 SDL_cocoamodes.m (Cocoa_GetDisplayDPI): fix build using older toolchains Fixes https://github.com/libsdl-org/SDL/issues/5162
shinyquagsire23 6a7b6380 2021-12-28T12:07:56 Fix macOS cursor jumping to corner on first titlebar click
Edward Li a35a7d25 2021-12-25T05:00:26 Fix SigSegV from displayInfoInvalidate when changing resolution
Edward Li 1c41b535 2021-12-25T03:47:59 macOS: Calculate correct DPI by not using backingScaleFactor
Hanseul Jun 66fbf00e 2021-12-09T10:40:18 Temporarily ignore gl_config.driver_loaded check in Cocoa_GLES_SetupWindow.
Cameron Gutman da0f76de 2021-12-07T00:38:46 cocoa: Don't round scroll deltas from trackpads Rounding the scroll deltas from trackpads causes jerky scrolling behavior by artificially amplifying the effects of very small scroll movements. We should only round events from devices with discrete scroll wheels, because we know the smallest unit of movement there is a single tick.
Ryan C. Gordon ceb9e9a8 2021-11-21T00:21:41 cocoa: Removed a debug printf call.
Ryan C. Gordon 18715acb 2021-11-21T00:14:18 cocoa: Position non-left mouse button events in background windows correctly. Fixes #4828.
Sam Lantinga cc094f4d 2021-11-14T20:15:48 Fixed building with the macOS 10.8 SDK
Zack Middleton 1cd3e837 2021-11-14T15:51:38 cocoa: Fix abort on touch event types without a subtype macOS 10.6 has some touch NSEvents which do not have a subtype (Begin/EndGesture, Magnify, Rotate, Swipe) and cause an uncaught exception which triggers SIGABRT and the program exits. As it is, none of the macOS 10.6 touch events are detected as a trackpad (including Gesture due to using different subtypes).
Sam Lantinga 074e613b 2021-11-12T03:03:56 Fixed typo
Sam Lantinga 35d90f17 2021-11-12T03:00:57 Better implementation of SDL_SetWindowMouseGrab() and SDL_SetWindowMouseRect() on macOS
Sam Lantinga fd79607e 2021-11-08T21:34:48 Added SDL_GetWindowMouseRect() Also guarantee that we won't get mouse movement outside the confining area, even if the OS implementation allows it (e.g. macOS)
Sam Lantinga 4db546b0 2021-11-08T20:35:12 Implemented SDL_SetWindowMouseRect() on macOS
Alex Szpakowski ba4ef461 2021-10-23T15:28:13 macOS: Fix implicit integer downcast warnings
Cacodemon345 19dee1cd 2021-10-22T06:37:20 Add SDL_GetWindowICCProfile(). (#4314) * Add SDL_GetWindowICCProfile * Add new SDL display events * Implement ICC profile change event for macOS * Implement ICC profile notification for Windows * Fix SDL_GetWindowICCProfile() for X11 * Fix compile errors
James Howard d9c44b65 2021-10-19T10:49:17 Allow Cocoa_VideoInit to succeed when current display mode has invalid flags This fixes a specific issue seen on macOS 10.14.6 where a DELL E248WFP Display connected to a 2014 Mac Mini with a scaled 1920x1080 resolution selected and SDL_Init(SDL_INIT_VIDEO) failed with the error: "The video driver did not add any displays". The underlying cause was that the current 1080p display mode did not have the flag kDisplayModeSafeFlag, the check for which was added in a963e36, with the idea that certain display modes should not be candidates for switching to in fullscreen exclusive mode. That may well be the right thing to do for filtering down a list of candidate modes, but it doesn't pay to be so picky about the current mode. After all, this current mode was set by System Preferences, the picture does appear correctly on screen, and other non-SDL based applications launch and run correctly in this mode. Therefore the fix is to have GetDisplayMode only filter out a mode based on flags if it's part of a candidate list, but if it's the current mode and it can possibly be converted to an SDL_DisplayMode, do so.
Cameron Gutman 6f684f67 2021-07-29T18:20:36 cocoa: Add keyboard grab support CGSSetGlobalHotKeyOperatingMode() is not a public API, so we will only compile this in if SDL_MAC_NO_SANDBOX=1 is defined during compilation.
Sam Lantinga 51c61d7c 2021-07-27T14:57:18 Run the entire Cocoa messagebox function on the main thread. This fixes bug https://github.com/libsdl-org/SDL/issues/4420
Sam Lantinga dfd3f30e 2021-07-27T14:27:37 Make Cocoa_HandleTitleButtonEvent() static since it's not used anywhere else
Sam Lantinga 88e4755c 2021-07-27T12:43:00 Make sure we don't try to turn on relative mouse mode while clicking on the window title bar. This fixes bug https://github.com/libsdl-org/SDL/issues/4469
Sam Lantinga f1633127 2021-07-24T13:41:55 Added a window flash operation to be explicit about window flash behavior
Sam Lantinga e1c3a250 2021-07-24T12:11:27 Changed SDL_FlashWindow() so it doesn't take a flash count, and added the hint SDL_HINT_WINDOW_FLASH_COUNT to control behavior on Windows
Ethan Lee 56b77b12 2021-06-04T19:51:58 cocoa: Implement FlashWindow
Ozkan Sezer 2f248a2a 2021-06-11T04:00:32 SDL_cocoaevents.m: fix build against SDK < 10.12 after commit 0dd7024d.
Francesco Abbate 0dd7024d 2021-03-12T21:58:20 Modifies WaitEvent and WaitEventTimeout to actually wait instead of polling When possible use native os functions to make a blocking call waiting for an incoming event. Previous behavior was to continuously poll the event queue with a small delay between each poll. The blocking call uses a new optional video driver event, WaitEventTimeout, if available. It is called only if an window already shown is available. If present the window is designated using the variable wakeup_window to receive a wakeup event if needed. The WaitEventTimeout function accept a timeout parameter. If positive the call will wait for an event or return if the timeout expired without any event. If the timeout is zero it will implement a polling behavior. If the timeout is negative the function will block indefinetely waiting for an event. To let the main thread sees events sent form a different thread a "wake-up" signal is sent to the main thread if the main thread is in a blocking state. The wake-up event is sent to the designated wakeup_window if present. The wake-up event is sent only if the PushEvent call is coming from a different thread. Before sending the wake-up event the ID of the thread making the blocking call is saved using the variable blocking_thread_id and it is compared to the current thread's id to decide if the wake-up event should be sent. Two new optional video device methods are introduced: WaitEventTimeout SendWakeupEvent in addition the mutex wakeup_lock which is defined and initialized but only for the drivers supporting the methods above. If the methods are not present the system behaves as previously performing a periodic polling of the events queue. The blocking call is disabled if a joystick or sensor is detected and falls back to previous behavior.
Ryan C. Gordon 9dc97afa 2021-05-08T12:39:50 cocoa: Report an error if SDL_SetClipboardText() isn't using UTF-8 encoding. Fixes #4110.
Ryan C. Gordon 8527c583 2021-04-27T01:36:23 cocoa: Fix recreated windows that are both borderless and resizable. These would accidentally get a titlebar because the "borderless" style mask is zero but the resizable attribute adds a bit. I assume this happens because you used to need window decoration to resize a window in macOS, but this changed in later releases. This only caused problems when recreating a window (you had an SDL_WINDOW_OPENGL window and tried to create a Metal SDL_Renderer on it, etc). Fixes #4324.
Ryan C. Gordon 2fdbae22 2021-04-26T18:43:28 cocoa: Remove mouse event tap. It doesn't appear to work anymore, and was disabled by default anyhow, since the needed APIs are forbidden on the Mac App Store. A better solution to lock the mouse to the window on macOS would still be welcome. CGAssociateMouseAndMouseCursorPosition() works fine for relative mouse mode, this was just a question of SDL_SetWindowGrab(). As it stands now, a grabbed mouse can briefly break out of the window, causing varying degrees of chaos.
Joseph Lyncheski a0a5da5d 2021-04-19T07:13:38 Add SDL_SetWindowAlwaysOnTop()
Sam Lantinga 9ef0b97c 2021-04-12T11:25:44 Changes to macOS event handler to better interact with the running app - Only focus a new window when one closes if the window that was closed was an SDL window - If the application already has a key window set that is not an SDL window, don't replace it when the application is activated - Only register the URL event handler when SDLAppDelegate is going to be set as the applications app delegate. This is to be consistent with previous behavior that would only register the handler in -[SDLAppDelegate applicationDidFinishLaunching:] and allows the running app to opt out of the behavior by setting its own app delegate. - The URL event handler is now removed if it was set on SDLAppDelegate dealloc
Learath 033c0abb 2021-03-27T14:04:00 Use dispatch_async for -[NSOpenGLContext update]. Fixes #3680
Jay 0052339b 2021-02-20T19:53:44 Move handleURLEvent setEventHandler to init
Sam Lantinga cef198c9 2021-02-01T08:55:48 Fixed bug 5524 - Pass NSString to NSLog() Hiroyuki Iwatsuki If you pass the C string directly to NSLog(), it will be garbled with Japanese and probably other language strings, or no log will be output at all. NSLog("Hello, World!"); // => "Hello, World!" NSLog("こんにちは、世界!"); // => No output... Therefore, you need to convert the string to an NSString before passing it to NSLog(). NSString *str = [NSString stringWithUTF8String:"こんにちは、世界!"]; NSLog(@"%@", str); // => "こんにちは、世界!" Thank you.
Cameron Gutman 6b057c67 2021-01-26T19:16:17 Expose separate keyboard and mouse grab support This adds SDL_SetWindowKeyboardGrab(), SDL_GetWindowKeyboardGrab(), SDL_SetWindowMouseGrab(), SDL_GetWindowMouseGrab(), and new SDL_WINDOW_KEYBOARD_GRABBED flag. It also updates the test harness to exercise this functionality and makes a minor fix to X11 that I missed in https://hg.libsdl.org/SDL/rev/02a2d609369b To fit in with this new support, SDL_WINDOW_INPUT_CAPTURE has been renamed to SDL_WINDOW_MOUSE_CAPTURE with the old name remaining as an alias for backwards compatibility with older code.
Cameron Gutman a0d3c6c6 2021-01-25T21:42:14 Rename SetWindowGrab() to SetWindowMouseGrab()
Sam Lantinga e778881a 2021-01-07T11:49:28 Fixed bug 5449 - SDL_DROPFILE update mouse location of drop in Cocoa Dominik Reichardt Exult (http://exult.info) has an editor app that uses GTK+2. Up to now we were using X's drag'n'drop to allow dropping of assets from the editor onto Exult. There is now an experimental branch that makes use of SDL_DROPFILE. That works under X, dropping in Exult's SDL2 window puts the asset right at the spot you dropped at. On macOS with native Exult and Quartz GTK+2 this doesn't work, the location of the drop is where the mouse was last tracked before you left the window (usually one of the edges, unless you tabbed out). All we tried out pointed to the fact that the location update needs to be done by the dropfile event in SDL2, not by our own (which always only worked after the Exult window getting focus). This patch adds this to SDL_cocoawindow.m and it works perfectly, passing the correct coordinates to our code (SDL_GetMouseState()).