aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/render
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-04-20 20:16:42 +0100
committerVaxry <[email protected]>2024-04-20 20:16:42 +0100
commit4ad739ec63c9a11f0537a884ae2a4c56d6bab10b (patch)
tree0842db7489691fc6e7cbb3cd6d3321dd0d4790b6 /src/render
parent1055e6bee677ef9c4ab4d09e43155e00a98a3b49 (diff)
downloadHyprland-4ad739ec63c9a11f0537a884ae2a4c56d6bab10b.tar.gz
Hyprland-4ad739ec63c9a11f0537a884ae2a4c56d6bab10b.zip
HookSystem: improve callback safety
Diffstat (limited to 'src/render')
-rw-r--r--src/render/OpenGL.cpp2
-rw-r--r--src/render/Renderer.cpp4
-rw-r--r--src/render/decorations/DecorationPositioner.cpp4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 9e3fb47b..981541b2 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -52,7 +52,7 @@ CHyprOpenGLImpl::CHyprOpenGLImpl() {
Debug::log(WARN, "!RENDERER: Using the legacy GLES2 renderer!");
#endif
- g_pHookSystem->hookDynamic("preRender", [&](void* self, SCallbackInfo& info, std::any data) { preRender(std::any_cast<CMonitor*>(data)); });
+ static auto P = g_pHookSystem->hookDynamic("preRender", [&](void* self, SCallbackInfo& info, std::any data) { preRender(std::any_cast<CMonitor*>(data)); });
RASSERT(eglMakeCurrent(wlr_egl_get_display(g_pCompositor->m_sWLREGL), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT), "Couldn't unset current EGL!");
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 672adb1d..a51901b4 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -60,7 +60,7 @@ CHyprRenderer::CHyprRenderer() {
// cursor hiding stuff
- g_pHookSystem->hookDynamic("keyPress", [&](void* self, SCallbackInfo& info, std::any param) {
+ static auto P = g_pHookSystem->hookDynamic("keyPress", [&](void* self, SCallbackInfo& info, std::any param) {
if (m_sCursorHiddenConditions.hiddenOnKeyboard)
return;
@@ -68,7 +68,7 @@ CHyprRenderer::CHyprRenderer() {
ensureCursorRenderingMode();
});
- g_pHookSystem->hookDynamic("mouseMove", [&](void* self, SCallbackInfo& info, std::any param) {
+ static auto P2 = g_pHookSystem->hookDynamic("mouseMove", [&](void* self, SCallbackInfo& info, std::any param) {
if (!m_sCursorHiddenConditions.hiddenOnKeyboard && m_sCursorHiddenConditions.hiddenOnTouch == g_pInputManager->m_bLastInputTouch &&
!m_sCursorHiddenConditions.hiddenOnTimeout)
return;
diff --git a/src/render/decorations/DecorationPositioner.cpp b/src/render/decorations/DecorationPositioner.cpp
index 145a697b..4837382a 100644
--- a/src/render/decorations/DecorationPositioner.cpp
+++ b/src/render/decorations/DecorationPositioner.cpp
@@ -2,12 +2,12 @@
#include "../../Compositor.hpp"
CDecorationPositioner::CDecorationPositioner() {
- g_pHookSystem->hookDynamic("closeWindow", [this](void* call, SCallbackInfo& info, std::any data) {
+ static auto P = g_pHookSystem->hookDynamic("closeWindow", [this](void* call, SCallbackInfo& info, std::any data) {
auto* const PWINDOW = std::any_cast<CWindow*>(data);
this->onWindowUnmap(PWINDOW);
});
- g_pHookSystem->hookDynamic("openWindow", [this](void* call, SCallbackInfo& info, std::any data) {
+ static auto P2 = g_pHookSystem->hookDynamic("openWindow", [this](void* call, SCallbackInfo& info, std::any data) {
auto* const PWINDOW = std::any_cast<CWindow*>(data);
this->onWindowMap(PWINDOW);
});