From 94d0328ed8b2696bee48aff79768a21a3a8dc1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Duguay-L=C3=A9tourneau?= Date: Thu, 24 Sep 2026 10:06:22 -0400 Subject: [PATCH] linux: attach the seat pointer to synthesized leave events A crossing event has no device field to assign the way motion, button and scroll do, so the synthesized leave went out without one and GDK warned "Event with type 11 not holding a GdkDevice" on every pointer leave out of an offscreen web view. Set it through gdk_event_set_device, as the synthesized key events already do. The Desktop sample logs the warning 33 times in a 25 second run, and none after. Co-Authored-By: Claude Opus 5 --- .../Gtk/GtkOffscreenWebViewAdapter.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Avalonia.Controls.WebView.Core/Gtk/GtkOffscreenWebViewAdapter.cs b/src/Avalonia.Controls.WebView.Core/Gtk/GtkOffscreenWebViewAdapter.cs index 9e79a94..c881ae7 100644 --- a/src/Avalonia.Controls.WebView.Core/Gtk/GtkOffscreenWebViewAdapter.cs +++ b/src/Avalonia.Controls.WebView.Core/Gtk/GtkOffscreenWebViewAdapter.cs @@ -246,8 +246,13 @@ public bool PointerLeaveInput(PointerPoint point, double dpi, KeyModifiers modif { return RunOnGlibThread(() => { + var gdisplay = gdk_display_get_default(); + var seat = gdk_display_get_default_seat(gdisplay); + var gdevice = gdk_seat_get_pointer(seat); + using var state = new EventSendState(GdkEventType.GDK_LEAVE_NOTIFY, WebViewHandle); var ev = state.Event; + gdk_event_set_device(new IntPtr(ev), gdevice); ev->crossing.x = point.Position.X * dpi; ev->crossing.y = point.Position.Y * dpi; ev->crossing.time = 0;