|
1 | 1 | // Copyright 2012-2022 David Robillard <[email protected]> |
2 | | -// Copyright 2021-2022 Filipe Coelho <[email protected]> |
| 2 | +// Copyright 2021-2025 Filipe Coelho <[email protected]> |
3 | 3 | // SPDX-License-Identifier: ISC |
4 | 4 |
|
5 | 5 | #include "wasm.h" |
6 | 6 |
|
7 | 7 | #include "../pugl-upstream/src/internal.h" |
| 8 | +#include "../pugl-upstream/src/platform.h" |
8 | 9 |
|
9 | 10 | #include <stdio.h> |
10 | 11 |
|
@@ -82,8 +83,15 @@ puglInitViewInternals(PuglWorld* const world) |
82 | 83 | return impl; |
83 | 84 | } |
84 | 85 |
|
85 | | -static PuglStatus |
86 | | -puglUpdateSizeHints(const PuglView* const view) |
| 86 | +PuglStatus |
| 87 | +puglApplySizeHint(PuglView* const view, const PuglSizeHint PUGL_UNUSED(hint)) |
| 88 | +{ |
| 89 | + // No fine-grained updates, hints are always recalculated together |
| 90 | + return puglUpdateSizeHints(view); |
| 91 | +} |
| 92 | + |
| 93 | +PuglStatus |
| 94 | +puglUpdateSizeHints(PuglView* const view) |
87 | 95 | { |
88 | 96 | const char* const className = view->world->strings[PUGL_CLASS_NAME]; |
89 | 97 |
|
@@ -1005,18 +1013,9 @@ puglViewStringChanged(PuglView*, const PuglStringHint key, const char* const val |
1005 | 1013 | } |
1006 | 1014 |
|
1007 | 1015 | PuglStatus |
1008 | | -puglSetSizeHint(PuglView* const view, |
1009 | | - const PuglSizeHint hint, |
1010 | | - const unsigned width, |
1011 | | - const unsigned height) |
| 1016 | +puglSetWindowSize(PuglView* const view, const unsigned width, const unsigned height) |
1012 | 1017 | { |
1013 | | - const PuglStatus st = puglStoreSizeHint(view, hint, width, height); |
1014 | | - if (st != PUGL_SUCCESS) |
1015 | | - return st; |
1016 | | - |
1017 | | - puglUpdateSizeHints(view); |
1018 | | - |
1019 | | - if (hint == PUGL_CURRENT_SIZE && view->impl->created) { |
| 1018 | + if (view->impl->created) { |
1020 | 1019 | const char* const className = view->world->strings[PUGL_CLASS_NAME]; |
1021 | 1020 | emscripten_set_canvas_element_size(className, width, height); |
1022 | 1021 | } |
@@ -1248,25 +1247,3 @@ puglSetTransientParent(PuglView* const view, const PuglNativeView parent) |
1248 | 1247 | view->transientParent = parent; |
1249 | 1248 | return PUGL_FAILURE; |
1250 | 1249 | } |
1251 | | - |
1252 | | -PuglStatus |
1253 | | -puglSetPositionHint(PuglView* const view, |
1254 | | - const PuglPositionHint hint, |
1255 | | - const int x, |
1256 | | - const int y) |
1257 | | -{ |
1258 | | - if (x <= INT16_MIN || x > INT16_MAX || y <= INT16_MIN || y > INT16_MAX) { |
1259 | | - return PUGL_BAD_PARAMETER; |
1260 | | - } |
1261 | | - |
1262 | | - view->positionHints[hint].x = (PuglCoord)x; |
1263 | | - view->positionHints[hint].y = (PuglCoord)y; |
1264 | | - |
1265 | | - if (!view->impl->created || hint != PUGL_CURRENT_POSITION) { |
1266 | | - return PUGL_SUCCESS; |
1267 | | - } |
1268 | | - |
1269 | | - view->lastConfigure.x = x; |
1270 | | - view->lastConfigure.y = y; |
1271 | | - return puglObscureView(view); |
1272 | | -} |
0 commit comments