impr: Properly scale window on wayland
This commit is contained in:
parent
525ab8d945
commit
dcd80fe6ad
@ -11,6 +11,7 @@
|
||||
#include <wolv/utils/string.hpp>
|
||||
|
||||
#include <utility>
|
||||
#include <numeric>
|
||||
|
||||
#include <imgui.h>
|
||||
#include <imgui_internal.h>
|
||||
@ -620,7 +621,14 @@ namespace hex {
|
||||
#elif defined(OS_MACOS)
|
||||
return ::getBackingScaleFactor();
|
||||
#elif defined(OS_LINUX)
|
||||
if (std::string_view(::getenv("XDG_SESSION_TYPE")) == "x11")
|
||||
return 1.0F;
|
||||
else {
|
||||
float xScale = 0, yScale = 0;
|
||||
glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &xScale, &yScale);
|
||||
|
||||
return std::midpoint(xScale, yScale);
|
||||
}
|
||||
#elif defined(OS_WEB)
|
||||
return 1.0F;
|
||||
/*
|
||||
|
@ -433,10 +433,18 @@ namespace hex::init {
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||
#endif
|
||||
|
||||
#if defined(OS_LINUX) && defined(GLFW_WAYLAND_APP_ID)
|
||||
#if defined(OS_LINUX)
|
||||
#if defined(GLFW_WAYLAND_APP_ID)
|
||||
glfwWindowHintString(GLFW_WAYLAND_APP_ID, "imhex");
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_SCALE_FRAMEBUFFER)
|
||||
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
|
||||
#endif
|
||||
|
||||
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
||||
#endif
|
||||
|
||||
// Make splash screen non-resizable, undecorated and transparent
|
||||
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
|
||||
@ -457,6 +465,8 @@ namespace hex::init {
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ImHexApi::System::impl::setMainWindowHandle(m_window);
|
||||
|
||||
// Force window to be fully opaque by default
|
||||
glfwSetWindowOpacity(m_window, 1.0F);
|
||||
|
||||
|
@ -114,9 +114,11 @@ namespace hex {
|
||||
|
||||
void Window::configureGLFW() {
|
||||
#if defined(GLFW_SCALE_FRAMEBUFFER)
|
||||
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE);
|
||||
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
|
||||
#endif
|
||||
|
||||
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
||||
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||
glfwWindowHint(GLFW_DECORATED, ImHexApi::System::isBorderlessWindowModeEnabled() ? GL_FALSE : GL_TRUE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user