-
Notifications
You must be signed in to change notification settings - Fork 2
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
Cocoa port #32
Cocoa port #32
Conversation
@AndroGR I need some help adding Cocoa to the CMakeLists.txt, I am not used to cmake |
Hello, In the meantime, if you have any questions, feel free to make them; I'm able to help at any moment. |
How do I add a new target to the cmake? in my testing this seems to completley not work as when I try to build it only goes to GTK4 |
You seem to have confused what previously written code (Specifically the ED: The |
Oh okay, thank you! |
Another thing I've noticed, you seem to mix Objective C and C code in one file, and then to the actual library. This is a horrible decision: It may not work between compilers due to different ABIs, may fail to build in the first place or may cause undefined behavior due to type mismatches. If possible, create a C file where you call the functions from another, independently built library. So something like this could do: // backend/cocoa/nvdialog_file_dialog.c
void nvd_get_file_location_cocoa(...) {
// FFI call, from your Obj-C code
nvd_get_file_location_cocoa_REAL(...)
} And implement If all that sounds hard, you can try writing a Makefile to use temporarily. You can also use |
Objective C is fully ABI compatible with C, and each C function (not methods) use the C ABI. If required I will do that, but it will be the same result |
from this #import <ObjFW/OFStdIOStream.h>
void fn(OFString *str)
{
[OFStdOut writeLine: str];
}
int main()
{
[OFStdOut writeLine: @"Calling!"];
fn(@"Called!");
}
|
Okay, I guess I'll leave that to you. |
I'll fix the CMake script to compile, I hope you can test if it actually compiles. |
The objc code def compiles and works, for I have used it for previous projects |
Still trying to build for GTK4 :/ GTK 4 runs on MacOS btw |
While it does, you can skip it altogether because the whole point of NvDialog is to use Cocoa in this case, or the native UI library in general on each system. |
How do I make it build with cocoa though |
Update: figured it out! |
Looks like we've got most of the work away. However I noticed you enabled the libadwaita backend too. You need to disable it:
Since the previous changes I made in CMakeLists.txt, if macOS is detected it will automatically use Cocoa. |
@AndroGR with the exeception of "about" and notifications, the PR should be ready |
For the about dialog part, is there a ready to use Cocoa function? Because otherwise you can skip it for now and make it return NULL when called. |
Also, make sure to sync with |
Nope, none from what I have seen |
Done, ready to be merged |
nvm found out how to make about windows |
it is done |
Merging, thanks for the contribution! |
this PR will eventually have a full port to Cocoa, the native GUI library for MacOS.