Skip to content

Commit 4cd243f

Browse files
author
Asdqwe
authored
Simplify EmscriptenResizeCallback() (#4415)
1 parent b89bf01 commit 4cd243f

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/platforms/rcore_web.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@ void MaximizeWindow(void)
324324
platform.unmaximizedWidth = CORE.Window.screen.width;
325325
platform.unmaximizedHeight = CORE.Window.screen.height;
326326

327-
const int tabWidth = EM_ASM_INT( { return window.innerWidth; }, 0);
328-
const int tabHeight = EM_ASM_INT( { return window.innerHeight; }, 0);
327+
const int tabWidth = EM_ASM_INT( return window.innerWidth; );
328+
const int tabHeight = EM_ASM_INT( return window.innerHeight; );
329329

330330
if (tabWidth && tabHeight) glfwSetWindowSize(platform.handle, tabWidth, tabHeight);
331331

@@ -423,8 +423,8 @@ void SetWindowState(unsigned int flags)
423423
platform.unmaximizedWidth = CORE.Window.screen.width;
424424
platform.unmaximizedHeight = CORE.Window.screen.height;
425425

426-
const int tabWidth = EM_ASM_INT( { return window.innerWidth; }, 0);
427-
const int tabHeight = EM_ASM_INT( { return window.innerHeight; }, 0);
426+
const int tabWidth = EM_ASM_INT( return window.innerWidth; );
427+
const int tabHeight = EM_ASM_INT( return window.innerHeight; );
428428

429429
if (tabWidth && tabHeight) glfwSetWindowSize(platform.handle, tabWidth, tabHeight);
430430

@@ -1639,9 +1639,6 @@ static EM_BOOL EmscriptenFullscreenChangeCallback(int eventType, const Emscripte
16391639
// return 1; // The event was consumed by the callback handler
16401640
// }
16411641

1642-
EM_JS(int, GetWindowInnerWidth, (), { return window.innerWidth; });
1643-
EM_JS(int, GetWindowInnerHeight, (), { return window.innerHeight; });
1644-
16451642
// Register DOM element resize event
16461643
static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *event, void *userData)
16471644
{
@@ -1650,8 +1647,8 @@ static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *
16501647

16511648
// This event is called whenever the window changes sizes,
16521649
// so the size of the canvas object is explicitly retrieved below
1653-
int width = GetWindowInnerWidth();
1654-
int height = GetWindowInnerHeight();
1650+
int width = EM_ASM_INT( return window.innerWidth; );
1651+
int height = EM_ASM_INT( return window.innerHeight; );
16551652

16561653
if (width < (int)CORE.Window.screenMin.width) width = CORE.Window.screenMin.width;
16571654
else if (width > (int)CORE.Window.screenMax.width && CORE.Window.screenMax.width > 0) width = CORE.Window.screenMax.width;

0 commit comments

Comments
 (0)