Let pointer events pass through

Guillermo Rodriguez guillerodriguez.dev at gmail.com
Mon Nov 18 15:49:37 UTC 2019


El lun., 18 nov. 2019 a las 13:49, Simon Ser (<contact at emersion.fr>) escribió:
>
> On Monday, November 18, 2019 1:37 PM, Guillermo Rodriguez <guillerodriguez.dev at gmail.com> wrote:
>
> > Hello,
> >
> > I am writing a Wayland client that acts as an OSD "overlay" on top of
> > another application. This OSD overlay should not handle any pointer
> > events -- these should "pass through" and be handled by the
> > application below.
> >
> > From the docs, wwl_surface::set_input_region looked promising:
> >
> > > Input events happening outside of this region will try the next surface in the server surface stack. The compositor ignores the parts of the input region that fall outside of the surface. [...] The initial value for an input region is infinite. That means the whole surface will accept input. Setting the pending input region has copy semantics, and the wl_region object can be destroyed immediately. A NULL wl_region causes the input region to be set to infinite.
> >
> > I am trying this:
> >
> > struct wl_region* region =
> > wl_compositor_create_region(_glfw.wl.compositor);
> > wl_surface_set_input_region(window->wl.surface, region);
> >
> >         wl_region_destroy(region);
> >
> >
> > However it doesn't seem to work -- pointer events do not seem to "pass through".
> >
> > Same problem is also reported here: https://github.com/glfw/glfw/pull/1568
> >
> > Is this approach correct? Any hints on how to debug this?
>
> This should work. Other clients do this, for instance swaybg [1].
>
> This is probably a GNOME bug. I'd suggest trying on other compositors
> (KDE, Weston, Sway, …) and report a GNOME bug if it only happens on
> GNOME.

Just tested on Weston, and indeed this *almost* works. I say "almost"
because pointer events do in fact pass through. But then when the
application below receives the event, it is brought to top by Weston,
thus obscuring the
OSD "overlay".

I searched for a way to indicate that a surface should always stay on
top and it looks like this is not supported (by design apparently). Is
there any way to achieve this?

Thank,

Guillermo Rodriguez


More information about the wayland-devel mailing list