quickwin 1.1.4 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +7 -3
- package/README.md +7 -3
- package/examples/exec_server.js +3535 -34
- package/examples/exec_server.ts +71 -26
- package/examples/exec_server_worker.js +45 -0
- package/examples/exec_server_worker.ts +39 -0
- package/examples/pdf_viewer.js +11 -10
- package/examples/setres.js +104 -0
- package/examples/setres.ts +120 -0
- package/examples/test_gallery.js +11 -10
- package/examples/test_react_lazy.js +11 -10
- package/examples/test_react_listbox.js +11 -10
- package/examples/test_root_window.js +11 -10
- package/examples/test_tab.js +11 -10
- package/lib/fetch.js +35 -7
- package/lib/fetch.ts +24 -4
- package/lib/text-measure.js +8 -6
- package/lib/text-measure.ts +8 -6
- package/main.js +46 -0
- package/package.json +2 -1
- package/quickwin.d.ts +2 -1
- package/qwin-nowasm-x86.exe +0 -0
- package/qwin-nowasm.exe +0 -0
- package/qwin-x86.exe +0 -0
- package/qwin.exe +0 -0
- package/test/run.js +4 -1
- package/test/run.ts +4 -1
- package/test/test_net_fetch.js +62 -0
- package/test/test_net_fetch.ts +72 -0
- package/test/test_react_complex.js +14 -13
- package/test/test_react_counter.js +11 -10
- package/test/test_react_flex.js +11 -10
- package/test/test_react_hidden.js +13 -12
- package/test/test_react_listview_link.js +11 -10
- package/test/test_react_render.js +11 -10
- package/test/test_wolfssl_read.js +201 -0
- package/test/test_wolfssl_read.ts +181 -0
- package/test/test_worker_concurrent.js +45 -0
- package/test/test_worker_concurrent.ts +56 -0
- package/test/test_worker_data_url.js +46 -0
- package/test/test_worker_data_url.ts +51 -0
package/test/test_net_fetch.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import '../lib/fetch.js'
|
|
2
2
|
import * as std from 'std'
|
|
3
|
+
import * as os from 'os'
|
|
3
4
|
import { Tester } from './test_helper.js'
|
|
4
5
|
|
|
5
6
|
export const suite = {
|
|
@@ -234,5 +235,76 @@ export const suite = {
|
|
|
234
235
|
} else {
|
|
235
236
|
assert('https endpoint reachable', false)
|
|
236
237
|
}
|
|
238
|
+
|
|
239
|
+
// ── large HTTPS body (wolfSSL_read null regression) ──
|
|
240
|
+
// Pre-fix: wolfSSL_read returned number -1 on WANT_READ →
|
|
241
|
+
// receivedBytes became NaN → stream never closed → hang.
|
|
242
|
+
t.section('large HTTPS body')
|
|
243
|
+
{
|
|
244
|
+
const LARGE = 200000
|
|
245
|
+
try {
|
|
246
|
+
const r = await Promise.race([
|
|
247
|
+
fetch(`https://localhost:18924/large/${LARGE}`, { timeout: 15000 }),
|
|
248
|
+
new Promise<never>((_, rej) =>
|
|
249
|
+
os.setTimeout(() => rej(new Error('Body hang watchdog 15s')), 15000)
|
|
250
|
+
)
|
|
251
|
+
])
|
|
252
|
+
assert('large HTTPS status 200', r.status === 200)
|
|
253
|
+
const buf = await Promise.race([
|
|
254
|
+
r.arrayBuffer(),
|
|
255
|
+
new Promise<never>((_, rej) =>
|
|
256
|
+
os.setTimeout(() => rej(new Error('arrayBuffer hang watchdog 15s')), 15000)
|
|
257
|
+
)
|
|
258
|
+
])
|
|
259
|
+
assert('large HTTPS byteLength exact', buf.byteLength === LARGE)
|
|
260
|
+
} catch (e: unknown) {
|
|
261
|
+
assert('large HTTPS completed without hang (' + String((e as Error).message) + ')', false)
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// ── large HTTP body (sock.recv path same null contract) ──
|
|
266
|
+
t.section('large HTTP body')
|
|
267
|
+
{
|
|
268
|
+
const LARGE = 200000
|
|
269
|
+
try {
|
|
270
|
+
const r = await Promise.race([
|
|
271
|
+
fetch(`http://localhost:18923/large/${LARGE}`, { timeout: 15000 }),
|
|
272
|
+
new Promise<never>((_, rej) =>
|
|
273
|
+
os.setTimeout(() => rej(new Error('Body hang watchdog 15s')), 15000)
|
|
274
|
+
)
|
|
275
|
+
])
|
|
276
|
+
assert('large HTTP status 200', r.status === 200)
|
|
277
|
+
const buf = await Promise.race([
|
|
278
|
+
r.arrayBuffer(),
|
|
279
|
+
new Promise<never>((_, rej) =>
|
|
280
|
+
os.setTimeout(() => rej(new Error('arrayBuffer hang watchdog 15s')), 15000)
|
|
281
|
+
)
|
|
282
|
+
])
|
|
283
|
+
assert('large HTTP byteLength exact', buf.byteLength === LARGE)
|
|
284
|
+
} catch (e: unknown) {
|
|
285
|
+
assert('large HTTP completed (' + String((e as Error).message) + ')', false)
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// ── body timeout after headers (armTimeout after doResolve) ──
|
|
290
|
+
t.section('HTTPS body timeout')
|
|
291
|
+
{
|
|
292
|
+
let rejected = false
|
|
293
|
+
let msg = ''
|
|
294
|
+
try {
|
|
295
|
+
const r = await fetch('https://localhost:18924/stall', { timeout: 2000 })
|
|
296
|
+
await Promise.race([
|
|
297
|
+
r.arrayBuffer(),
|
|
298
|
+
new Promise<never>((_, rej) =>
|
|
299
|
+
os.setTimeout(() => rej(new Error('Body timeout')), 8000)
|
|
300
|
+
)
|
|
301
|
+
])
|
|
302
|
+
} catch (e: unknown) {
|
|
303
|
+
rejected = true
|
|
304
|
+
msg = String((e as Error).message)
|
|
305
|
+
}
|
|
306
|
+
assert('stall body rejects (timeout)', rejected)
|
|
307
|
+
assert('stall error mentions timeout', /timeout/i.test(msg))
|
|
308
|
+
}
|
|
237
309
|
}
|
|
238
310
|
}
|
|
@@ -15358,7 +15358,7 @@ var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
|
|
|
15358
15358
|
var import_react18 = __toESM(require_react(), 1);
|
|
15359
15359
|
import "../lib/polyfill.js";
|
|
15360
15360
|
import * as gui19 from "gui";
|
|
15361
|
-
import * as
|
|
15361
|
+
import * as os3 from "os";
|
|
15362
15362
|
|
|
15363
15363
|
// _build/lib/react-qw/index.js
|
|
15364
15364
|
import * as gui18 from "gui";
|
|
@@ -15368,7 +15368,7 @@ var import_react_reconciler = __toESM(require_react_reconciler(), 1);
|
|
|
15368
15368
|
var import_react = __toESM(require_react(), 1);
|
|
15369
15369
|
var import_constants = __toESM(require_constants(), 1);
|
|
15370
15370
|
import * as gui3 from "gui";
|
|
15371
|
-
import * as
|
|
15371
|
+
import * as os2 from "os";
|
|
15372
15372
|
|
|
15373
15373
|
// _build/lib/react-qw/props.js
|
|
15374
15374
|
import * as gui from "gui";
|
|
@@ -15489,6 +15489,7 @@ function calculateFlexLayout(flex, parentW, parentH, children) {
|
|
|
15489
15489
|
|
|
15490
15490
|
// _build/lib/text-measure.js
|
|
15491
15491
|
import * as ffi from "ffi";
|
|
15492
|
+
import * as os from "os";
|
|
15492
15493
|
import * as win from "win";
|
|
15493
15494
|
import * as gui2 from "gui";
|
|
15494
15495
|
function loadProc(lib, name) {
|
|
@@ -15505,7 +15506,7 @@ var DrawTextW = loadProc(user32, "DrawTextW");
|
|
|
15505
15506
|
var GetDC = loadProc(user32, "GetDC");
|
|
15506
15507
|
var ReleaseDC = loadProc(user32, "ReleaseDC");
|
|
15507
15508
|
var SelectObject = loadProc(gdi32, "SelectObject");
|
|
15508
|
-
var
|
|
15509
|
+
var FFI_HND = os.arch === "ia32" ? ffi.FFI_TYPE_UINT32 : ffi.FFI_TYPE_UINT64;
|
|
15509
15510
|
var FFI_S32 = ffi.FFI_TYPE_SINT32;
|
|
15510
15511
|
var FFI_PTR = ffi.FFI_TYPE_POINTER;
|
|
15511
15512
|
function measureText(hdc, text, maxWidth) {
|
|
@@ -15513,14 +15514,14 @@ function measureText(hdc, text, maxWidth) {
|
|
|
15513
15514
|
const rect = new ArrayBuffer(16);
|
|
15514
15515
|
const dv = new DataView(rect);
|
|
15515
15516
|
dv.setInt32(8, maxWidth, true);
|
|
15516
|
-
ffi.ffiCall(DrawTextW, [
|
|
15517
|
+
ffi.ffiCall(DrawTextW, [FFI_HND, FFI_PTR, FFI_S32, FFI_PTR, FFI_S32], [
|
|
15517
15518
|
hdc,
|
|
15518
15519
|
textBuf,
|
|
15519
15520
|
-1,
|
|
15520
15521
|
rect,
|
|
15521
15522
|
1024
|
|
15522
15523
|
/* gui.DrawTextFlag.CALCRECT */
|
|
15523
|
-
],
|
|
15524
|
+
], FFI_S32);
|
|
15524
15525
|
return { width: dv.getInt32(8, true), height: dv.getInt32(12, true) };
|
|
15525
15526
|
}
|
|
15526
15527
|
function getButtonIdealSize(hwnd2) {
|
|
@@ -15530,15 +15531,15 @@ function getButtonIdealSize(hwnd2) {
|
|
|
15530
15531
|
return { width: dv.getInt32(0, true), height: dv.getInt32(4, true) };
|
|
15531
15532
|
}
|
|
15532
15533
|
function measureTextForHwnd(hwnd2, text) {
|
|
15533
|
-
const hdc = ffi.ffiCall(GetDC, [
|
|
15534
|
+
const hdc = ffi.ffiCall(GetDC, [FFI_HND], [hwnd2], FFI_HND);
|
|
15534
15535
|
if (!hdc)
|
|
15535
15536
|
return { width: 0, height: 0 };
|
|
15536
15537
|
const hFont = gui2.SendMessage(hwnd2, 49, 0, 0);
|
|
15537
|
-
const oldFont = hFont ? ffi.ffiCall(SelectObject, [
|
|
15538
|
+
const oldFont = hFont ? ffi.ffiCall(SelectObject, [FFI_HND, FFI_HND], [hdc, hFont], FFI_HND) : 0;
|
|
15538
15539
|
const result = measureText(hdc, text, 0);
|
|
15539
15540
|
if (hFont)
|
|
15540
|
-
ffi.ffiCall(SelectObject, [
|
|
15541
|
-
ffi.ffiCall(ReleaseDC, [
|
|
15541
|
+
ffi.ffiCall(SelectObject, [FFI_HND, FFI_HND], [hdc, oldFont], FFI_HND);
|
|
15542
|
+
ffi.ffiCall(ReleaseDC, [FFI_HND, FFI_HND], [hwnd2, hdc], FFI_S32);
|
|
15542
15543
|
const wr = gui2.GetWindowRect(hwnd2);
|
|
15543
15544
|
const cr = gui2.GetClientRect(hwnd2);
|
|
15544
15545
|
if (wr && cr) {
|
|
@@ -15851,10 +15852,10 @@ var hostConfig = {
|
|
|
15851
15852
|
clearContainer(_container) {
|
|
15852
15853
|
},
|
|
15853
15854
|
scheduleTimeout(fn, delay) {
|
|
15854
|
-
return
|
|
15855
|
+
return os2.setTimeout(fn, delay);
|
|
15855
15856
|
},
|
|
15856
15857
|
cancelTimeout(id) {
|
|
15857
|
-
|
|
15858
|
+
os2.clearTimeout?.(id);
|
|
15858
15859
|
},
|
|
15859
15860
|
noTimeout: -1,
|
|
15860
15861
|
supportsMutation: true,
|
|
@@ -17279,9 +17280,9 @@ function printWindowTree(hwnd2, indent = 0) {
|
|
|
17279
17280
|
function mockSetInterval(func, delay) {
|
|
17280
17281
|
function loop() {
|
|
17281
17282
|
func();
|
|
17282
|
-
|
|
17283
|
+
os3.setTimeout(loop, delay);
|
|
17283
17284
|
}
|
|
17284
|
-
|
|
17285
|
+
os3.setTimeout(loop, delay);
|
|
17285
17286
|
}
|
|
17286
17287
|
gui19.RegisterClass("ComplexTest", (hwnd2, msg, wParam, lParam) => {
|
|
17287
17288
|
if (!hwnd2)
|
|
@@ -15367,7 +15367,7 @@ var import_react_reconciler = __toESM(require_react_reconciler(), 1);
|
|
|
15367
15367
|
var import_react = __toESM(require_react(), 1);
|
|
15368
15368
|
var import_constants = __toESM(require_constants(), 1);
|
|
15369
15369
|
import * as gui3 from "gui";
|
|
15370
|
-
import * as
|
|
15370
|
+
import * as os2 from "os";
|
|
15371
15371
|
|
|
15372
15372
|
// _build/lib/react-qw/props.js
|
|
15373
15373
|
import * as gui from "gui";
|
|
@@ -15488,6 +15488,7 @@ function calculateFlexLayout(flex, parentW, parentH, children) {
|
|
|
15488
15488
|
|
|
15489
15489
|
// _build/lib/text-measure.js
|
|
15490
15490
|
import * as ffi from "ffi";
|
|
15491
|
+
import * as os from "os";
|
|
15491
15492
|
import * as win from "win";
|
|
15492
15493
|
import * as gui2 from "gui";
|
|
15493
15494
|
function loadProc(lib, name) {
|
|
@@ -15504,7 +15505,7 @@ var DrawTextW = loadProc(user32, "DrawTextW");
|
|
|
15504
15505
|
var GetDC = loadProc(user32, "GetDC");
|
|
15505
15506
|
var ReleaseDC = loadProc(user32, "ReleaseDC");
|
|
15506
15507
|
var SelectObject = loadProc(gdi32, "SelectObject");
|
|
15507
|
-
var
|
|
15508
|
+
var FFI_HND = os.arch === "ia32" ? ffi.FFI_TYPE_UINT32 : ffi.FFI_TYPE_UINT64;
|
|
15508
15509
|
var FFI_S32 = ffi.FFI_TYPE_SINT32;
|
|
15509
15510
|
var FFI_PTR = ffi.FFI_TYPE_POINTER;
|
|
15510
15511
|
function measureText(hdc, text, maxWidth) {
|
|
@@ -15512,14 +15513,14 @@ function measureText(hdc, text, maxWidth) {
|
|
|
15512
15513
|
const rect = new ArrayBuffer(16);
|
|
15513
15514
|
const dv = new DataView(rect);
|
|
15514
15515
|
dv.setInt32(8, maxWidth, true);
|
|
15515
|
-
ffi.ffiCall(DrawTextW, [
|
|
15516
|
+
ffi.ffiCall(DrawTextW, [FFI_HND, FFI_PTR, FFI_S32, FFI_PTR, FFI_S32], [
|
|
15516
15517
|
hdc,
|
|
15517
15518
|
textBuf,
|
|
15518
15519
|
-1,
|
|
15519
15520
|
rect,
|
|
15520
15521
|
1024
|
|
15521
15522
|
/* gui.DrawTextFlag.CALCRECT */
|
|
15522
|
-
],
|
|
15523
|
+
], FFI_S32);
|
|
15523
15524
|
return { width: dv.getInt32(8, true), height: dv.getInt32(12, true) };
|
|
15524
15525
|
}
|
|
15525
15526
|
function getButtonIdealSize(hwnd2) {
|
|
@@ -15529,15 +15530,15 @@ function getButtonIdealSize(hwnd2) {
|
|
|
15529
15530
|
return { width: dv.getInt32(0, true), height: dv.getInt32(4, true) };
|
|
15530
15531
|
}
|
|
15531
15532
|
function measureTextForHwnd(hwnd2, text) {
|
|
15532
|
-
const hdc = ffi.ffiCall(GetDC, [
|
|
15533
|
+
const hdc = ffi.ffiCall(GetDC, [FFI_HND], [hwnd2], FFI_HND);
|
|
15533
15534
|
if (!hdc)
|
|
15534
15535
|
return { width: 0, height: 0 };
|
|
15535
15536
|
const hFont = gui2.SendMessage(hwnd2, 49, 0, 0);
|
|
15536
|
-
const oldFont = hFont ? ffi.ffiCall(SelectObject, [
|
|
15537
|
+
const oldFont = hFont ? ffi.ffiCall(SelectObject, [FFI_HND, FFI_HND], [hdc, hFont], FFI_HND) : 0;
|
|
15537
15538
|
const result = measureText(hdc, text, 0);
|
|
15538
15539
|
if (hFont)
|
|
15539
|
-
ffi.ffiCall(SelectObject, [
|
|
15540
|
-
ffi.ffiCall(ReleaseDC, [
|
|
15540
|
+
ffi.ffiCall(SelectObject, [FFI_HND, FFI_HND], [hdc, oldFont], FFI_HND);
|
|
15541
|
+
ffi.ffiCall(ReleaseDC, [FFI_HND, FFI_HND], [hwnd2, hdc], FFI_S32);
|
|
15541
15542
|
const wr = gui2.GetWindowRect(hwnd2);
|
|
15542
15543
|
const cr = gui2.GetClientRect(hwnd2);
|
|
15543
15544
|
if (wr && cr) {
|
|
@@ -15850,10 +15851,10 @@ var hostConfig = {
|
|
|
15850
15851
|
clearContainer(_container) {
|
|
15851
15852
|
},
|
|
15852
15853
|
scheduleTimeout(fn, delay) {
|
|
15853
|
-
return
|
|
15854
|
+
return os2.setTimeout(fn, delay);
|
|
15854
15855
|
},
|
|
15855
15856
|
cancelTimeout(id) {
|
|
15856
|
-
|
|
15857
|
+
os2.clearTimeout?.(id);
|
|
15857
15858
|
},
|
|
15858
15859
|
noTimeout: -1,
|
|
15859
15860
|
supportsMutation: true,
|
package/test/test_react_flex.js
CHANGED
|
@@ -15367,7 +15367,7 @@ var import_react_reconciler = __toESM(require_react_reconciler(), 1);
|
|
|
15367
15367
|
var import_react = __toESM(require_react(), 1);
|
|
15368
15368
|
var import_constants = __toESM(require_constants(), 1);
|
|
15369
15369
|
import * as gui3 from "gui";
|
|
15370
|
-
import * as
|
|
15370
|
+
import * as os2 from "os";
|
|
15371
15371
|
|
|
15372
15372
|
// _build/lib/react-qw/props.js
|
|
15373
15373
|
import * as gui from "gui";
|
|
@@ -15488,6 +15488,7 @@ function calculateFlexLayout(flex, parentW, parentH, children) {
|
|
|
15488
15488
|
|
|
15489
15489
|
// _build/lib/text-measure.js
|
|
15490
15490
|
import * as ffi from "ffi";
|
|
15491
|
+
import * as os from "os";
|
|
15491
15492
|
import * as win from "win";
|
|
15492
15493
|
import * as gui2 from "gui";
|
|
15493
15494
|
function loadProc(lib, name) {
|
|
@@ -15504,7 +15505,7 @@ var DrawTextW = loadProc(user32, "DrawTextW");
|
|
|
15504
15505
|
var GetDC = loadProc(user32, "GetDC");
|
|
15505
15506
|
var ReleaseDC = loadProc(user32, "ReleaseDC");
|
|
15506
15507
|
var SelectObject = loadProc(gdi32, "SelectObject");
|
|
15507
|
-
var
|
|
15508
|
+
var FFI_HND = os.arch === "ia32" ? ffi.FFI_TYPE_UINT32 : ffi.FFI_TYPE_UINT64;
|
|
15508
15509
|
var FFI_S32 = ffi.FFI_TYPE_SINT32;
|
|
15509
15510
|
var FFI_PTR = ffi.FFI_TYPE_POINTER;
|
|
15510
15511
|
function measureText(hdc, text, maxWidth) {
|
|
@@ -15512,14 +15513,14 @@ function measureText(hdc, text, maxWidth) {
|
|
|
15512
15513
|
const rect = new ArrayBuffer(16);
|
|
15513
15514
|
const dv = new DataView(rect);
|
|
15514
15515
|
dv.setInt32(8, maxWidth, true);
|
|
15515
|
-
ffi.ffiCall(DrawTextW, [
|
|
15516
|
+
ffi.ffiCall(DrawTextW, [FFI_HND, FFI_PTR, FFI_S32, FFI_PTR, FFI_S32], [
|
|
15516
15517
|
hdc,
|
|
15517
15518
|
textBuf,
|
|
15518
15519
|
-1,
|
|
15519
15520
|
rect,
|
|
15520
15521
|
1024
|
|
15521
15522
|
/* gui.DrawTextFlag.CALCRECT */
|
|
15522
|
-
],
|
|
15523
|
+
], FFI_S32);
|
|
15523
15524
|
return { width: dv.getInt32(8, true), height: dv.getInt32(12, true) };
|
|
15524
15525
|
}
|
|
15525
15526
|
function getButtonIdealSize(hwnd) {
|
|
@@ -15529,15 +15530,15 @@ function getButtonIdealSize(hwnd) {
|
|
|
15529
15530
|
return { width: dv.getInt32(0, true), height: dv.getInt32(4, true) };
|
|
15530
15531
|
}
|
|
15531
15532
|
function measureTextForHwnd(hwnd, text) {
|
|
15532
|
-
const hdc = ffi.ffiCall(GetDC, [
|
|
15533
|
+
const hdc = ffi.ffiCall(GetDC, [FFI_HND], [hwnd], FFI_HND);
|
|
15533
15534
|
if (!hdc)
|
|
15534
15535
|
return { width: 0, height: 0 };
|
|
15535
15536
|
const hFont = gui2.SendMessage(hwnd, 49, 0, 0);
|
|
15536
|
-
const oldFont = hFont ? ffi.ffiCall(SelectObject, [
|
|
15537
|
+
const oldFont = hFont ? ffi.ffiCall(SelectObject, [FFI_HND, FFI_HND], [hdc, hFont], FFI_HND) : 0;
|
|
15537
15538
|
const result = measureText(hdc, text, 0);
|
|
15538
15539
|
if (hFont)
|
|
15539
|
-
ffi.ffiCall(SelectObject, [
|
|
15540
|
-
ffi.ffiCall(ReleaseDC, [
|
|
15540
|
+
ffi.ffiCall(SelectObject, [FFI_HND, FFI_HND], [hdc, oldFont], FFI_HND);
|
|
15541
|
+
ffi.ffiCall(ReleaseDC, [FFI_HND, FFI_HND], [hwnd, hdc], FFI_S32);
|
|
15541
15542
|
const wr = gui2.GetWindowRect(hwnd);
|
|
15542
15543
|
const cr = gui2.GetClientRect(hwnd);
|
|
15543
15544
|
if (wr && cr) {
|
|
@@ -15850,10 +15851,10 @@ var hostConfig = {
|
|
|
15850
15851
|
clearContainer(_container) {
|
|
15851
15852
|
},
|
|
15852
15853
|
scheduleTimeout(fn, delay) {
|
|
15853
|
-
return
|
|
15854
|
+
return os2.setTimeout(fn, delay);
|
|
15854
15855
|
},
|
|
15855
15856
|
cancelTimeout(id) {
|
|
15856
|
-
|
|
15857
|
+
os2.clearTimeout?.(id);
|
|
15857
15858
|
},
|
|
15858
15859
|
noTimeout: -1,
|
|
15859
15860
|
supportsMutation: true,
|
|
@@ -15358,7 +15358,7 @@ var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
|
|
|
15358
15358
|
var import_react18 = __toESM(require_react(), 1);
|
|
15359
15359
|
import "../lib/polyfill.js";
|
|
15360
15360
|
import * as gui19 from "gui";
|
|
15361
|
-
import * as
|
|
15361
|
+
import * as os3 from "os";
|
|
15362
15362
|
|
|
15363
15363
|
// _build/lib/react-qw/index.js
|
|
15364
15364
|
import * as gui18 from "gui";
|
|
@@ -15368,7 +15368,7 @@ var import_react_reconciler = __toESM(require_react_reconciler(), 1);
|
|
|
15368
15368
|
var import_react = __toESM(require_react(), 1);
|
|
15369
15369
|
var import_constants = __toESM(require_constants(), 1);
|
|
15370
15370
|
import * as gui3 from "gui";
|
|
15371
|
-
import * as
|
|
15371
|
+
import * as os2 from "os";
|
|
15372
15372
|
|
|
15373
15373
|
// _build/lib/react-qw/props.js
|
|
15374
15374
|
import * as gui from "gui";
|
|
@@ -15489,6 +15489,7 @@ function calculateFlexLayout(flex, parentW, parentH, children) {
|
|
|
15489
15489
|
|
|
15490
15490
|
// _build/lib/text-measure.js
|
|
15491
15491
|
import * as ffi from "ffi";
|
|
15492
|
+
import * as os from "os";
|
|
15492
15493
|
import * as win from "win";
|
|
15493
15494
|
import * as gui2 from "gui";
|
|
15494
15495
|
function loadProc(lib, name) {
|
|
@@ -15505,7 +15506,7 @@ var DrawTextW = loadProc(user32, "DrawTextW");
|
|
|
15505
15506
|
var GetDC = loadProc(user32, "GetDC");
|
|
15506
15507
|
var ReleaseDC = loadProc(user32, "ReleaseDC");
|
|
15507
15508
|
var SelectObject = loadProc(gdi32, "SelectObject");
|
|
15508
|
-
var
|
|
15509
|
+
var FFI_HND = os.arch === "ia32" ? ffi.FFI_TYPE_UINT32 : ffi.FFI_TYPE_UINT64;
|
|
15509
15510
|
var FFI_S32 = ffi.FFI_TYPE_SINT32;
|
|
15510
15511
|
var FFI_PTR = ffi.FFI_TYPE_POINTER;
|
|
15511
15512
|
function measureText(hdc, text, maxWidth) {
|
|
@@ -15513,14 +15514,14 @@ function measureText(hdc, text, maxWidth) {
|
|
|
15513
15514
|
const rect = new ArrayBuffer(16);
|
|
15514
15515
|
const dv = new DataView(rect);
|
|
15515
15516
|
dv.setInt32(8, maxWidth, true);
|
|
15516
|
-
ffi.ffiCall(DrawTextW, [
|
|
15517
|
+
ffi.ffiCall(DrawTextW, [FFI_HND, FFI_PTR, FFI_S32, FFI_PTR, FFI_S32], [
|
|
15517
15518
|
hdc,
|
|
15518
15519
|
textBuf,
|
|
15519
15520
|
-1,
|
|
15520
15521
|
rect,
|
|
15521
15522
|
1024
|
|
15522
15523
|
/* gui.DrawTextFlag.CALCRECT */
|
|
15523
|
-
],
|
|
15524
|
+
], FFI_S32);
|
|
15524
15525
|
return { width: dv.getInt32(8, true), height: dv.getInt32(12, true) };
|
|
15525
15526
|
}
|
|
15526
15527
|
function getButtonIdealSize(hwnd2) {
|
|
@@ -15530,15 +15531,15 @@ function getButtonIdealSize(hwnd2) {
|
|
|
15530
15531
|
return { width: dv.getInt32(0, true), height: dv.getInt32(4, true) };
|
|
15531
15532
|
}
|
|
15532
15533
|
function measureTextForHwnd(hwnd2, text) {
|
|
15533
|
-
const hdc = ffi.ffiCall(GetDC, [
|
|
15534
|
+
const hdc = ffi.ffiCall(GetDC, [FFI_HND], [hwnd2], FFI_HND);
|
|
15534
15535
|
if (!hdc)
|
|
15535
15536
|
return { width: 0, height: 0 };
|
|
15536
15537
|
const hFont = gui2.SendMessage(hwnd2, 49, 0, 0);
|
|
15537
|
-
const oldFont = hFont ? ffi.ffiCall(SelectObject, [
|
|
15538
|
+
const oldFont = hFont ? ffi.ffiCall(SelectObject, [FFI_HND, FFI_HND], [hdc, hFont], FFI_HND) : 0;
|
|
15538
15539
|
const result = measureText(hdc, text, 0);
|
|
15539
15540
|
if (hFont)
|
|
15540
|
-
ffi.ffiCall(SelectObject, [
|
|
15541
|
-
ffi.ffiCall(ReleaseDC, [
|
|
15541
|
+
ffi.ffiCall(SelectObject, [FFI_HND, FFI_HND], [hdc, oldFont], FFI_HND);
|
|
15542
|
+
ffi.ffiCall(ReleaseDC, [FFI_HND, FFI_HND], [hwnd2, hdc], FFI_S32);
|
|
15542
15543
|
const wr = gui2.GetWindowRect(hwnd2);
|
|
15543
15544
|
const cr = gui2.GetClientRect(hwnd2);
|
|
15544
15545
|
if (wr && cr) {
|
|
@@ -15851,10 +15852,10 @@ var hostConfig = {
|
|
|
15851
15852
|
clearContainer(_container) {
|
|
15852
15853
|
},
|
|
15853
15854
|
scheduleTimeout(fn, delay) {
|
|
15854
|
-
return
|
|
15855
|
+
return os2.setTimeout(fn, delay);
|
|
15855
15856
|
},
|
|
15856
15857
|
cancelTimeout(id) {
|
|
15857
|
-
|
|
15858
|
+
os2.clearTimeout?.(id);
|
|
15858
15859
|
},
|
|
15859
15860
|
noTimeout: -1,
|
|
15860
15861
|
supportsMutation: true,
|
|
@@ -17268,7 +17269,7 @@ gui19.RegisterClass("ReactHidden", (hwnd2, msg, wParam, lParam) => {
|
|
|
17268
17269
|
function App() {
|
|
17269
17270
|
const [hidden, setHidden] = (0, import_react18.useState)(true);
|
|
17270
17271
|
(0, import_react18.useEffect)(() => {
|
|
17271
|
-
|
|
17272
|
+
os3.setTimeout(() => setHidden(false), 2e3);
|
|
17272
17273
|
}, []);
|
|
17273
17274
|
return (0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: WS_CHILD | WS_VISIBLE, style: { width: 480, height: 360, flexDirection: "column", padding: 10, gap: 10 }, children: [(0, import_jsx_runtime16.jsx)("w", { type: "STATIC", text: "Click to close", ws: WS_CHILD | WS_VISIBLE, style: { width: 200, height: 30 } }), (0, import_jsx_runtime16.jsx)("w", { type: "STATIC", text: hidden ? "HIDDEN" : "VISIBLE", ws: WS_CHILD | WS_VISIBLE, hidden, style: { width: 200, height: 100 } })] });
|
|
17274
17275
|
}
|
|
@@ -15367,7 +15367,7 @@ var import_react_reconciler = __toESM(require_react_reconciler(), 1);
|
|
|
15367
15367
|
var import_react = __toESM(require_react(), 1);
|
|
15368
15368
|
var import_constants = __toESM(require_constants(), 1);
|
|
15369
15369
|
import * as gui3 from "gui";
|
|
15370
|
-
import * as
|
|
15370
|
+
import * as os2 from "os";
|
|
15371
15371
|
|
|
15372
15372
|
// _build/lib/react-qw/props.js
|
|
15373
15373
|
import * as gui from "gui";
|
|
@@ -15488,6 +15488,7 @@ function calculateFlexLayout(flex, parentW, parentH, children) {
|
|
|
15488
15488
|
|
|
15489
15489
|
// _build/lib/text-measure.js
|
|
15490
15490
|
import * as ffi from "ffi";
|
|
15491
|
+
import * as os from "os";
|
|
15491
15492
|
import * as win from "win";
|
|
15492
15493
|
import * as gui2 from "gui";
|
|
15493
15494
|
function loadProc(lib, name) {
|
|
@@ -15504,7 +15505,7 @@ var DrawTextW = loadProc(user32, "DrawTextW");
|
|
|
15504
15505
|
var GetDC = loadProc(user32, "GetDC");
|
|
15505
15506
|
var ReleaseDC = loadProc(user32, "ReleaseDC");
|
|
15506
15507
|
var SelectObject = loadProc(gdi32, "SelectObject");
|
|
15507
|
-
var
|
|
15508
|
+
var FFI_HND = os.arch === "ia32" ? ffi.FFI_TYPE_UINT32 : ffi.FFI_TYPE_UINT64;
|
|
15508
15509
|
var FFI_S32 = ffi.FFI_TYPE_SINT32;
|
|
15509
15510
|
var FFI_PTR = ffi.FFI_TYPE_POINTER;
|
|
15510
15511
|
function measureText(hdc, text, maxWidth) {
|
|
@@ -15512,14 +15513,14 @@ function measureText(hdc, text, maxWidth) {
|
|
|
15512
15513
|
const rect = new ArrayBuffer(16);
|
|
15513
15514
|
const dv = new DataView(rect);
|
|
15514
15515
|
dv.setInt32(8, maxWidth, true);
|
|
15515
|
-
ffi.ffiCall(DrawTextW, [
|
|
15516
|
+
ffi.ffiCall(DrawTextW, [FFI_HND, FFI_PTR, FFI_S32, FFI_PTR, FFI_S32], [
|
|
15516
15517
|
hdc,
|
|
15517
15518
|
textBuf,
|
|
15518
15519
|
-1,
|
|
15519
15520
|
rect,
|
|
15520
15521
|
1024
|
|
15521
15522
|
/* gui.DrawTextFlag.CALCRECT */
|
|
15522
|
-
],
|
|
15523
|
+
], FFI_S32);
|
|
15523
15524
|
return { width: dv.getInt32(8, true), height: dv.getInt32(12, true) };
|
|
15524
15525
|
}
|
|
15525
15526
|
function getButtonIdealSize(hwnd) {
|
|
@@ -15529,15 +15530,15 @@ function getButtonIdealSize(hwnd) {
|
|
|
15529
15530
|
return { width: dv.getInt32(0, true), height: dv.getInt32(4, true) };
|
|
15530
15531
|
}
|
|
15531
15532
|
function measureTextForHwnd(hwnd, text) {
|
|
15532
|
-
const hdc = ffi.ffiCall(GetDC, [
|
|
15533
|
+
const hdc = ffi.ffiCall(GetDC, [FFI_HND], [hwnd], FFI_HND);
|
|
15533
15534
|
if (!hdc)
|
|
15534
15535
|
return { width: 0, height: 0 };
|
|
15535
15536
|
const hFont = gui2.SendMessage(hwnd, 49, 0, 0);
|
|
15536
|
-
const oldFont = hFont ? ffi.ffiCall(SelectObject, [
|
|
15537
|
+
const oldFont = hFont ? ffi.ffiCall(SelectObject, [FFI_HND, FFI_HND], [hdc, hFont], FFI_HND) : 0;
|
|
15537
15538
|
const result = measureText(hdc, text, 0);
|
|
15538
15539
|
if (hFont)
|
|
15539
|
-
ffi.ffiCall(SelectObject, [
|
|
15540
|
-
ffi.ffiCall(ReleaseDC, [
|
|
15540
|
+
ffi.ffiCall(SelectObject, [FFI_HND, FFI_HND], [hdc, oldFont], FFI_HND);
|
|
15541
|
+
ffi.ffiCall(ReleaseDC, [FFI_HND, FFI_HND], [hwnd, hdc], FFI_S32);
|
|
15541
15542
|
const wr = gui2.GetWindowRect(hwnd);
|
|
15542
15543
|
const cr = gui2.GetClientRect(hwnd);
|
|
15543
15544
|
if (wr && cr) {
|
|
@@ -15850,10 +15851,10 @@ var hostConfig = {
|
|
|
15850
15851
|
clearContainer(_container) {
|
|
15851
15852
|
},
|
|
15852
15853
|
scheduleTimeout(fn, delay) {
|
|
15853
|
-
return
|
|
15854
|
+
return os2.setTimeout(fn, delay);
|
|
15854
15855
|
},
|
|
15855
15856
|
cancelTimeout(id) {
|
|
15856
|
-
|
|
15857
|
+
os2.clearTimeout?.(id);
|
|
15857
15858
|
},
|
|
15858
15859
|
noTimeout: -1,
|
|
15859
15860
|
supportsMutation: true,
|
|
@@ -15366,7 +15366,7 @@ var import_react_reconciler = __toESM(require_react_reconciler(), 1);
|
|
|
15366
15366
|
var import_react = __toESM(require_react(), 1);
|
|
15367
15367
|
var import_constants = __toESM(require_constants(), 1);
|
|
15368
15368
|
import * as gui3 from "gui";
|
|
15369
|
-
import * as
|
|
15369
|
+
import * as os2 from "os";
|
|
15370
15370
|
|
|
15371
15371
|
// _build/lib/react-qw/props.js
|
|
15372
15372
|
import * as gui from "gui";
|
|
@@ -15487,6 +15487,7 @@ function calculateFlexLayout(flex, parentW, parentH, children) {
|
|
|
15487
15487
|
|
|
15488
15488
|
// _build/lib/text-measure.js
|
|
15489
15489
|
import * as ffi from "ffi";
|
|
15490
|
+
import * as os from "os";
|
|
15490
15491
|
import * as win from "win";
|
|
15491
15492
|
import * as gui2 from "gui";
|
|
15492
15493
|
function loadProc(lib, name) {
|
|
@@ -15503,7 +15504,7 @@ var DrawTextW = loadProc(user32, "DrawTextW");
|
|
|
15503
15504
|
var GetDC = loadProc(user32, "GetDC");
|
|
15504
15505
|
var ReleaseDC = loadProc(user32, "ReleaseDC");
|
|
15505
15506
|
var SelectObject = loadProc(gdi32, "SelectObject");
|
|
15506
|
-
var
|
|
15507
|
+
var FFI_HND = os.arch === "ia32" ? ffi.FFI_TYPE_UINT32 : ffi.FFI_TYPE_UINT64;
|
|
15507
15508
|
var FFI_S32 = ffi.FFI_TYPE_SINT32;
|
|
15508
15509
|
var FFI_PTR = ffi.FFI_TYPE_POINTER;
|
|
15509
15510
|
function measureText(hdc, text, maxWidth) {
|
|
@@ -15511,14 +15512,14 @@ function measureText(hdc, text, maxWidth) {
|
|
|
15511
15512
|
const rect = new ArrayBuffer(16);
|
|
15512
15513
|
const dv = new DataView(rect);
|
|
15513
15514
|
dv.setInt32(8, maxWidth, true);
|
|
15514
|
-
ffi.ffiCall(DrawTextW, [
|
|
15515
|
+
ffi.ffiCall(DrawTextW, [FFI_HND, FFI_PTR, FFI_S32, FFI_PTR, FFI_S32], [
|
|
15515
15516
|
hdc,
|
|
15516
15517
|
textBuf,
|
|
15517
15518
|
-1,
|
|
15518
15519
|
rect,
|
|
15519
15520
|
1024
|
|
15520
15521
|
/* gui.DrawTextFlag.CALCRECT */
|
|
15521
|
-
],
|
|
15522
|
+
], FFI_S32);
|
|
15522
15523
|
return { width: dv.getInt32(8, true), height: dv.getInt32(12, true) };
|
|
15523
15524
|
}
|
|
15524
15525
|
function getButtonIdealSize(hwnd2) {
|
|
@@ -15528,15 +15529,15 @@ function getButtonIdealSize(hwnd2) {
|
|
|
15528
15529
|
return { width: dv.getInt32(0, true), height: dv.getInt32(4, true) };
|
|
15529
15530
|
}
|
|
15530
15531
|
function measureTextForHwnd(hwnd2, text) {
|
|
15531
|
-
const hdc = ffi.ffiCall(GetDC, [
|
|
15532
|
+
const hdc = ffi.ffiCall(GetDC, [FFI_HND], [hwnd2], FFI_HND);
|
|
15532
15533
|
if (!hdc)
|
|
15533
15534
|
return { width: 0, height: 0 };
|
|
15534
15535
|
const hFont = gui2.SendMessage(hwnd2, 49, 0, 0);
|
|
15535
|
-
const oldFont = hFont ? ffi.ffiCall(SelectObject, [
|
|
15536
|
+
const oldFont = hFont ? ffi.ffiCall(SelectObject, [FFI_HND, FFI_HND], [hdc, hFont], FFI_HND) : 0;
|
|
15536
15537
|
const result = measureText(hdc, text, 0);
|
|
15537
15538
|
if (hFont)
|
|
15538
|
-
ffi.ffiCall(SelectObject, [
|
|
15539
|
-
ffi.ffiCall(ReleaseDC, [
|
|
15539
|
+
ffi.ffiCall(SelectObject, [FFI_HND, FFI_HND], [hdc, oldFont], FFI_HND);
|
|
15540
|
+
ffi.ffiCall(ReleaseDC, [FFI_HND, FFI_HND], [hwnd2, hdc], FFI_S32);
|
|
15540
15541
|
const wr = gui2.GetWindowRect(hwnd2);
|
|
15541
15542
|
const cr = gui2.GetClientRect(hwnd2);
|
|
15542
15543
|
if (wr && cr) {
|
|
@@ -15849,10 +15850,10 @@ var hostConfig = {
|
|
|
15849
15850
|
clearContainer(_container) {
|
|
15850
15851
|
},
|
|
15851
15852
|
scheduleTimeout(fn, delay) {
|
|
15852
|
-
return
|
|
15853
|
+
return os2.setTimeout(fn, delay);
|
|
15853
15854
|
},
|
|
15854
15855
|
cancelTimeout(id) {
|
|
15855
|
-
|
|
15856
|
+
os2.clearTimeout?.(id);
|
|
15856
15857
|
},
|
|
15857
15858
|
noTimeout: -1,
|
|
15858
15859
|
supportsMutation: true,
|