-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add native mac copy/paste support to imgui.cpp #2546
Add native mac copy/paste support to imgui.cpp #2546
Conversation
Thank you Andrew. XCode is generally very stringent when it comes to outlawing or warning on old code/api, do you know how well the old CF/Carbon functions would fare there? |
These calls are not (yet!) marked as deprecated in the headers. Their only markup is AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER So currently (Xcode 10/SDK 10.12) there are no warnings or errors. There is no guarantee this won't change in future of course, Apple being Apple, but it has been the same way since OS X 10.3. |
Merged with minor tweaks, thank you Andrew! |
…as with other implementation. Minor style tweaks. (#2546) Fixed IMGUI_DISABLE_WIN32_FUNCTIONS not disabling IME code.
Hi there. Running on OSX Mojave, using cmake and clang for a c++ project. |
Hi there. Could you try adding "-framework CoreFoundation" to the link line to resolve it? I'm surprised that you're getting this, as to run any OSX GUI app, you have to be linking against at least that framework. E.g., the example_sdl_opengl3 sample compiles for me on Mojave. Perhaps it's a link line ordering issue. |
I tried removing all frameworks other than OpenGL from the Makefile in that example, and it still links, because the OpenGL framework has a dependency on CoreFoundation (visible via otool). So given you must be linking with OpenGL, the question is why that's not being applied at your link point. Feel free to dump the linker command line that cmake is running in here and I can have a look. |
ok, I tried that. another linker error
|
Missing symbols are defined in ApplicationServices framework and it is not listed in build command. |
Okay, so that fixed _CFArrayGetCount and friends, and the rest as thedmd says are in ApplicationServices. That's the minimal set, but usually people just use -framework Cocoa. Another alternative if you don't use the built-in copy and paste is to compile with IMGUI_DISABLE_OSX_FUNCTIONS. |
You're assuming people are building something for OSX, not platform agnostic. what's the difference, in terms of functionality, between v1.70 and v1.71? |
I think we need to be reverting this, I've seen many team stumbling on the same problem. |
…in core library (added in 1.71), because it needs application to be linked with '-framework ApplicationServices'. It can be explicitly enabled back by using '#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS' in imconfig.h. Re-added equivalent using NSPasteboard api in the imgui_impl_osx.mm experimental back-end. (#2546)
This is now disabled by default by 29d9394 |
This small addition adds a Mac version of the Win32 "built in" copy/paste support, in roughly the same number of lines of code. It is written using the old CF API to avoid the need for a second .mm file. The added dependencies are from AppKit.framework, which is the base framework necessary for any Mac app. (It is brought in by the umbrella framework "Cocoa" used by the imgui Mac examples, for instance.)
I've removed the additional manual Set/GetClipboardText hooks from imgui_impl_osx.mm now they're no longer necessary, and also some stray file references from the example_apple_opengl2 xcode project.