Merge branch 'wip/carlosg/for-main' into 'main'

Some fixes

Closes #5820, #6098, and #5529

See merge request GNOME/gtk!6407
This commit is contained in:
Matthias Clasen
2023-09-18 22:28:10 +00:00
4 changed files with 38 additions and 10 deletions

View File

@@ -11,6 +11,8 @@
<property name="lower">0</property>
<property name="upper">5000</property>
<property name="value">500</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
</property>
</object>

View File

@@ -46,6 +46,21 @@ static const struct xdg_activation_token_v1_listener token_listener = {
token_done,
};
static struct wl_surface *
peek_launcher_toplevel (GdkSeat *seat)
{
struct wl_surface *wl_surface = NULL;
GdkSurface *focus_surface;
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (seat));
while (focus_surface && focus_surface->parent)
focus_surface = focus_surface->parent;
if (focus_surface)
wl_surface = gdk_wayland_surface_get_wl_surface (focus_surface);
return wl_surface;
}
static char *
gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
GAppInfo *info,
@@ -62,7 +77,6 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
struct wl_event_queue *event_queue;
struct wl_surface *wl_surface = NULL;
GdkWaylandSeat *seat;
GdkSurface *focus_surface;
AppLaunchData app_launch_data = { 0 };
event_queue = wl_display_create_queue (display->wl_display);
@@ -78,9 +92,7 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
_gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL),
gdk_wayland_seat_get_wl_seat (GDK_SEAT (seat)));
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat)));
if (focus_surface)
wl_surface = gdk_wayland_surface_get_wl_surface (focus_surface);
wl_surface = peek_launcher_toplevel (GDK_SEAT (seat));
if (wl_surface)
xdg_activation_token_v1_set_surface (token, wl_surface);

View File

@@ -1191,11 +1191,6 @@ gtk_synthesize_crossing_events (GtkRoot *toplevel,
for (widget = new_target; widget; widget = _gtk_widget_get_parent (widget))
gtk_widget_stack_append (&target_array, g_object_ref (widget));
if (old_target && new_target)
ancestor = gtk_widget_common_ancestor (old_target, new_target);
else
ancestor = NULL;
crossing.direction = GTK_CROSSING_IN;
seen_ancestor = FALSE;

View File

@@ -6517,6 +6517,21 @@ gtk_window_update_pointer_focus (GtkWindow *window,
}
}
static void
clear_widget_active_state (GtkWidget *widget,
GtkWidget *topmost)
{
GtkWidget *w = widget;
while (w)
{
gtk_widget_set_active_state (w, FALSE);
if (w == topmost)
break;
w = _gtk_widget_get_parent (w);
}
}
void
gtk_window_update_pointer_focus_on_state_change (GtkWindow *window,
GtkWidget *widget)
@@ -6537,7 +6552,11 @@ gtk_window_update_pointer_focus_on_state_change (GtkWindow *window,
if (focus->grab_widget &&
(focus->grab_widget == widget ||
gtk_widget_is_ancestor (focus->grab_widget, widget)))
gtk_pointer_focus_set_implicit_grab (focus, NULL);
{
clear_widget_active_state (focus->grab_widget, widget);
gtk_pointer_focus_set_implicit_grab (focus,
gtk_widget_get_parent (widget));
}
if (GTK_WIDGET (focus->toplevel) == widget)
{