Skip to content

Comments

Auto-detect macOS and set GDK_BACKEND to Quartz#391

Open
capt-marbles wants to merge 1 commit intocsete:masterfrom
capt-marbles:master
Open

Auto-detect macOS and set GDK_BACKEND to Quartz#391
capt-marbles wants to merge 1 commit intocsete:masterfrom
capt-marbles:master

Conversation

@capt-marbles
Copy link

Description:

Problem: GPredict fails to launch on macOS with the error "Failed to open display (null)" because GTK defaults to X11/Wayland backends instead of the native Quartz backend.

Solution: Add auto-detection using the APPLE preprocessor macro to set GDK_BACKEND=quartz before GTK initialization. This respects user-defined values — if the user has already set GDK_BACKEND, it won't be overridden.

Changes:

• Added 6 lines in src/main.c before gtk_init()
• Uses GLib's g_getenv() and g_setenv() for consistency
• Zero impact on non-macOS builds (preprocessor conditional)

Testing:

• Built and tested on macOS with Homebrew — launches without XQuartz

Adding an extra check to ensure MacOS compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant