aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-08-08 21:20:41 +0200
committervaxerski <[email protected]>2022-08-08 21:20:41 +0200
commit6f137938da14a1b5b71cfdad51101d7a6f25320c (patch)
tree9ac1fe9e8a2ef8010cac33d10e766fdf4726c5a0
parent9fca4b5bc2136f00f81376d76f1074d9a1b9dfdc (diff)
downloadHyprland-6f137938da14a1b5b71cfdad51101d7a6f25320c.tar.gz
Hyprland-6f137938da14a1b5b71cfdad51101d7a6f25320c.zip
send enter and leave events for surfacesv0.10.0beta
-rw-r--r--src/Window.cpp28
-rw-r--r--src/Window.hpp3
2 files changed, 30 insertions, 1 deletions
diff --git a/src/Window.cpp b/src/Window.cpp
index 9b9f5443..1adda1a0 100644
--- a/src/Window.cpp
+++ b/src/Window.cpp
@@ -164,6 +164,8 @@ void CWindow::destroyToplevelHandle() {
}
void CWindow::updateToplevel() {
+ updateSurfaceOutputs();
+
if (!m_phForeignToplevel)
return;
@@ -176,4 +178,30 @@ void CWindow::updateToplevel() {
m_iLastToplevelMonitorID = m_iMonitorID;
}
+}
+
+void sendEnterIter(wlr_surface* pSurface, int x, int y, void* data) {
+ const auto OUTPUT = (wlr_output*)data;
+ wlr_surface_send_enter(pSurface, OUTPUT);
+}
+
+void sendLeaveIter(wlr_surface* pSurface, int x, int y, void* data) {
+ const auto OUTPUT = (wlr_output*)data;
+ wlr_surface_send_leave(pSurface, OUTPUT);
+}
+
+void CWindow::updateSurfaceOutputs() {
+ if (m_iLastSurfaceMonitorID == m_iMonitorID)
+ return;
+
+ const auto PLASTMONITOR = g_pCompositor->getMonitorFromID(m_iLastSurfaceMonitorID);
+
+ m_iLastSurfaceMonitorID = m_iMonitorID;
+
+ const auto PNEWMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
+
+ if (PLASTMONITOR)
+ wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(this), sendLeaveIter, PLASTMONITOR->output);
+
+ wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(this), sendEnterIter, PNEWMONITOR->output);
} \ No newline at end of file
diff --git a/src/Window.hpp b/src/Window.hpp
index 139a5db5..6fda4ed3 100644
--- a/src/Window.hpp
+++ b/src/Window.hpp
@@ -132,6 +132,7 @@ public:
// for toplevel monitor events
uint64_t m_iLastToplevelMonitorID = -1;
+ uint64_t m_iLastSurfaceMonitorID = -1;
// For the list lookup
bool operator==(const CWindow& rhs) {
@@ -147,5 +148,5 @@ public:
void createToplevelHandle();
void destroyToplevelHandle();
void updateToplevel();
-
+ void updateSurfaceOutputs();
};