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 <wolv/utils/string.hpp>
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <numeric>
|
||||||
|
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include <imgui_internal.h>
|
#include <imgui_internal.h>
|
||||||
@ -620,7 +621,14 @@ namespace hex {
|
|||||||
#elif defined(OS_MACOS)
|
#elif defined(OS_MACOS)
|
||||||
return ::getBackingScaleFactor();
|
return ::getBackingScaleFactor();
|
||||||
#elif defined(OS_LINUX)
|
#elif defined(OS_LINUX)
|
||||||
return 1.0F;
|
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)
|
#elif defined(OS_WEB)
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
/*
|
/*
|
||||||
|
@ -433,8 +433,16 @@ namespace hex::init {
|
|||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS_LINUX) && defined(GLFW_WAYLAND_APP_ID)
|
#if defined(OS_LINUX)
|
||||||
glfwWindowHintString(GLFW_WAYLAND_APP_ID, "imhex");
|
#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
|
#endif
|
||||||
|
|
||||||
// Make splash screen non-resizable, undecorated and transparent
|
// Make splash screen non-resizable, undecorated and transparent
|
||||||
@ -457,6 +465,8 @@ namespace hex::init {
|
|||||||
std::exit(EXIT_FAILURE);
|
std::exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImHexApi::System::impl::setMainWindowHandle(m_window);
|
||||||
|
|
||||||
// Force window to be fully opaque by default
|
// Force window to be fully opaque by default
|
||||||
glfwSetWindowOpacity(m_window, 1.0F);
|
glfwSetWindowOpacity(m_window, 1.0F);
|
||||||
|
|
||||||
|
@ -114,9 +114,11 @@ namespace hex {
|
|||||||
|
|
||||||
void Window::configureGLFW() {
|
void Window::configureGLFW() {
|
||||||
#if defined(GLFW_SCALE_FRAMEBUFFER)
|
#if defined(GLFW_SCALE_FRAMEBUFFER)
|
||||||
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE);
|
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
||||||
|
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||||
glfwWindowHint(GLFW_DECORATED, ImHexApi::System::isBorderlessWindowModeEnabled() ? GL_FALSE : GL_TRUE);
|
glfwWindowHint(GLFW_DECORATED, ImHexApi::System::isBorderlessWindowModeEnabled() ? GL_FALSE : GL_TRUE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user