Merge branch 'matthiasc/for-main' into 'main'

window: Don't mark widget prematurely as has-focus

See merge request GNOME/gtk!5836
This commit is contained in:
Matthias Clasen
2023-04-15 16:09:32 +00:00
3 changed files with 16 additions and 5 deletions

View File

@@ -99,7 +99,7 @@ gdk_wayland_primary_claim_remote (GdkWaylandPrimary *cb,
if (cb->source)
{
GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, "%p: Ignoring clipboard offer for self", cb);
GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, "%p: Ignoring primary offer for self", cb);
gdk_content_formats_unref (formats);
g_clear_pointer (&offer, zwp_primary_selection_offer_v1_destroy);
return;
@@ -111,7 +111,7 @@ gdk_wayland_primary_claim_remote (GdkWaylandPrimary *cb,
if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD))
{
char *s = gdk_content_formats_to_string (formats);
gdk_debug_message ("%p: remote clipboard claim for %s", cb, s);
gdk_debug_message ("%p: remote primary claim for %s", cb, s);
g_free (s);
}
#endif
@@ -119,8 +119,7 @@ gdk_wayland_primary_claim_remote (GdkWaylandPrimary *cb,
cb->offer_formats = formats;
cb->offer = offer;
gdk_clipboard_claim_remote (GDK_CLIPBOARD (cb),
cb->offer_formats);
gdk_clipboard_claim_remote (GDK_CLIPBOARD (cb), cb->offer_formats);
}
static void
@@ -271,6 +270,14 @@ gdk_wayland_primary_claim (GdkClipboard *clipboard,
{
GdkWaylandPrimary *cb = GDK_WAYLAND_PRIMARY (clipboard);
#ifdef G_ENABLE_DEBUG
if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (clipboard), CLIPBOARD))
{
char *s = gdk_content_formats_to_string (formats);
gdk_debug_message ("%p: claim primary (%s) for %s", cb, local ? "local" : "remote", s);
g_free (s);
}
#endif
if (local)
{
GdkWaylandDisplay *wdisplay = GDK_WAYLAND_DISPLAY (gdk_clipboard_get_display (clipboard));

View File

@@ -3260,6 +3260,7 @@ gtk_text_focus_changed (GtkEventControllerFocus *controller,
gtk_text_im_set_focus_in (self);
gtk_text_reset_blink_time (self);
gtk_text_check_cursor_blink (self);
gtk_text_update_primary_selection (self);
}
else /* Focus out */
{
@@ -5364,6 +5365,9 @@ gtk_text_update_primary_selection (GtkText *self)
if (!gtk_widget_get_realized (GTK_WIDGET (self)))
return;
if (!gtk_widget_has_focus (GTK_WIDGET (self)))
return;
clipboard = gtk_widget_get_primary_clipboard (GTK_WIDGET (self));
if (priv->selection_bound != priv->current_pos)

View File

@@ -2023,7 +2023,7 @@ gtk_window_root_set_focus (GtkRoot *root,
synthesize_focus_change_events (self, old_focus, focus, GTK_CROSSING_FOCUS);
if (focus)
gtk_widget_set_has_focus (focus, TRUE);
gtk_widget_set_has_focus (focus, priv->is_active);
g_set_object (&priv->focus_widget, focus);