1
0
mirror of synced 2025-02-17 10:58:34 +01:00

fix: Wayland error discarding build errors with older GLFW versions

This commit is contained in:
WerWolv 2024-05-17 20:22:55 +02:00
parent 275774a10a
commit 7a14e3dac4
2 changed files with 16 additions and 6 deletions

View File

@ -398,11 +398,16 @@ namespace hex::init {
void WindowSplash::initGLFW() {
glfwSetErrorCallback([](int errorCode, const char *desc) {
if (errorCode == GLFW_PLATFORM_ERROR || errorCode == GLFW_FEATURE_UNAVAILABLE) {
bool isWaylandError = errorCode == GLFW_PLATFORM_ERROR;
#if defined(GLFW_FEATURE_UNAVAILABLE)
isWaylandError = isWaylandError || (errorCode == GLFW_FEATURE_UNAVAILABLE);
#endif
isWaylandError = isWaylandError && std::string_view(desc).contains("Wayland");
if (isWaylandError) {
// Ignore error spam caused by Wayland not supporting moving or resizing
// windows or querying their position and size.
if (std::string_view(desc).contains("Wayland"))
return;
return;
}
lastGlfwError.errorCode = errorCode;

View File

@ -698,11 +698,16 @@ namespace hex {
void Window::initGLFW() {
auto initialWindowProperties = ImHexApi::System::getInitialWindowProperties();
glfwSetErrorCallback([](int error, const char *desc) {
if (error == GLFW_PLATFORM_ERROR || error == GLFW_FEATURE_UNAVAILABLE) {
bool isWaylandError = error == GLFW_PLATFORM_ERROR;
#if defined(GLFW_FEATURE_UNAVAILABLE)
isWaylandError = isWaylandError || (error == GLFW_FEATURE_UNAVAILABLE);
#endif
isWaylandError = isWaylandError && std::string_view(desc).contains("Wayland");
if (isWaylandError) {
// Ignore error spam caused by Wayland not supporting moving or resizing
// windows or querying their position and size.
if (std::string_view(desc).contains("Wayland"))
return;
return;
}
try {