diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index 44d1bbbd84ddaa0898d07a56ee90df4e1c014740..8c2072bec53192bda42a333fb5c8711aeece5d4e 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -1162,7 +1162,9 @@ exports.menu_saveas = menu_saveas; function gui_canvas_print(name, initfile, initdir) { // AG: We simply ignore initfile and initdir, as the print dialog will // present its own file picker anyway if PDF output is chosen. + pdsend("pd gui-busy 1"); patchwin[name].print({ autoprint: false, headerString: initfile, footerString: path.join(initdir, initfile) }); + pdsend("pd gui-busy 0"); post("printed "+initfile); } diff --git a/pd/src/m_glob.c b/pd/src/m_glob.c index 2147047271868a021bb4f899b9aefdeecf56f6a2..6fca411ca59a08070c0c2b2fd9ee2a0da4f41eb7 100644 --- a/pd/src/m_glob.c +++ b/pd/src/m_glob.c @@ -107,6 +107,12 @@ static void glob_gui_properties(t_pd *dummy) sys_autopatch_yoffset); } +int sys_gui_busy; +static void glob_gui_busy(void *dummy, t_float f) +{ + sys_gui_busy = f != 0; +} + // ths one lives inside g_editor so that it can access the clipboard extern void glob_clipboard_text(t_pd *dummy, float f); @@ -201,6 +207,8 @@ void glob_init(void) gensym("add-recent-file"), A_SYMBOL, 0); class_addmethod(glob_pdobject, (t_method)glob_clear_recent_files, gensym("clear-recent-files"), 0); + class_addmethod(glob_pdobject, (t_method)glob_gui_busy, gensym("gui-busy"), + A_DEFFLOAT, 0); #ifdef UNIX class_addmethod(glob_pdobject, (t_method)glob_watchdog, gensym("watchdog"), 0); diff --git a/pd/src/m_sched.c b/pd/src/m_sched.c index e51d64038efa9ce0fe460236ef44c80f1c45559c..50654791f6a49104d0e3b893110dba558d2f345c 100644 --- a/pd/src/m_sched.c +++ b/pd/src/m_sched.c @@ -312,11 +312,12 @@ static void sched_pollformeters( void) { int inclip, outclip, indb, outdb; static int sched_nextmeterpolltime, sched_nextpingtime; + extern int sys_gui_busy; /* if there's no GUI but we're running in "realtime", here is where we arrange to ping the watchdog every 2 seconds. */ #if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__) - if (sys_nogui && sys_hipriority && (sched_diddsp - sched_nextpingtime > 0)) + if ((sys_nogui||sys_gui_busy) && sys_hipriority && (sched_diddsp - sched_nextpingtime > 0)) { glob_watchdog(0); /* ping every 2 seconds */