From 5c290d9962d3812ea31a90e67982fff7d857c3b5 Mon Sep 17 00:00:00 2001 From: Jonathan Wilkes <jon.w.wilkes@gmail.com> Date: Sun, 24 Jan 2016 23:41:31 -0500 Subject: [PATCH] fix regression with prefs dialog failing to open anymore after clicking "Ok" --- pd/nw/dialog_prefs.html | 6 ++++++ pd/nw/pd_canvas.js | 3 +-- pd/nw/pdgui.js | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pd/nw/dialog_prefs.html b/pd/nw/dialog_prefs.html index ba491c778..04bfb54a9 100644 --- a/pd/nw/dialog_prefs.html +++ b/pd/nw/dialog_prefs.html @@ -393,6 +393,12 @@ function apply() { function cancel() { var i, attrs, gfxstub; pdgui.post("closing the window at this point"); + // There seems to be a bug in nwjs 0.13 beta3 that doesn't call the + // "close" event below. This has the symptom of making it impossible + // to click the "Ok" button and open the preferences dialog again after + // that. To see if the bug is gone, try removing the next line and see + // if you can open the Prefs dialog after clicking "Ok". + pdgui.remove_dialogwin(pd_object_callback); window.close(true); //pdgui.pdsend(pd_object_callback, "cancel"); } diff --git a/pd/nw/pd_canvas.js b/pd/nw/pd_canvas.js index b038c9d05..6f38388e2 100644 --- a/pd/nw/pd_canvas.js +++ b/pd/nw/pd_canvas.js @@ -615,8 +615,7 @@ var canvas_events = (function() { document.querySelector("#canvas_find_button").addEventListener("click", events.find_click); // We need to separate these into nw_window events and html5 DOM events - // closing the Window - // this isn't actually closing the window yet + // closing the Window this isn't actually closing the window yet gui.Window.get().on("close", function() { pdgui.pdsend(name, "menuclose 0"); }); diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index d4d39b200..e76076e89 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -3312,8 +3312,7 @@ function gui_pd_dsp(state) { function open_prefs() { if (!dialogwin["prefs"]) { - dialogwin["prefs"] = nw_create_window("prefs", "prefs", - 265, 540, 20, 20, null); + nw_create_window("prefs", "prefs", 265, 540, 20, 20, null); } } -- GitLab