From: Matthias Clasen Date: Sat, 15 Apr 2023 13:02:09 +0000 (+0200) Subject: text: Only claim primary when focused X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~4^2~10^2~16 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2634e2b74bd0465d6649b5a8c29cb6ba65c1b347;p=gtk4.git text: Only claim primary when focused It does not make sense otherwise, and has unfortunate side-effects on Wayland. --- diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 98733b0f36..7b7d2eb4a5 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -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)