Skip to content

Fix the overlay swallowing all pointer input - #10

Merged
guilyx merged 1 commit into
guilyx:mainfrom
animaartificialis:fix-wayland-click-through
Oct 25, 2026
Merged

guilyx merged 1 commit into
guilyx:mainfrom
animaartificialis:fix-wayland-click-through

Conversation

@animaartificialis

Copy link
Copy Markdown
Contributor

Starting the overlay made the whole desktop unclickable — mouse and touchpad stopped responding until it was stopped. Reproduced on a KDE/KWin Wayland session with gtk-layer-shell, but the cause is backend-independent and applies to X11 too.

The empty input region was set on the GdkWindow from the realize handler, and GTK undid it immediately afterwards: gtk_widget_realize() emits realize and then calls gtk_widget_update_input_shape(), which finds no widget-level shape and resets the window's input region to NULL — accept all pointer events. The full-screen OVERLAY-layer window then captured every click.

This sets the region with Gtk.Widget.input_shape_combine_region() instead, so GTK re-applies it after realize, and re-asserts it on map: on Wayland GTK destroys the wl_surface on hide and builds a new one on show without re-sending the region (nothing marks it dirty), so toggle/hide+show would otherwise start swallowing clicks again.

Also drops the set_pass_through() call — it only affects event routing between GDK child windows, not a toplevel's compositor input region.

Tested on KDE Wayland: clicks pass through to the windows underneath, and still do after hiding and re-showing the overlay.

Starting the overlay made the whole desktop unclickable — mouse and touchpad
stopped working until it was stopped (seen on KDE/KWin Wayland, but the cause is
backend-independent and affects X11 too).

The empty input region was set on the GdkWindow from the "realize" handler, and
GTK undid it immediately afterwards: gtk_widget_realize() emits "realize" and
then calls gtk_widget_update_input_shape(), which finds no widget-level shape
and resets the window's input region to NULL — accept all pointer events. The
full-screen OVERLAY-layer window then captured every click.

Set the region with Gtk.Widget.input_shape_combine_region() instead, so GTK
itself re-applies it after realize, and re-assert it on "map": on Wayland GTK
destroys the wl_surface on hide and builds a new one on show without re-sending
the region (nothing marks it dirty), so toggling the overlay would otherwise
start swallowing clicks again.

Also drops the set_pass_through() call: it only affects event routing between
GDK child windows, not a toplevel's compositor input region.

@guilyx guilyx left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, LGTM

Sorry for the delay

@guilyx
guilyx merged commit 33fd8c4 into guilyx:main Oct 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants