detect Wayland special case at runtime
This commit is contained in:
parent
312f9c2cb7
commit
dc4c60bf62
|
|
@ -1410,7 +1410,7 @@ int InitPlatform(void)
|
||||||
// REF: https://github.com/raysan5/raylib/issues/1554
|
// REF: https://github.com/raysan5/raylib/issues/1554
|
||||||
glfwSetJoystickCallback(NULL);
|
glfwSetJoystickCallback(NULL);
|
||||||
|
|
||||||
// By default, when a fullscreen window looses focus, GLFW iconifies it and restores the desktop monitor resolution.
|
// By default, when a fullscreen window loses focus, GLFW iconifies it and restores the desktop monitor resolution.
|
||||||
// This default behavior can be emulated on user's side with a simple code : `if ( ! IsWindowFocused() ) MinimizeWindow();`
|
// This default behavior can be emulated on user's side with a simple code : `if ( ! IsWindowFocused() ) MinimizeWindow();`
|
||||||
// So we disable this GLFW default behavior and let the user decides by themself the behavior of their program :
|
// So we disable this GLFW default behavior and let the user decides by themself the behavior of their program :
|
||||||
glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE);
|
glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE);
|
||||||
|
|
@ -1560,15 +1560,18 @@ int InitPlatform(void)
|
||||||
{
|
{
|
||||||
// NOTE: On APPLE and Wayland platforms system should manage window/input scaling and also framebuffer scaling.
|
// NOTE: On APPLE and Wayland platforms system should manage window/input scaling and also framebuffer scaling.
|
||||||
// Framebuffer scaling should be activated with: glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
|
// Framebuffer scaling should be activated with: glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
|
||||||
#if !defined(__APPLE__) && !defined(_GLFW_WAYLAND)
|
#if !defined(__APPLE__)
|
||||||
glfwGetFramebufferSize(platform.handle, &fbWidth, &fbHeight);
|
if ( glfwGetPlatform() != GLFW_PLATFORM_WAYLAND )
|
||||||
|
{
|
||||||
|
glfwGetFramebufferSize(platform.handle, &fbWidth, &fbHeight);
|
||||||
|
|
||||||
// Screen scaling matrix is required in case desired screen area is different from display area
|
// Screen scaling matrix is required in case desired screen area is different from display area
|
||||||
CORE.Window.screenScale = MatrixScale((float)fbWidth/CORE.Window.screen.width, (float)fbHeight/CORE.Window.screen.height, 1.0f);
|
CORE.Window.screenScale = MatrixScale((float)fbWidth/CORE.Window.screen.width, (float)fbHeight/CORE.Window.screen.height, 1.0f);
|
||||||
|
|
||||||
// Mouse input scaling for the new screen size
|
// Mouse input scaling for the new screen size
|
||||||
// TODO FIXME does Wayland requires mouse scaling too ?
|
// TODO FIXME does Wayland requires mouse scaling too ?
|
||||||
SetMouseScale((float)CORE.Window.screen.width/fbWidth, (float)CORE.Window.screen.height/fbHeight);
|
SetMouseScale((float)CORE.Window.screen.width/fbWidth, (float)CORE.Window.screen.height/fbHeight);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1705,11 +1708,11 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height)
|
||||||
CORE.Window.currentFbo.height = height;
|
CORE.Window.currentFbo.height = height;
|
||||||
CORE.Window.resizedLastFrame = true;
|
CORE.Window.resizedLastFrame = true;
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(_GLFW_WAYLAND)
|
#if defined(__APPLE__)
|
||||||
CORE.Window.screen.width = width;
|
CORE.Window.screen.width = width;
|
||||||
CORE.Window.screen.height = height;
|
CORE.Window.screen.height = height;
|
||||||
#else
|
#else
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
|
if ( ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0 ) && (glfwGetPlatform() != GLFW_PLATFORM_WAYLAND) )
|
||||||
{
|
{
|
||||||
Vector2 windowScaleDPI = GetWindowScaleDPI();
|
Vector2 windowScaleDPI = GetWindowScaleDPI();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user