summaryrefslogtreecommitdiff
path: root/modules/home
diff options
context:
space:
mode:
authorChristian <[email protected]>2026-05-25 21:40:00 -0500
committerChristian <[email protected]>2026-05-25 21:40:00 -0500
commitb1d722eb3be911aae297914ba6d452537f7761ec (patch)
tree390deb47ebb81f8b2f86b3a2bf1b3f378ae62ac7 /modules/home
parent9f73fffecc405e9425acbdce982707f605545427 (diff)
Patch imhex to fix refresh callback
Diffstat (limited to 'modules/home')
-rw-r--r--modules/home/imhex-refresh-callback.patch45
-rw-r--r--modules/home/re.nix4
2 files changed, 39 insertions, 10 deletions
diff --git a/modules/home/imhex-refresh-callback.patch b/modules/home/imhex-refresh-callback.patch
index eef0251..6f6c147 100644
--- a/modules/home/imhex-refresh-callback.patch
+++ b/modules/home/imhex-refresh-callback.patch
@@ -1,12 +1,39 @@
+diff --git a/main/gui/include/window.hpp b/main/gui/include/window.hpp
+index 48a5b82..554f9c2 100644
+--- a/main/gui/include/window.hpp
++++ b/main/gui/include/window.hpp
+@@ -83,6 +83,8 @@ namespace hex {
+ std::atomic<bool> m_wakeupFlag;
+ std::condition_variable m_wakeupCondVar;
+
++ std::atomic<bool> m_forceRedraw = false;
++
+
+ gl::Shader m_postProcessingShader;
+ };
+diff --git a/main/gui/source/window/linux_window.cpp b/main/gui/source/window/linux_window.cpp
+index 53ad078..2d9f8b1 100644
+--- a/main/gui/source/window/linux_window.cpp
++++ b/main/gui/source/window/linux_window.cpp
+@@ -179,6 +179,7 @@ namespace hex {
+
+ glfwSetWindowRefreshCallback(m_window, [](GLFWwindow *window) {
+ auto win = static_cast<Window *>(glfwGetWindowUserPointer(window));
++ win->m_forceRedraw = true;
+ win->fullFrame();
+ });
+
diff --git a/main/gui/source/window/window.cpp b/main/gui/source/window/window.cpp
-index e0469cb..114a0e9 100644
+index e0469cb..c53ea75 100644
--- a/main/gui/source/window/window.cpp
+++ b/main/gui/source/window/window.cpp
-@@ -1099,6 +1099,7 @@ namespace hex {
- glfwSetCursorPosCallback(m_window, unlockFrameRate);
- glfwSetMouseButtonCallback(m_window, unlockFrameRate);
- glfwSetScrollCallback(m_window, unlockFrameRate);
-+ glfwSetWindowRefreshCallback(m_window, unlockFrameRate);
-
- glfwSetWindowFocusCallback(m_window, [](GLFWwindow *window, int focused) {
- unlockFrameRate(window);
+@@ -825,6 +825,9 @@ namespace hex {
+ ImGui::RenderPlatformWindowsDefault();
+ glfwMakeContextCurrent(backupContext);
+
++ if (m_forceRedraw.exchange(false))
++ shouldRender = true;
++
+ if (shouldRender) {
+ #if !defined(OS_WEB)
+ if (m_postProcessingShader.isValid())
diff --git a/modules/home/re.nix b/modules/home/re.nix
index 8a03173..03fde12 100644
--- a/modules/home/re.nix
+++ b/modules/home/re.nix
@@ -8,7 +8,9 @@
home.packages = [
pkgs.binaryninja-free
pkgs.avalonia-ilspy
- pkgs.imhex
+ (pkgs.imhex.overrideAttrs (old: {
+ patches = [ ./imhex-refresh-callback.patch ];
+ }))
(import ./ghidra.nix { inherit pkgs; })
];
}