Skip to content

Commit ab20ab0

Browse files
committed
Release 1.2.3
1 parent 188ff82 commit ab20ab0

File tree

6 files changed

+48
-29
lines changed

6 files changed

+48
-29
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ There's a gazillion exciting things to do :)
119119

120120
Changelog
121121
---------
122+
2024-09-28: 1.2.3 fix primitiveInputSemaphore, fix iOS keyboard
122123
2024-06-22: 1.2.2 make copy/paste work on mobile
123124
2024-05-27: 1.2.1 add virtual cmd button, fix touch events
124125
2024-03-25: 1.2.0 add FFI and MIDI plugins, JIT for Sista bytecodes, JPEG write prim, fix keyboard input, copy/paste, scroll wheel, highdpi, allow ES6 in source

dist/squeak_bundle.js

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@
116116
Object.extend(Squeak,
117117
"version", {
118118
// system attributes
119-
vmVersion: "SqueakJS 1.2.2",
120-
vmDate: "2024-06-22", // Maybe replace at build time?
119+
vmVersion: "SqueakJS 1.2.3",
120+
vmDate: "2024-09-28", // Maybe replace at build time?
121121
vmBuild: "unknown", // or replace at runtime by last-modified?
122122
vmPath: "unknown", // Replace at runtime
123123
vmFile: "vm.js",
@@ -10090,7 +10090,7 @@
1009010090
clipBoardPromise
1009110091
.then(() => this.vm.popNandPush(1, this.makeStString(this.display.clipboardString)))
1009210092
.catch(() => this.vm.popNandPush(1, this.vm.nilObj))
10093-
.finally(() => unfreeze());
10093+
.finally(unfreeze);
1009410094
} else {
1009510095
if (typeof(this.display.clipboardString) !== 'string') return false;
1009610096
this.vm.popNandPush(1, this.makeStString(this.display.clipboardString));
@@ -10140,7 +10140,6 @@
1014010140
this.display.signalInputEvent = function() {
1014110141
this.signalSemaphoreWithIndex(this.inputEventSemaIndex);
1014210142
}.bind(this);
10143-
this.display.signalInputEvent();
1014410143
return this.popNIfOK(argCount);
1014510144
},
1014610145
primitiveInputWord: function(argCount) {
@@ -56815,10 +56814,7 @@
5681556814
input.setAttribute("autocapitalize", "off");
5681656815
input.setAttribute("spellcheck", "false");
5681756816
input.style.position = "absolute";
56818-
input.style.width = "0";
56819-
input.style.height = "0";
56820-
input.style.opacity = "0";
56821-
input.style.pointerEvents = "none";
56817+
input.style.left = "-1000px";
5682256818
canvas.parentElement.appendChild(input);
5682356819
// touch-keyboard buttons
5682456820
if ('ontouchstart' in document) {
@@ -56829,7 +56825,7 @@
5682956825
canvas.parentElement.appendChild(keyboardButton);
5683056826
keyboardButton.onmousedown = function(evt) {
5683156827
// show on-screen keyboard
56832-
input.focus();
56828+
input.focus({ preventScroll: true });
5683356829
evt.preventDefault();
5683456830
};
5683556831
keyboardButton.ontouchstart = keyboardButton.onmousedown;
@@ -56863,8 +56859,8 @@
5686356859
cmdButton.ontouchcancel = cmdButton.ontouchend;
5686456860
} else {
5686556861
// keep focus on input field
56866-
input.onblur = function() { input.focus(); };
56867-
input.focus();
56862+
input.onblur = function() { input.focus({ preventScroll: true }); };
56863+
input.focus({ preventScroll: true });
5686856864
}
5686956865
display.isMac = navigator.userAgent.includes("Mac");
5687056866
// emulate keypress events
@@ -56898,7 +56894,7 @@
5689856894
deadChars = deadChars.concat(chars);
5689956895
}
5690056896
}
56901-
if (!deadChars.length) input.value = ""; // clear input
56897+
if (!deadChars.length) resetInput();
5690256898
};
5690356899
input.onkeydown = function(evt) {
5690456900
checkFullscreen();
@@ -56961,21 +56957,43 @@
5696156957
if (!display.vm) return true;
5696256958
recordModifiers(evt, display);
5696356959
};
56960+
function resetInput() {
56961+
input.value = "**";
56962+
input.selectionStart = 1;
56963+
input.selectionEnd = 1;
56964+
}
56965+
resetInput();
56966+
// hack to generate arrow keys when moving the cursor (e.g. via spacebar on iPhone)
56967+
// we're not getting any events for that but the cursor (selection) changes
56968+
if ('ontouchstart' in document) {
56969+
let count = 0; // count how often the interval has run after the first move
56970+
setInterval(() => {
56971+
const direction = input.selectionStart - 1;
56972+
if (direction === 0) {
56973+
count = 0;
56974+
return;
56975+
}
56976+
// move cursor once, then not for 500ms, then every 250ms
56977+
if (count === 0 || count > 2) {
56978+
const key = direction < 1 ? 28 : 29; // arrow left or right
56979+
recordKeyboardEvent(key, Date.now(), display);
56980+
}
56981+
input.selectionStart = 1;
56982+
input.selectionEnd = 1;
56983+
count++;
56984+
}, 250);
56985+
}
5696456986
// more copy/paste
5696556987
if (navigator.clipboard) {
5696656988
// new-style copy/paste (all modern browsers)
56967-
display.readFromSystemClipboard = () => navigator.clipboard.readText()
56989+
display.readFromSystemClipboard = () => display.handlingEvent &&
56990+
navigator.clipboard.readText()
5696856991
.then(text => display.clipboardString = text)
56969-
.catch(err => {
56970-
if (!display.handlingEvent) console.warn("reading from clipboard outside event handler");
56971-
console.error("readFromSystemClipboard" + err.message);
56972-
});
56973-
display.writeToSystemClipboard = () => navigator.clipboard.writeText(display.clipboardString)
56992+
.catch(err => console.error("readFromSystemClipboard " + err.message));
56993+
display.writeToSystemClipboard = () => display.handlingEvent &&
56994+
navigator.clipboard.writeText(display.clipboardString)
5697456995
.then(() => display.clipboardStringChanged = false)
56975-
.catch(err => {
56976-
if (!display.handlingEvent) console.warn("writing to clipboard outside event handler");
56977-
console.error("writeToSystemClipboard" + err.message);
56978-
});
56996+
.catch(err => console.error("writeToSystemClipboard " + err.message));
5697956997
} else {
5698056998
// old-style copy/paste
5698156999
document.oncopy = function(evt, key) {

dist/squeak_headless_bundle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ if (!Function.prototype.subclass) {
113113
Object.extend(Squeak,
114114
"version", {
115115
// system attributes
116-
vmVersion: "SqueakJS 1.2.2",
117-
vmDate: "2024-06-22", // Maybe replace at build time?
116+
vmVersion: "SqueakJS 1.2.3",
117+
vmDate: "2024-09-28", // Maybe replace at build time?
118118
vmBuild: "unknown", // or replace at runtime by last-modified?
119119
vmPath: "unknown", // Replace at runtime
120120
vmFile: "vm.js",

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codefrau/squeakjs",
3-
"version": "1.2.1",
3+
"version": "1.2.3",
44
"description": "Virtual Machine for Squeak Smalltalk and derivatives",
55
"author": "Vanessa Freudenberg <[email protected]> (https://twitter.com/codefrau)",
66
"repository": "https://github.com/codefrau/SqueakJS",

vm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
Object.extend(Squeak,
2525
"version", {
2626
// system attributes
27-
vmVersion: "SqueakJS 1.2.2",
28-
vmDate: "2024-06-22", // Maybe replace at build time?
27+
vmVersion: "SqueakJS 1.2.3",
28+
vmDate: "2024-09-28", // Maybe replace at build time?
2929
vmBuild: "unknown", // or replace at runtime by last-modified?
3030
vmPath: "unknown", // Replace at runtime
3131
vmFile: "vm.js",

0 commit comments

Comments
 (0)