mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-22 17:49:50 +01:00
send enter and leave events for surfaces
This commit is contained in:
parent
9fca4b5bc2
commit
6f137938da
2 changed files with 30 additions and 1 deletions
|
@ -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);
|
||||
}
|
|
@ -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();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue