public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/gtk3] f44: Added #9852 (Allow to export xdg_toplevel from GdkWindowWayland) and  #9956 (gtkwindow: Clear active state on disappearing pointer)
@ 2026-07-23  7:51 Martin Stransky
  0 siblings, 0 replies; only message in thread
From: Martin Stransky @ 2026-07-23  7:51 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/gtk3
Branch : f44
Commit : 6f19bf1e945dde6e1684e79d63eefb179e5c6396
Author : Martin Stransky <stransky@redhat.com>
Date   : 2026-07-23T09:51:50+02:00
Stats  : +205/-0 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/gtk3/c/6f19bf1e945dde6e1684e79d63eefb179e5c6396?branch=f44

Log:
Added #9852 (Allow to export xdg_toplevel from GdkWindowWayland) and  #9956 (gtkwindow: Clear active state on disappearing pointer)

---
diff --git a/9852_export_xdg_toplevel.patch b/9852_export_xdg_toplevel.patch
new file mode 100644
index 0000000..bff50c8
--- /dev/null
+++ b/9852_export_xdg_toplevel.patch
@@ -0,0 +1,158 @@
+Allow to export xdg_toplevel from GdkWindowWayland
+
+Emit xdg-toplevel-realized signal when xdg_toplevel is created but
+before it's commited. An application can listen on that signal and use
+xdg-toplevel to perform session restore for associated GdkWindow.
+
+Add gdk_wayland_window_get_xdg_toplevel() call to export xdg-toplevel
+from GdkWindow.
+
+Part-of: <!9852>
+
+diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
+index 1833777500d349a6aadff4181de4bcc38a11ff30..ba09d45c245420b3431af0aa2d51815397fec230 100644
+--- a/docs/reference/gdk/gdk3-sections.txt
++++ b/docs/reference/gdk/gdk3-sections.txt
+@@ -1281,6 +1281,7 @@ gdk_wayland_window_unexport_handle
+ gdk_wayland_window_set_transient_for_exported
+ gdk_wayland_window_add_frame_callback_surface
+ gdk_wayland_window_remove_frame_callback_surface
++gdk_wayland_window_get_xdg_toplevel
+ 
+ <SUBSECTION Standard>
+ GDK_TYPE_WAYLAND_DEVICE
+diff --git a/gdk/wayland/gdkwaylandwindow.h b/gdk/wayland/gdkwaylandwindow.h
+index b8a8a022435a5f03edd7534dabf3970785597de0..96ddfcc8246a7323ffc3c47d4ee308591e6a5186 100644
+--- a/gdk/wayland/gdkwaylandwindow.h
++++ b/gdk/wayland/gdkwaylandwindow.h
+@@ -94,6 +94,8 @@ void gdk_wayland_window_add_frame_callback_surface (GdkWindow         *window,
+ GDK_AVAILABLE_IN_3_24
+ void gdk_wayland_window_remove_frame_callback_surface (GdkWindow         *window,
+                                                        struct wl_surface *surface);
++GDK_AVAILABLE_IN_3_24
++struct xdg_toplevel * gdk_wayland_window_get_xdg_toplevel (GdkWindow *window);
+ 
+ G_END_DECLS
+ 
+diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
+index 533d06fbaa60a10d34ae62a242c868956b76b085..2a3157baf25769418213ab46386602bba7aef832 100644
+--- a/gdk/wayland/gdkwindow-wayland.c
++++ b/gdk/wayland/gdkwindow-wayland.c
+@@ -40,12 +40,21 @@
+ #include <string.h>
+ #include <errno.h>
+ 
++/* GdkWindowImplWayland */
+ enum {
+-  COMMITTED,
++  IMPL_COMMITTED,
++
++  IMPL_LAST_SIGNAL
++};
++
++/* GdkWindowWayland */
++enum {
++  XDG_TOPLEVEL_REALIZED,
+ 
+   LAST_SIGNAL
+ };
+ 
++static guint impl_signals[IMPL_LAST_SIGNAL];
+ static guint signals[LAST_SIGNAL];
+ 
+ #define WINDOW_IS_TOPLEVEL_OR_FOREIGN(window) \
+@@ -77,6 +86,27 @@ G_DEFINE_TYPE (GdkWaylandWindow, gdk_wayland_window, GDK_TYPE_WINDOW)
+ static void
+ gdk_wayland_window_class_init (GdkWaylandWindowClass *wayland_window_class)
+ {
++  GObjectClass *object_class = G_OBJECT_CLASS (wayland_window_class);
++
++  /**
++   * GdkWindow::xdg-toplevel-realized:
++   * @window: the #GdkWindow which received the signal
++   *
++   * Emitted when an `xdg_toplevel` is created for @window during
++   * realization. The toplevel can be retrieved with
++   * gdk_wayland_window_get_xdg_toplevel().
++   *
++   * This signal is emitted before the first commit to the Wayland
++   * surface owned by @window.
++   *
++   * Since: 3.24
++   */
++  signals[XDG_TOPLEVEL_REALIZED] = g_signal_new ("xdg-toplevel-realized",
++                                                 GDK_TYPE_WAYLAND_WINDOW,
++                                                 G_SIGNAL_RUN_LAST,
++                                                 0,
++                                                 NULL, NULL, NULL,
++                                                 G_TYPE_NONE, 0);
+ }
+ 
+ static void
+@@ -740,7 +770,7 @@ on_frame_clock_after_paint (GdkFrameClock *clock,
+   impl->pending_frame_counter = gdk_frame_clock_get_frame_counter (clock);
+   impl->awaiting_frame = TRUE;
+ 
+-  g_signal_emit (impl, signals[COMMITTED], 0);
++  g_signal_emit (impl, impl_signals[IMPL_COMMITTED], 0);
+ }
+ 
+ static void
+@@ -2227,6 +2257,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
+   if (impl->hint == GDK_WINDOW_TYPE_HINT_DIALOG)
+     _gdk_wayland_screen_add_orphan_dialog (window);
+ 
++  g_signal_emit (window, signals[XDG_TOPLEVEL_REALIZED], 0);
+   wl_surface_commit (impl->display_server.wl_surface);
+ }
+ 
+@@ -5161,12 +5192,12 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
+   impl_class->invalidate_for_new_frame = gdk_wayland_window_invalidate_for_new_frame;
+   impl_class->titlebar_gesture = gdk_wayland_window_titlebar_gesture;
+ 
+-  signals[COMMITTED] = g_signal_new ("committed",
+-                                     G_TYPE_FROM_CLASS (object_class),
+-                                     G_SIGNAL_RUN_LAST,
+-                                     0,
+-                                     NULL, NULL, NULL,
+-                                     G_TYPE_NONE, 0);
++  impl_signals[IMPL_COMMITTED] = g_signal_new ("committed",
++                                               G_TYPE_FROM_CLASS (object_class),
++                                               G_SIGNAL_RUN_LAST,
++                                               0,
++                                               NULL, NULL, NULL,
++                                               G_TYPE_NONE, 0);
+ }
+ 
+ void
+@@ -5285,6 +5316,30 @@ gdk_wayland_window_get_gtk_surface (GdkWindow *window)
+   return GDK_WINDOW_IMPL_WAYLAND (window->impl)->display_server.gtk_surface;
+ }
+ 
++/**
++ * gdk_wayland_window_get_xdg_toplevel:
++ * @window: (type GdkWaylandWindow): a #GdkWindow
++ *
++ * Returns the `xdg_toplevel` associated with the Wayland surface of
++ * @window, or %NULL if the window does not currently have one (e.g.,
++ * the window is not yet realized or is not a toplevel).
++ *
++ * Use the #GdkWindow::xdg-toplevel-realized signal to be notified
++ * when the `xdg_toplevel` becomes available.
++ *
++ * Returns: (nullable) (transfer none): the Wayland `xdg_toplevel`,
++ *   or %NULL
++ *
++ * Since: 3.24
++ */
++struct xdg_toplevel *
++gdk_wayland_window_get_xdg_toplevel (GdkWindow *window)
++{
++  g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL);
++
++  return GDK_WINDOW_IMPL_WAYLAND (window->impl)->display_server.xdg_toplevel;
++}
++
+ /**
+  * gdk_wayland_window_set_use_custom_surface:
+  * @window: (type GdkWaylandWindow): a #GdkWindow

diff --git a/9956_pointer_focus.patch b/9956_pointer_focus.patch
new file mode 100644
index 0000000..e017425
--- /dev/null
+++ b/9956_pointer_focus.patch
@@ -0,0 +1,45 @@
+gtkwindow: Clear active state on disappearing pointer
+
+If the pointer focus is considered to be no longer on the surface
+while there is an implicit grab, we were leaving the active state
+stale.
+
+On Wayland this may happen in multiple legit circumstances, e.g.
+if the input is stolen by the compositor when a pointer button is
+pressed, as well as other less legit situations (crossing within
+surfaces from the same client). Either way, if the pointer has
+left, we should consider its previous active state as no longer
+applying.
+
+GTK3 adaptation: since GTK3 lacks the GtkPointerFocus infrastructure,
+the fix synthesizes button release events in the Wayland backend's
+pointer_handle_leave when buttons are still pressed. This ensures
+widgets properly clear their pressed/active state instead of leaving
+it stale.
+
+Part-of: <!9956>
+
+diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
+index 973005a06385e751df6db989937c26b8955d46f7..f093e999e0dd2b7ea238958ca3447ba0fa63aad9 100644
+--- a/gdk/wayland/gdkdevice-wayland.c
++++ b/gdk/wayland/gdkdevice-wayland.c
+@@ -1719,6 +1719,19 @@ pointer_handle_leave (void              *data,
+ 
+   _gdk_wayland_display_update_serial (display_wayland, serial);
+ 
++  if (seat->pointer_info.button_modifiers)
++    {
++      seat->pointer_info.button_modifiers = 0;
++
++      GDK_NOTE (EVENTS,
++                g_message ("ending implicit grab, seat %p", seat));
++      _gdk_display_end_device_grab (seat->display,
++                                    seat->master_pointer,
++                                    _gdk_display_get_next_serial (seat->display),
++                                    seat->pointer_info.focus,
++                                    TRUE);
++    }
++
+   event = gdk_wayland_seat_get_frame_event (seat, GDK_LEAVE_NOTIFY);
+   event->crossing.window = g_object_ref (seat->pointer_info.focus);
+   gdk_event_set_device (event, seat->master_pointer);

diff --git a/gtk3.spec b/gtk3.spec
index 51b0231..e6d7503 100644
--- a/gtk3.spec
+++ b/gtk3.spec
@@ -28,6 +28,8 @@ Summary: GTK+ graphical user interface library
 License: LGPL-2.0-or-later
 URL:     https://gtk.org
 Source0: https://download.gnome.org/sources/gtk/%{major_minor_version}/gtk-%{version}.tar.xz
+Patch0:  9852_export_xdg_toplevel.patch
+Patch1:  9956_pointer_focus.patch
 
 BuildRequires: pkgconfig(atk) >= %{atk_version}
 BuildRequires: pkgconfig(atk-bridge-2.0)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-23  7:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-23  7:51 [rpms/gtk3] f44: Added #9852 (Allow to export xdg_toplevel from GdkWindowWayland) and #9956 (gtkwindow: Clear active state on disappearing pointer) Martin Stransky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox