xbintsc 0.6.12 → 0.6.13
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/dist/src/ast/expressions.d.ts +6 -0
- package/dist/src/checker/type-infer.js +1 -1
- package/dist/src/checker/type-infer.js.map +1 -1
- package/dist/src/cli/help.d.ts +1 -1
- package/dist/src/codegen/generator/calls/literals.js +4 -1
- package/dist/src/codegen/generator/calls/literals.js.map +1 -1
- package/dist/src/codegen/generator/expressions/assignment.js +3 -1
- package/dist/src/codegen/generator/expressions/assignment.js.map +1 -1
- package/dist/src/codegen/generator/expressions/operators.js +2 -6
- package/dist/src/codegen/generator/expressions/operators.js.map +1 -1
- package/dist/src/codegen/generator/expressions/primary.d.ts +9 -0
- package/dist/src/codegen/generator/expressions/primary.js +44 -7
- package/dist/src/codegen/generator/expressions/primary.js.map +1 -1
- package/dist/src/driver/bundler/commonjs.js +1 -1
- package/dist/src/driver/bundler/commonjs.js.map +1 -1
- package/dist/src/driver/bundler/symbols.js +6 -0
- package/dist/src/driver/bundler/symbols.js.map +1 -1
- package/dist/src/driver/version.d.ts +1 -1
- package/dist/src/driver/version.js +1 -1
- package/dist/src/extensions/node/index.js +2 -0
- package/dist/src/extensions/node/index.js.map +1 -1
- package/dist/src/extensions/node/readline/index.d.ts +12 -0
- package/dist/src/extensions/node/readline/index.js +27 -0
- package/dist/src/extensions/node/readline/index.js.map +1 -0
- package/dist/src/parser/declarations/functions.js +6 -0
- package/dist/src/parser/declarations/functions.js.map +1 -1
- package/dist/src/parser/literals.js +1 -1
- package/dist/src/parser/literals.js.map +1 -1
- package/dist/tests/e2e/compile-modules.test.js +22 -0
- package/dist/tests/e2e/compile-modules.test.js.map +1 -1
- package/dist/tests/e2e/date-parse.test.js +17 -0
- package/dist/tests/e2e/date-parse.test.js.map +1 -1
- package/dist/tests/e2e/gui-browser.test.js +61 -0
- package/dist/tests/e2e/gui-browser.test.js.map +1 -1
- package/dist/tests/e2e/gui-css-coverage.test.js +39 -0
- package/dist/tests/e2e/gui-css-coverage.test.js.map +1 -1
- package/dist/tests/e2e/gui-css-features.test.js +100 -0
- package/dist/tests/e2e/gui-css-features.test.js.map +1 -1
- package/dist/tests/e2e/gui-dom.test.js +34 -0
- package/dist/tests/e2e/gui-dom.test.js.map +1 -1
- package/dist/tests/e2e/gui-errors.test.d.ts +11 -0
- package/dist/tests/e2e/gui-errors.test.js +68 -0
- package/dist/tests/e2e/gui-errors.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2-shadow-sampler.test.js +7 -1
- package/dist/tests/e2e/gui-webgl2-shadow-sampler.test.js.map +1 -1
- package/dist/tests/e2e/harness.d.ts +4 -0
- package/dist/tests/e2e/harness.js +2 -0
- package/dist/tests/e2e/harness.js.map +1 -1
- package/dist/tests/e2e/readline.test.d.ts +7 -0
- package/dist/tests/e2e/readline.test.js +73 -0
- package/dist/tests/e2e/readline.test.js.map +1 -0
- package/doc/gui/api.md +15 -0
- package/doc/gui/dom.md +7 -2
- package/doc/gui/known-issues.md +2 -1
- package/doc/gui/layout.md +5 -1
- package/doc/implemented/node/readline.md +34 -0
- package/doc/implemented/node.md +1 -0
- package/doc/unimplemented/node/modules.md +2 -3
- package/doc/unimplemented/node.md +2 -2
- package/doc/zh-CN/gui/api.md +11 -0
- package/doc/zh-CN/gui/dom.md +6 -2
- package/doc/zh-CN/gui/known-issues.md +2 -1
- package/doc/zh-CN/gui/layout.md +4 -1
- package/doc/zh-CN/implemented/node/readline.md +33 -0
- package/doc/zh-CN/implemented/node.md +1 -0
- package/doc/zh-CN/unimplemented/node/modules.md +1 -2
- package/doc/zh-CN/unimplemented/node.md +2 -2
- package/package.json +7 -7
- package/runtime/ext_gui/browser_abort.cpp +2 -2
- package/runtime/ext_gui/browser_loop.cpp +1 -0
- package/runtime/ext_gui/browser_media.cpp +1 -1
- package/runtime/ext_gui/dom_api_canvas_image.cpp +2 -1
- package/runtime/ext_gui/dom_api_events.cpp +1 -1
- package/runtime/ext_gui/dom_api_internal.h +2 -0
- package/runtime/ext_gui/dom_api_node.cpp +18 -12
- package/runtime/ext_gui/dom_api_node_read.cpp +27 -0
- package/runtime/ext_gui/dom_api_proto.cpp +2 -0
- package/runtime/ext_gui/error_report.cpp +166 -0
- package/runtime/ext_gui/gui.cpp +16 -0
- package/runtime/ext_gui/gui_engine.h +13 -0
- package/runtime/ext_gui/gui_events.cpp +4 -1
- package/runtime/ext_gui/layout_inline.cpp +46 -14
- package/runtime/ext_gui/paint.cpp +22 -0
- package/runtime/ext_gui/script.cpp +1 -1
- package/runtime/ext_gui/style.cpp +1 -0
- package/runtime/ext_gui/style.h +13 -0
- package/runtime/ext_gui/style_print.cpp +99 -0
- package/runtime/ext_gui/style_text.cpp +79 -0
- package/runtime/ext_gui/webgl_texture.cpp +0 -8
- package/runtime/ext_gui/window.cpp +22 -8
- package/runtime/ext_gui/window_emit.cpp +1 -1
- package/runtime/ext_node/fs/parts/platform.inc +2 -0
- package/runtime/ext_node/readline/readline.c +572 -0
- package/runtime/rt.h +15 -0
- package/runtime/rt_internal.h +3 -2
- package/runtime/xt_io/exception.inc +29 -6
- package/runtime/xt_loop.c +36 -1
- package/runtime/xt_promise.c +26 -2
- package/runtime/xt_stdlib2/date.inc +2 -2
- package/runtime/xt_typed_array/elements.inc +0 -9
- package/runtime/xt_url.c +0 -6
- package/runtime/xt_url_object.c +1 -1
- package/src/ast/expressions.ts +6 -0
- package/src/checker/type-infer.ts +1 -1
- package/src/codegen/generator/calls/literals.ts +4 -1
- package/src/codegen/generator/expressions/assignment.ts +3 -1
- package/src/codegen/generator/expressions/operators.ts +2 -6
- package/src/codegen/generator/expressions/primary.ts +58 -6
- package/src/driver/bundler/commonjs.ts +1 -1
- package/src/driver/bundler/symbols.ts +6 -0
- package/src/driver/version.ts +1 -1
- package/src/extensions/node/index.ts +2 -0
- package/src/extensions/node/readline/index.ts +31 -0
- package/src/parser/declarations/functions.ts +6 -0
- package/src/parser/literals.ts +1 -1
|
@@ -234,6 +234,8 @@ std::string xt_style_property_to_string(const XtStyle &style, const std::string
|
|
|
234
234
|
static const char *const clearNames[] = {"none", "left", "right", "both"};
|
|
235
235
|
static const char *const alignTextNames[] = {"start", "center", "end", "justify"};
|
|
236
236
|
static const char *const textTransformNames[] = {"none", "uppercase", "lowercase", "capitalize"};
|
|
237
|
+
static const char *const decorationStyleNames[] = {"solid", "double", "dotted", "dashed", "wavy"};
|
|
238
|
+
static const char *const overflowWrapNames[] = {"normal", "break-word", "anywhere"};
|
|
237
239
|
static const char *const writingModeNames[] = {"horizontal-tb", "vertical-rl", "vertical-lr"};
|
|
238
240
|
static const char *const cursorNames[] = {"auto", "default", "pointer", "text", "move",
|
|
239
241
|
"wait", "help", "not-allowed", "crosshair"};
|
|
@@ -252,6 +254,9 @@ std::string xt_style_property_to_string(const XtStyle &style, const std::string
|
|
|
252
254
|
if (style.inline_level) return style.display == Display::Grid ? "inline-grid" : "inline-flex";
|
|
253
255
|
return displayNames[(int)style.display];
|
|
254
256
|
}
|
|
257
|
+
if (property == "box-sizing") {
|
|
258
|
+
return style.box_sizing == BoxSizing::BorderBox ? "border-box" : "content-box";
|
|
259
|
+
}
|
|
255
260
|
if (property == "position") return positionNames[(int)style.position];
|
|
256
261
|
if (property == "color") return formatColor(style.color);
|
|
257
262
|
if (property == "background-color" || property == "background") {
|
|
@@ -278,11 +283,44 @@ std::string xt_style_property_to_string(const XtStyle &style, const std::string
|
|
|
278
283
|
if (property == "font-size") return formatNumber(style.font_size) + "px";
|
|
279
284
|
if (property == "font-weight") return formatNumber((float)style.font_weight);
|
|
280
285
|
if (property == "font-family") return style.font_family;
|
|
286
|
+
if (property == "font-style") return style.font_style == FontStyle::Italic ? "italic" : "normal";
|
|
287
|
+
if (property == "font-variant") return style.font_variant_numeric ? "tabular-nums" : "normal";
|
|
288
|
+
if (property == "font-stretch") return "100%";
|
|
289
|
+
if (property == "font-kerning") return "auto";
|
|
290
|
+
if (property == "overflow" || property == "overflow-x" || property == "overflow-y") {
|
|
291
|
+
static const char *const overflowNames[] = {"visible", "hidden", "scroll", "auto"};
|
|
292
|
+
return overflowNames[(int)style.overflow];
|
|
293
|
+
}
|
|
294
|
+
if (property == "transition") return style.transitions.empty() ? "none" : "";
|
|
295
|
+
if (property == "animation") return style.animations.empty() ? "none" : "";
|
|
281
296
|
if (property == "line-height") {
|
|
282
297
|
return style.line_height.unit == Unit::Auto ? "normal" : formatLength(style.line_height);
|
|
283
298
|
}
|
|
284
299
|
if (property == "text-align") return alignTextNames[(int)style.text_align];
|
|
285
300
|
if (property == "text-transform") return textTransformNames[(int)style.text_transform];
|
|
301
|
+
if (property == "text-decoration" || property == "text-decoration-line") {
|
|
302
|
+
if (style.text_decoration_line == 0) return "none";
|
|
303
|
+
std::string out;
|
|
304
|
+
if (style.text_decoration_line & (uint8_t)TextDecorationLine::Underline) out = "underline";
|
|
305
|
+
if (style.text_decoration_line & (uint8_t)TextDecorationLine::Overline) {
|
|
306
|
+
if (!out.empty()) out += " ";
|
|
307
|
+
out += "overline";
|
|
308
|
+
}
|
|
309
|
+
if (style.text_decoration_line & (uint8_t)TextDecorationLine::LineThrough) {
|
|
310
|
+
if (!out.empty()) out += " ";
|
|
311
|
+
out += "line-through";
|
|
312
|
+
}
|
|
313
|
+
return out;
|
|
314
|
+
}
|
|
315
|
+
if (property == "text-decoration-style") {
|
|
316
|
+
return decorationStyleNames[(int)style.text_decoration_style];
|
|
317
|
+
}
|
|
318
|
+
if (property == "text-decoration-color") {
|
|
319
|
+
return formatColor(style.has_text_decoration_color ? style.text_decoration_color : style.color);
|
|
320
|
+
}
|
|
321
|
+
if (property == "overflow-wrap" || property == "word-wrap") {
|
|
322
|
+
return overflowWrapNames[(int)style.overflow_wrap];
|
|
323
|
+
}
|
|
286
324
|
if (property == "text-overflow") {
|
|
287
325
|
return style.text_overflow == TextOverflow::Ellipsis ? "ellipsis" : "clip";
|
|
288
326
|
}
|
|
@@ -383,6 +421,67 @@ std::string xt_style_property_to_string(const XtStyle &style, const std::string
|
|
|
383
421
|
if (property == "transform-origin") {
|
|
384
422
|
return formatLength(style.transform_origin_x) + " " + formatLength(style.transform_origin_y);
|
|
385
423
|
}
|
|
424
|
+
|
|
425
|
+
/* Standard properties the engine does not model still answer with their
|
|
426
|
+
* CSS initial value. Returning "" made the usual "read the current style"
|
|
427
|
+
* pattern (`getComputedStyle(el).wordBreak`, `.objectFit`, …) see a value no
|
|
428
|
+
* browser produces. Modelled properties are handled above; this table is
|
|
429
|
+
* only the computed default. */
|
|
430
|
+
struct InitialValue {
|
|
431
|
+
const char *name;
|
|
432
|
+
const char *value;
|
|
433
|
+
};
|
|
434
|
+
static const InitialValue kInitialValues[] = {
|
|
435
|
+
{"box-sizing", "content-box"},
|
|
436
|
+
{"text-decoration", "none"},
|
|
437
|
+
{"text-decoration-line", "none"},
|
|
438
|
+
{"text-decoration-style", "solid"},
|
|
439
|
+
{"text-decoration-color", "rgb(0, 0, 0)"},
|
|
440
|
+
{"overflow-wrap", "normal"},
|
|
441
|
+
{"word-wrap", "normal"},
|
|
442
|
+
{"text-indent", "0px"},
|
|
443
|
+
{"word-spacing", "0px"},
|
|
444
|
+
{"word-break", "normal"},
|
|
445
|
+
{"hyphens", "manual"},
|
|
446
|
+
{"tab-size", "8"},
|
|
447
|
+
{"direction", "ltr"},
|
|
448
|
+
{"unicode-bidi", "normal"},
|
|
449
|
+
{"text-rendering", "auto"},
|
|
450
|
+
{"text-justify", "auto"},
|
|
451
|
+
{"background-repeat", "repeat"},
|
|
452
|
+
{"background-position", "0% 0%"},
|
|
453
|
+
{"background-attachment", "scroll"},
|
|
454
|
+
{"background-clip", "border-box"},
|
|
455
|
+
{"background-origin", "padding-box"},
|
|
456
|
+
{"border-collapse", "separate"},
|
|
457
|
+
{"border-spacing", "0px"},
|
|
458
|
+
{"table-layout", "auto"},
|
|
459
|
+
{"caption-side", "top"},
|
|
460
|
+
{"empty-cells", "show"},
|
|
461
|
+
{"list-style-type", "disc"},
|
|
462
|
+
{"list-style-position", "outside"},
|
|
463
|
+
{"list-style-image", "none"},
|
|
464
|
+
{"object-fit", "fill"},
|
|
465
|
+
{"object-position", "50% 50%"},
|
|
466
|
+
{"resize", "none"},
|
|
467
|
+
{"user-select", "auto"},
|
|
468
|
+
{"touch-action", "auto"},
|
|
469
|
+
{"scroll-behavior", "auto"},
|
|
470
|
+
{"overscroll-behavior", "auto"},
|
|
471
|
+
{"will-change", "auto"},
|
|
472
|
+
{"contain", "none"},
|
|
473
|
+
{"isolation", "auto"},
|
|
474
|
+
{"appearance", "none"},
|
|
475
|
+
{"columns", "auto"},
|
|
476
|
+
{"column-count", "auto"},
|
|
477
|
+
{"column-rule", "none"},
|
|
478
|
+
{"caret-color", "auto"},
|
|
479
|
+
{"accent-color", "auto"},
|
|
480
|
+
{"color-scheme", "normal"},
|
|
481
|
+
};
|
|
482
|
+
for (const InitialValue &entry : kInitialValues) {
|
|
483
|
+
if (property == entry.name) return entry.value;
|
|
484
|
+
}
|
|
386
485
|
return "";
|
|
387
486
|
}
|
|
388
487
|
|
|
@@ -123,6 +123,38 @@ bool isFontWeightKeyword(const std::string &token) {
|
|
|
123
123
|
return token == "bold" || token == "bolder" || token == "lighter" || token == "normal";
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
/** One token of `text-decoration-line` (`none` clears the set). */
|
|
127
|
+
bool applyDecorationLineToken(const std::string &token, uint8_t *out) {
|
|
128
|
+
if (token == "none") {
|
|
129
|
+
*out = 0;
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
if (token == "underline") *out |= (uint8_t)TextDecorationLine::Underline;
|
|
133
|
+
else if (token == "overline") *out |= (uint8_t)TextDecorationLine::Overline;
|
|
134
|
+
else if (token == "line-through") *out |= (uint8_t)TextDecorationLine::LineThrough;
|
|
135
|
+
else if (token == "blink") return true; // accepted, no animation
|
|
136
|
+
else return false;
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
bool parseDecorationStyle(const std::string &token, TextDecorationStyle *out) {
|
|
141
|
+
if (token == "solid") *out = TextDecorationStyle::Solid;
|
|
142
|
+
else if (token == "double") *out = TextDecorationStyle::Double;
|
|
143
|
+
else if (token == "dotted") *out = TextDecorationStyle::Dotted;
|
|
144
|
+
else if (token == "dashed") *out = TextDecorationStyle::Dashed;
|
|
145
|
+
else if (token == "wavy") *out = TextDecorationStyle::Wavy;
|
|
146
|
+
else return false;
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
bool parseOverflowWrap(const std::string &text, OverflowWrap *out) {
|
|
151
|
+
if (text == "normal") *out = OverflowWrap::Normal;
|
|
152
|
+
else if (text == "break-word") *out = OverflowWrap::BreakWord;
|
|
153
|
+
else if (text == "anywhere") *out = OverflowWrap::Anywhere;
|
|
154
|
+
else return false;
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
|
|
126
158
|
} // namespace
|
|
127
159
|
|
|
128
160
|
std::string xt_apply_text_transform(const std::string &text, TextTransform transform) {
|
|
@@ -167,6 +199,53 @@ bool xt_style_apply_text_property(XtStyle *style, const std::string &property,
|
|
|
167
199
|
parseTextTransform(value, &style->text_transform);
|
|
168
200
|
return true;
|
|
169
201
|
}
|
|
202
|
+
if (property == "text-decoration" || property == "text-decoration-line") {
|
|
203
|
+
std::vector<std::string> tokens = splitTokens(lowerTrim(value));
|
|
204
|
+
uint8_t line = 0;
|
|
205
|
+
bool sawLine = false;
|
|
206
|
+
for (const std::string &token : tokens) {
|
|
207
|
+
if (applyDecorationLineToken(token, &line)) {
|
|
208
|
+
sawLine = true;
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
if (property == "text-decoration" && parseDecorationStyle(token, &style->text_decoration_style)) {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (property == "text-decoration") {
|
|
215
|
+
Color color = xt_css_parse_color(token);
|
|
216
|
+
if (color.valid) {
|
|
217
|
+
style->text_decoration_color = color;
|
|
218
|
+
style->has_text_decoration_color = true;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/* `text-decoration: <style> <color>` without a line keeps the current
|
|
223
|
+
* line; the shorthand's `none` already cleared it. */
|
|
224
|
+
if (sawLine || property == "text-decoration-line") style->text_decoration_line = line;
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
if (property == "text-decoration-style") {
|
|
228
|
+
parseDecorationStyle(lowerTrim(value), &style->text_decoration_style);
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
if (property == "text-decoration-color") {
|
|
232
|
+
Color color = xt_css_parse_color(value);
|
|
233
|
+
if (color.valid) {
|
|
234
|
+
style->text_decoration_color = color;
|
|
235
|
+
style->has_text_decoration_color = true;
|
|
236
|
+
}
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
if (property == "text-decoration-thickness" || property == "text-underline-offset" ||
|
|
240
|
+
property == "text-decoration-skip-ink") {
|
|
241
|
+
/* Accepted: the painter uses a fixed one-pixel rule and does not skip
|
|
242
|
+
* descenders yet. */
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
if (property == "overflow-wrap" || property == "word-wrap") {
|
|
246
|
+
parseOverflowWrap(lowerTrim(value), &style->overflow_wrap);
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
170
249
|
if (property == "text-overflow") {
|
|
171
250
|
/* `clip | ellipsis` (the two-value `start end` form collapses to one
|
|
172
251
|
* behaviour here). A custom string is accepted as `clip`, which is still
|
|
@@ -12,14 +12,6 @@
|
|
|
12
12
|
namespace xtgui {
|
|
13
13
|
namespace {
|
|
14
14
|
|
|
15
|
-
bool depth_texture_format(SDL_GPUTextureFormat format) {
|
|
16
|
-
return format == SDL_GPU_TEXTUREFORMAT_D16_UNORM ||
|
|
17
|
-
format == SDL_GPU_TEXTUREFORMAT_D24_UNORM ||
|
|
18
|
-
format == SDL_GPU_TEXTUREFORMAT_D32_FLOAT ||
|
|
19
|
-
format == SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT ||
|
|
20
|
-
format == SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
15
|
int texel_bytes(SDL_GPUTextureFormat format) {
|
|
24
16
|
if (format == SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT) return 8;
|
|
25
17
|
if (format == SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT) return 16;
|
|
@@ -25,12 +25,6 @@ xt_value xt_gui_window_set_background(xt_value self, xt_value env, int32_t argc,
|
|
|
25
25
|
xt_value xt_gui_window_paint_list(xt_value self, xt_value env, int32_t argc, xt_value *argv);
|
|
26
26
|
xt_value xt_gui_window_paint_count(xt_value self, xt_value env, int32_t argc, xt_value *argv);
|
|
27
27
|
|
|
28
|
-
/** String value of a runtime value, as `std::string` ("" for null/undefined). */
|
|
29
|
-
static std::string window_string(xt_value value) {
|
|
30
|
-
const char *data = xt_string_data(xt_to_string(value));
|
|
31
|
-
return data != nullptr ? data : "";
|
|
32
|
-
}
|
|
33
|
-
|
|
34
28
|
/* -- methods -------------------------------------------------------------- */
|
|
35
29
|
|
|
36
30
|
static xt_value win_set_title(xt_value self, xt_value env, int32_t argc, xt_value *argv) {
|
|
@@ -47,8 +41,28 @@ static xt_value win_set_size(xt_value self, xt_value env, int32_t argc, xt_value
|
|
|
47
41
|
(void)env;
|
|
48
42
|
XtGuiWindow *win = xt_gui_window_from_this(self);
|
|
49
43
|
if (win != NULL && win->window != NULL && argc >= 2) {
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
int width = (int)xt_to_number(xt_arg(argc, argv, 0));
|
|
45
|
+
int height = (int)xt_to_number(xt_arg(argc, argv, 1));
|
|
46
|
+
SDL_SetWindowSize(win->window, width, height);
|
|
47
|
+
/* Settle the request with the window system (bounded by the backend's own
|
|
48
|
+
* timeout). `innerWidth` already reads the live size, so a host that does
|
|
49
|
+
* not pump SDL events — a page driven only by timers — otherwise never
|
|
50
|
+
* observes the matching `resize` event. */
|
|
51
|
+
SDL_SyncWindow(win->window);
|
|
52
|
+
int actualWidth = width;
|
|
53
|
+
int actualHeight = height;
|
|
54
|
+
SDL_GetWindowSize(win->window, &actualWidth, &actualHeight);
|
|
55
|
+
if (actualWidth != win->width || actualHeight != win->height) {
|
|
56
|
+
win->width = actualWidth;
|
|
57
|
+
win->height = actualHeight;
|
|
58
|
+
if (win->document != NULL) {
|
|
59
|
+
win->document->restyle((float)win->width, (float)win->height);
|
|
60
|
+
}
|
|
61
|
+
win->geometry.dirty = 1;
|
|
62
|
+
win->present_dirty = 1;
|
|
63
|
+
xt_gui_emit(win, "resize");
|
|
64
|
+
xt_gui_media_lists_notify(win);
|
|
65
|
+
}
|
|
52
66
|
}
|
|
53
67
|
return XT_UNDEFINED;
|
|
54
68
|
}
|
|
@@ -46,6 +46,6 @@ void xt_gui_emit_payload(XtGuiWindow *win, const char *event, xt_value payload)
|
|
|
46
46
|
continue;
|
|
47
47
|
}
|
|
48
48
|
if (listener.once) remove_window_listener(win, listener);
|
|
49
|
-
if (XT_IS_FUNCTION(listener.fn))
|
|
49
|
+
if (XT_IS_FUNCTION(listener.fn)) xt_gui_invoke(listener.fn, win->object, count, args);
|
|
50
50
|
}
|
|
51
51
|
}
|