From 7b81ed296cd9a58fa2bb93633af453cea3e937d7 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Thu, 29 Oct 2015 20:23:27 -0400
Subject: [PATCH] add event listeners for browser window maximize, unmaximize,
 and resize to call gui_canvas_getscroll

---
 pd/nw/pd_canvas.js | 10 ++++++++++
 pd/nw/pdgui.js     |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/pd/nw/pd_canvas.js b/pd/nw/pd_canvas.js
index f19b371f4..174e7cfb0 100644
--- a/pd/nw/pd_canvas.js
+++ b/pd/nw/pd_canvas.js
@@ -398,6 +398,16 @@ var canvas_events = (function() {
     gui.Window.get().on("close", function() {
         pdgui.pdsend(name, "menuclose 0");
     });
+    gui.Window.get().on("maximize", function() {
+        pdgui.gui_canvas_getscroll(name);
+    });
+    gui.Window.get().on("unmaximize", function() {
+        pdgui.gui_canvas_getscroll(name);
+    });
+    gui.Window.get().on("resize", function() {
+        pdgui.gui_canvas_getscroll(name);
+    });
+
 
     return {
         none: function() {
diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index 0897bc38e..8060fd410 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -3160,6 +3160,8 @@ function gui_canvas_getscroll(cid) {
     getscroll_var = setTimeout(do_getscroll, 250, cid);
 }
 
+exports.gui_canvas_getscroll = gui_canvas_getscroll;
+
 // handling the selection
 function gui_lower(cid, tag) {
     var svg = patchwin[cid].window.document.getElementById("patchsvg"),
-- 
GitLab