Commit 08a7c4cb authored by Albert Gräf's avatar Albert Gräf
Browse files

Merge branch 'old-nwjs-fix' into 'ico-nwjs-04x'

Fixes to Ico's branch to make it work with the older nw.js versions we're using on the supported platforms

See merge request jwilkes/purr-data!411
parents 07e08eb5 cd758b7e
......@@ -21,7 +21,7 @@ body {
}
/* delete the default scrollbars, and let's make our own */
body::-webkit-scrollbar {
.patch_body::-webkit-scrollbar {
width: 0px;
height: 0px;
background: transparent;
......
......@@ -381,6 +381,28 @@ function nw_close_window(window) {
window.close(true);
}
function check_nwjs_version(version) {
// aggraef: check that process.versions["nw"] is at least the given version
// NOTE: We assume that "0.x.y" > "0.x", and just ignore any -beta
// suffixes if present.
var nwjs_array = process.versions["nw"].split("-")[0].
split(".").map(Number);
var vers_array = version.split("-")[0].
split(".").map(Number);
// lexicographic comparison
for (var i = 0; i < vers_array.length; ++i) {
if (nwjs_array.length <= i || vers_array[i] > nwjs_array[i])
return false;
else if (vers_array[i] < nwjs_array[i])
return true;
}
return vers_array.length <= nwjs_array.length;
}
// 0.46+ seems to be required for "null" to work. TODO: Bisect to get the
// actual minimum required version for this.
var null_pos = check_nwjs_version("0.46") ? "null" : "center";
function nw_create_window(cid, type, width, height, xpos, ypos, attr_array) {
// todo: make a separate way to format the title for OSX
var my_title;
......@@ -404,7 +426,7 @@ function nw_create_window(cid, type, width, height, xpos, ypos, attr_array) {
if (xpos == 0 && ypos == 0) {
pos = "center";
} else {
pos = "null";
pos = null_pos;
}
gui.Window.open(my_file, {
title: my_title,
......
......@@ -78,8 +78,8 @@
</button>
</div>
</dialog>
<div id="hscroll" style="background-color: #00000044; position: fixed; left: 2px; bottom: 2px; border-radius: 0px; width: 10px; height: 5px; visibility: hidden;"></div>
<div id="vscroll" style="background-color: #00000044; position: fixed; right: 2px; top: 2px; border-radius: 0px; width: 5px; height: 10px; visibility: hidden;"></div>
<div id="hscroll" style="background-color: rgba(0, 0, 0, 0.267); position: fixed; left: 2px; bottom: 2px; border-radius: 0px; width: 10px; height: 5px; visibility: hidden;"></div>
<div id="vscroll" style="background-color: rgba(0, 0, 0, 0.267); position: fixed; right: 2px; top: 2px; border-radius: 0px; width: 5px; height: 10px; visibility: hidden;"></div>
<script type="text/javascript" src="./pd_canvas.js"></script>
</body>
</html>
......@@ -1118,7 +1118,6 @@ var canvas_events = (function() {
pdgui.gui_canvas_get_scroll(name);
});
gui.Window.get().on("resize", function() {
pdgui.post("resize");
pdgui.gui_canvas_get_scroll(name);
});
gui.Window.get().on("focus", function() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment