@@ -1132,15 +1132,7 @@ int InitPlatform(void)
1132
1132
if ((CORE .Window .flags & FLAG_WINDOW_UNDECORATED ) > 0 ) glfwWindowHint (GLFW_DECORATED , GLFW_FALSE ); // Border and buttons on Window
1133
1133
else glfwWindowHint (GLFW_DECORATED , GLFW_TRUE ); // Decorated window
1134
1134
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
1144
1136
else glfwWindowHint (GLFW_RESIZABLE , GLFW_FALSE ); // Avoid window being resizable
1145
1137
1146
1138
// Disable FLAG_WINDOW_MINIMIZED, not supported on initialization
@@ -1633,67 +1625,15 @@ static void MouseEnterCallback(GLFWwindow *window, int enter)
1633
1625
static EM_BOOL EmscriptenKeyboardCallback(int eventType, const EmscriptenKeyboardEvent *keyboardEvent, void *userData)
1634
1626
{
1635
1627
// 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
+
1654
1629
return 1; // The event was consumed by the callback handler
1655
1630
}
1656
1631
*/
1657
1632
1658
1633
// Emscripten: Called on mouse input events
1659
1634
static EM_BOOL EmscriptenMouseCallback (int eventType , const EmscriptenMouseEvent * mouseEvent , void * userData )
1660
1635
{
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
1697
1637
1698
1638
return 1 ; // The event was consumed by the callback handler
1699
1639
}
0 commit comments