diff options
Diffstat (limited to 'gtk/gtkoldeditable.c')
-rw-r--r-- | gtk/gtkoldeditable.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/gtk/gtkoldeditable.c b/gtk/gtkoldeditable.c index ee65d32010..3016fd9c55 100644 --- a/gtk/gtkoldeditable.c +++ b/gtk/gtkoldeditable.c @@ -721,6 +721,9 @@ gtk_old_editable_claim_selection (GtkOldEditable *old_editable, gboolean claim, guint32 time) { + GtkWidget *widget = GTK_WIDGET (old_editable); + GdkDisplay *display = gtk_widget_get_display (widget); + g_return_if_fail (GTK_IS_OLD_EDITABLE (old_editable)); g_return_if_fail (GTK_WIDGET_REALIZED (old_editable)); @@ -728,13 +731,16 @@ gtk_old_editable_claim_selection (GtkOldEditable *old_editable, if (claim) { - if (gtk_selection_owner_set (GTK_WIDGET (old_editable), GDK_SELECTION_PRIMARY, time)) + if (gtk_selection_owner_set_for_display (display, widget, + GDK_SELECTION_PRIMARY, time)) old_editable->has_selection = TRUE; } else { - if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == GTK_WIDGET (old_editable)->window) - gtk_selection_owner_set (NULL, GDK_SELECTION_PRIMARY, time); + if (gdk_selection_owner_get_for_display (display, GDK_SELECTION_PRIMARY) == widget->window) + gtk_selection_owner_set_for_display (display, + NULL, + GDK_SELECTION_PRIMARY, time); } } @@ -801,7 +807,10 @@ gtk_old_editable_real_copy_clipboard (GtkOldEditable *old_editable) if (text) { - gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), text, -1); + GtkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (old_editable), + GDK_SELECTION_CLIPBOARD); + + gtk_clipboard_set_text (clipboard, text, -1); g_free (text); } } @@ -810,9 +819,11 @@ gtk_old_editable_real_copy_clipboard (GtkOldEditable *old_editable) static void gtk_old_editable_real_paste_clipboard (GtkOldEditable *old_editable) { + GtkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (old_editable), + GDK_SELECTION_CLIPBOARD); + g_object_ref (G_OBJECT (old_editable)); - gtk_clipboard_request_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), - old_editable_text_received_cb, old_editable); + gtk_clipboard_request_text (clipboard, old_editable_text_received_cb, old_editable); } /** |