From 101f601011a3460d6c0d44c2c4b9ac5e46472f4b Mon Sep 17 00:00:00 2001 From: Christof Date: Sun, 6 Feb 2022 22:50:38 +0100 Subject: [PATCH] enable event loop by default on macOS only for the Pd app, not for libpd --- mac/README.txt | 6 +++--- src/s_main.c | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mac/README.txt b/mac/README.txt index b8aa3c7c33..95ecd4108f 100644 --- a/mac/README.txt +++ b/mac/README.txt @@ -249,9 +249,9 @@ the UI thread must be the main thread, otherwise it won't receive any input even to a secondary thread and runs a Cocoa event loop on the main thread. Unfortunately, some externals like 'Gem' or 'ophelia' already run their own (polling) -event loop and expect the scheduler to run on the main thread. To maintain backwards -compatibility we can't enable the event loop by default, instead users must request -it explicitly with the "-eventloop" flag. +event loop and expect the scheduler to run on the main thread. If you want to use +these externals, you have to disable the event loop, either by unchecking +"Enable event loop" in the "Startup" dialog or by starting Pd with "-noeventloop". For now, the event loop is only implemented for macOS, because there it is essential. Win32 and X11, on the other hand, don't have any notion of a "main thread", so externals diff --git a/src/s_main.c b/src/s_main.c index 851f2acc8c..e6693e91d5 100644 --- a/src/s_main.c +++ b/src/s_main.c @@ -342,6 +342,11 @@ int sys_main(int argc, const char **argv) const char *prefsfile = ""; sys_externalschedlib = 0; sys_extraflags = 0; +#ifdef __APPLE__ + /* on macOS we enable the event loop by default, + * but only for the Pd app (not for libpd). */ + sys_eventloop = 1; +#endif #ifdef PD_DEBUG fprintf(stderr, "Pd: COMPILED FOR DEBUGGING\n"); #endif