Skip to content

Commit

Permalink
WaylandBackend: Ignore events on unknown surfaces
Browse files Browse the repository at this point in the history
wl_pointer enter/leave events are being processed for what I think are libdecor surfaces, this
means the surface user_data is being miscast as CWaylandPlane.
  • Loading branch information
ColinKinloch committed Oct 26, 2024
1 parent 056b79e commit 92dcb80
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Backends/WaylandBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,16 @@ namespace gamescope
return &iter->second;
}

bool IsSurfacePlane(wl_surface *pSurface)
{
for ( uint32_t i = 0; i < 8; i++ )
{
if (m_Planes[i].GetSurface() == pSurface)
return true;
}
return false;
}

bool CurrentDisplaySupportsVRR() const { return HostCompositorIsCurrentlyVRR(); }
wl_region *GetFullRegion() const { return m_pFullRegion; }

Expand Down Expand Up @@ -2573,6 +2583,9 @@ namespace gamescope

void CWaylandInputThread::Wayland_Pointer_Enter( wl_pointer *pPointer, uint32_t uSerial, wl_surface *pSurface, wl_fixed_t fSurfaceX, wl_fixed_t fSurfaceY )
{
if (!m_pBackend->IsSurfacePlane(pSurface))
return;

CWaylandPlane *pPlane = (CWaylandPlane *)wl_surface_get_user_data( pSurface );
if ( !pPlane )
return;
Expand All @@ -2584,6 +2597,9 @@ namespace gamescope
}
void CWaylandInputThread::Wayland_Pointer_Leave( wl_pointer *pPointer, uint32_t uSerial, wl_surface *pSurface )
{
if (!m_pBackend->IsSurfacePlane(pSurface))
return;

CWaylandPlane *pPlane = (CWaylandPlane *)wl_surface_get_user_data( pSurface );
if ( !pPlane )
return;
Expand Down

0 comments on commit 92dcb80

Please sign in to comment.