Skip to content

Commit c4414fa

Browse files
committed
Revert "Merge pull request #4945 from Moros1138/master"
This reverts commit bab234a, reversing changes made to 13e384c.
1 parent bab234a commit c4414fa

File tree

1 file changed

+3
-63
lines changed

1 file changed

+3
-63
lines changed

src/platforms/rcore_web.c

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,15 +1132,7 @@ int InitPlatform(void)
11321132
if ((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) glfwWindowHint(GLFW_DECORATED, GLFW_FALSE); // Border and buttons on Window
11331133
else glfwWindowHint(GLFW_DECORATED, GLFW_TRUE); // Decorated window
11341134

1135-
if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) > 0)
1136-
{
1137-
glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); // Resizable window
1138-
1139-
// bypass hidpi code block in libglfw.js
1140-
// https://github.com/raysan5/raylib/pull/4945#issuecomment-2906956170
1141-
//------------------------------------------------------------------------
1142-
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
1143-
}
1135+
if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) > 0) glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); // Resizable window
11441136
else glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); // Avoid window being resizable
11451137

11461138
// Disable FLAG_WINDOW_MINIMIZED, not supported on initialization
@@ -1633,67 +1625,15 @@ static void MouseEnterCallback(GLFWwindow *window, int enter)
16331625
static EM_BOOL EmscriptenKeyboardCallback(int eventType, const EmscriptenKeyboardEvent *keyboardEvent, void *userData)
16341626
{
16351627
// WARNING: Keyboard inputs already processed through GLFW callback
1636-
1637-
// NOTE: 1. Reset the fullscreen flags if the user left fullscreen manually by pressing the Escape key
1638-
// 2. Which is a necessary safeguard because that case will bypass the toggles CORE.Window.flags resets
1639-
if (platform.ourFullscreen) platform.ourFullscreen = false;
1640-
else
1641-
{
1642-
const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0);
1643-
if (!wasFullscreen)
1644-
{
1645-
CORE.Window.fullscreen = false;
1646-
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE;
1647-
CORE.Window.flags &= ~FLAG_BORDERLESS_WINDOWED_MODE;
1648-
}
1649-
}
1650-
1651-
// Trigger resize event after a brief pause to ensure the canvas exists to resize
1652-
EM_ASM({ setTimeout(function() { window.dispatchEvent(new Event("resize")); }, 50); });
1653-
1628+
16541629
return 1; // The event was consumed by the callback handler
16551630
}
16561631
*/
16571632

16581633
// Emscripten: Called on mouse input events
16591634
static EM_BOOL EmscriptenMouseCallback(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)
16601635
{
1661-
// NOTE: Current code solves mouse position problems with the 3 possible approaches to canvas scaling
1662-
// 1. Canvas not scaled, framebuffer size is fixed
1663-
// 2. Canvas is scaled to 100% browser size, framebuffer size is fixed
1664-
// 3. Canvas is resized to browser size, framebuffer is resized
1665-
1666-
// Don't resize non-resizeable windows
1667-
if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) == 0) return 1;
1668-
1669-
// This event is called whenever the window changes sizes,
1670-
// so the size of the canvas object is explicitly retrieved below
1671-
int width = EM_ASM_INT( return window.innerWidth; );
1672-
int height = EM_ASM_INT( return window.innerHeight; );
1673-
1674-
if (width < (int)CORE.Window.screenMin.width) width = CORE.Window.screenMin.width;
1675-
else if ((width > (int)CORE.Window.screenMax.width) && (CORE.Window.screenMax.width > 0)) width = CORE.Window.screenMax.width;
1676-
1677-
if (height < (int)CORE.Window.screenMin.height) height = CORE.Window.screenMin.height;
1678-
else if ((height > (int)CORE.Window.screenMax.height) && (CORE.Window.screenMax.height > 0)) height = CORE.Window.screenMax.height;
1679-
1680-
emscripten_set_canvas_element_size(GetCanvasId(), width, height);
1681-
1682-
glfwSetWindowSize(platform.handle, width, height); // Inform glfw of the new size
1683-
1684-
SetupViewport(width, height); // Reset viewport and projection matrix for new size
1685-
1686-
CORE.Window.currentFbo.width = width;
1687-
CORE.Window.currentFbo.height = height;
1688-
CORE.Window.resizedLastFrame = true;
1689-
1690-
if (IsWindowFullscreen()) return 1;
1691-
1692-
// Set current screen size
1693-
CORE.Window.screen.width = width;
1694-
CORE.Window.screen.height = height;
1695-
1696-
// WARNING: RenderTextures are not scaled to new size
1636+
// This is only for registering mouse click events with emscripten and doesn't need to do anything
16971637

16981638
return 1; // The event was consumed by the callback handler
16991639
}

0 commit comments

Comments
 (0)