From 5d3ae3228db6f39fea7ee9575eb1508b9615d207 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Tue, 10 Nov 2015 20:53:53 -0500
Subject: [PATCH] port menuitem to raise the pd_window

---
 pd/nw/locales/en/translation.json | 2 +-
 pd/nw/pd_canvas.js                | 6 +++++-
 pd/nw/pdgui.js                    | 6 ++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/pd/nw/locales/en/translation.json b/pd/nw/locales/en/translation.json
index 900b4de4b..1f083886a 100644
--- a/pd/nw/locales/en/translation.json
+++ b/pd/nw/locales/en/translation.json
@@ -200,7 +200,7 @@
     "prevwin_tt": "Give focus to the previous window in the stacking order",
     "parentwin": "Parent Window",
     "parentwin_tt": "give focus to the parent window of the current window",
-    "pdwin": "Pd & Console",
+    "pdwin": "Pd Window",
     "pdwin_tt": "Give focus to the main Pd window",
 
     "media": "Media",
diff --git a/pd/nw/pd_canvas.js b/pd/nw/pd_canvas.js
index fdb6aa376..d5a4f9826 100644
--- a/pd/nw/pd_canvas.js
+++ b/pd/nw/pd_canvas.js
@@ -1244,8 +1244,12 @@ function nw_create_patch_window_menus(name) {
 
     winmanMenu.append(new gui.MenuItem({
         label: l("menu.pdwin"),
-        click: menu_generic,
+        click: function() {
+            pdgui.raise_pd_window();
+        },
         tooltip: l("menu.pdwin_tt"),
+        key: "r",
+        modifiers: "ctrl"
     }));
 
     // Media menu
diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index c4fb56168..dcce0c462 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -2896,6 +2896,12 @@ function gui_raise_window(cid) {
     patchwin[cid].focus();
 }
 
+function raise_pd_window() {
+    pd_window.focus();
+}
+
+exports.raise_pd_window= raise_pd_window;
+
 // Openpanel and Savepanel
 
 var file_dialog_target;
-- 
GitLab