summaryrefslogtreecommitdiff
path: root/modules/home/imhex-refresh-callback.patch
blob: 6f6c147b4ff4ef5064d76e983cee4fe16b72c37d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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..c53ea75 100644
--- a/main/gui/source/window/window.cpp
+++ b/main/gui/source/window/window.cpp
@@ -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())