From a3291a86a6f8d02c04f4fc4359a8c9486a78f34c Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Tue, 19 Apr 2022 20:01:28 -0400 Subject: [PATCH] Patch glfw --- modules/games.nix | 24 +++++++++----- ...on-t-crash-on-calls-to-focus-or-icon.patch | 33 +++++++++++++++++++ 2 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 patches/minecraft/0003-Don-t-crash-on-calls-to-focus-or-icon.patch diff --git a/modules/games.nix b/modules/games.nix index 83471f7..e7d83c4 100644 --- a/modules/games.nix +++ b/modules/games.nix @@ -1,11 +1,17 @@ { pkgs, unstable, ... }: { - environment.systemPackages = with unstable; [ - # Dwarf fortress - (dwarf-fortress-packages.dwarf-fortress-full.override { - enableFPS = true; - }) - # PolyMC minecraft stuff - polymc - glfw-wayland - ]; + environment.systemPackages = + let + glfw-patched = unstable.glfw-wayland.overrideAttrs (attrs: { + patches = attrs.patches ++ [ ../patches/minecraft/0003-Don-t-crash-on-calls-to-focus-or-icon.patch ]; + }); + in + with unstable; [ + # Dwarf fortress + (dwarf-fortress-packages.dwarf-fortress-full.override { + enableFPS = true; + }) + # PolyMC minecraft stuff + polymc + glfw-patched + ]; } diff --git a/patches/minecraft/0003-Don-t-crash-on-calls-to-focus-or-icon.patch b/patches/minecraft/0003-Don-t-crash-on-calls-to-focus-or-icon.patch new file mode 100644 index 0000000..4ff500b --- /dev/null +++ b/patches/minecraft/0003-Don-t-crash-on-calls-to-focus-or-icon.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ecmel=20Berk=20Canl=C4=B1er?= +Date: Tue, 28 Dec 2021 19:41:19 +0300 +Subject: Don't crash on calls to focus or icon + +--- + src/wl_window.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/src/wl_window.c b/src/wl_window.c +index ec4e60cd..b8fc39e4 100644 +--- a/src/wl_window.c ++++ b/src/wl_window.c +@@ -1042,8 +1042,7 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) + void _glfwPlatformSetWindowIcon(_GLFWwindow* window, + int count, const GLFWimage* images) + { +- _glfwInputError(GLFW_PLATFORM_ERROR, +- "Wayland: Setting window icon not supported"); ++ fprintf(stderr, "!!! Ignoring Error: Wayland: Setting window icon not supported\n"); + } + + void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) +@@ -1231,8 +1230,7 @@ void _glfwPlatformRequestWindowAttention(_GLFWwindow* window) + + void _glfwPlatformFocusWindow(_GLFWwindow* window) + { +- _glfwInputError(GLFW_PLATFORM_ERROR, +- "Wayland: Focusing a window requires user interaction"); ++ fprintf(stderr, "!!! Ignoring Error: Wayland: Focusing a window requires user interaction\n"); + } + + void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,