Skip to content

[rcore][Emscripten] Full screen handling - #6071

Draft
andzdroid wants to merge 1 commit into
raysan5:masterfrom
andzdroid:emscripten-canvas-size
Draft

[rcore][Emscripten] Full screen handling#6071
andzdroid wants to merge 1 commit into
raysan5:masterfrom
andzdroid:emscripten-canvas-size

Conversation

@andzdroid

Copy link
Copy Markdown
Contributor

Fullscreen: doesn't resize framebuffer
Borderless window: resizes framebuffer

The canvas size is kept in sync with the framebuffer size. Framebuffer also adapts to changes to canvas css size.

Tested with standard renderer and software renderer, and regular DPI and high DPI mode.

@andzdroid andzdroid changed the title Emscripten full screen handling [recore_web_emscripten] Emscripten full screen handling Aug 17, 2026
@andzdroid andzdroid changed the title [recore_web_emscripten] Emscripten full screen handling [rcore_web_emscripten] Emscripten full screen handling Aug 18, 2026
@raysan5 raysan5 added platform: Web Web platform (Wasm) windowing Issues about the window system labels Aug 19, 2026
@raysan5 raysan5 changed the title [rcore_web_emscripten] Emscripten full screen handling [rcore][Emscripten] Full screen handling Aug 19, 2026
@raysan5

raysan5 commented Aug 23, 2026

Copy link
Copy Markdown
Owner

@andzdroid This PR should be carefully reviewed, does it maintain same behaviour as rcore_web? Did you test it with core_highdpi_testbed example? Note that FLAG_WINDOW_RESIZABLE should allow a resizable framebuffer if enabled.

@andzdroid
andzdroid marked this pull request as draft August 23, 2026 20:36
@andzdroid

andzdroid commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

It doesn't quite behave like rcore_web, I can fix it.

However, imo rcore_web's handling of display sizes is incorrect. It's mixed up render size and screen size, and is taking the CSS window size as the DPR-adjusted value incorrectly. In css, sizes are not dpr-adjusted.

Example of what I'm talking about:
When window.innerWidth is 1200, rcore_web is setting the render size to 1200, then calculating the screen size by dividing by DPR. If DPR is 1.2, then the screen size gets set to 1000.

In this example, the screen size should be 1200 and render size scaled to 1440.

Should I submit a PR to fix this in rcore_web first? Or should we keep this behaviour and I'll update this PR to match?

@andzdroid

Copy link
Copy Markdown
Contributor Author

I've checked this behaviour on other platforms. Glfw, win32, rgfw all increase the render size by dpi scale, rather than decreasing the screen size. rcore_web is the exception that decreases the screen size instead of increasing the render size.

https://github.com/raysan5/raylib/blob/master/src/platforms/rcore_desktop_win32.c#L386
https://github.com/raysan5/raylib/blob/master/src/platforms/rcore_desktop_glfw.c#L1740
https://github.com/raysan5/raylib/blob/master/src/platforms/rcore_desktop_rgfw.c#L512

https://github.com/raysan5/raylib/blob/master/src/platforms/rcore_web.c#L1526

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: Web Web platform (Wasm) windowing Issues about the window system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants