diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 609f3de7e9..b72ddaa2ed 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -5187,9 +5187,6 @@ gtk_css_section_get_type GtkSelectionData gtk_selection_owner_set gtk_selection_owner_set_for_display -gtk_selection_add_target -gtk_selection_add_targets -gtk_selection_clear_targets gtk_selection_convert gtk_selection_data_set gtk_selection_data_set_text diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c index 528d33c6aa..321571fdb2 100644 --- a/gdk/broadway/gdkdisplay-broadway.c +++ b/gdk/broadway/gdkdisplay-broadway.c @@ -577,8 +577,6 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class) display_class->set_selection_owner = _gdk_broadway_display_set_selection_owner; display_class->send_selection_notify = _gdk_broadway_display_send_selection_notify; display_class->get_selection_property = _gdk_broadway_display_get_selection_property; - display_class->clear_selection_targets = gdk_broadway_display_clear_selection_targets; - display_class->add_selection_targets = gdk_broadway_display_add_selection_targets; display_class->convert_selection = _gdk_broadway_display_convert_selection; display_class->text_property_to_utf8_list = _gdk_broadway_display_text_property_to_utf8_list; display_class->utf8_to_string_target = _gdk_broadway_display_utf8_to_string_target; diff --git a/gdk/broadway/gdkprivate-broadway.h b/gdk/broadway/gdkprivate-broadway.h index 39523a9079..34221a4dba 100644 --- a/gdk/broadway/gdkprivate-broadway.h +++ b/gdk/broadway/gdkprivate-broadway.h @@ -136,13 +136,6 @@ gint _gdk_broadway_display_get_selection_property (GdkDisplay *display, guchar **data, GdkAtom *ret_type, gint *ret_format); -void gdk_broadway_display_clear_selection_targets (GdkDisplay *display, - GdkAtom selection); -void gdk_broadway_display_add_selection_targets (GdkDisplay *display, - GdkWindow *window, - GdkAtom selection, - GdkAtom *targets, - guint ntargets); void _gdk_broadway_display_send_selection_notify (GdkDisplay *display, GdkWindow *requestor, GdkAtom selection, diff --git a/gdk/broadway/gdkselection-broadway.c b/gdk/broadway/gdkselection-broadway.c index 49548c8e70..2f30842b34 100644 --- a/gdk/broadway/gdkselection-broadway.c +++ b/gdk/broadway/gdkselection-broadway.c @@ -157,21 +157,6 @@ _gdk_broadway_display_get_selection_property (GdkDisplay *display, return 0; } -void -gdk_broadway_display_clear_selection_targets (GdkDisplay *display, - GdkAtom selection) -{ -} - -void -gdk_broadway_display_add_selection_targets (GdkDisplay *display, - GdkWindow *window, - GdkAtom selection, - GdkAtom *targets, - guint ntargets) -{ -} - void _gdk_broadway_display_send_selection_notify (GdkDisplay *display, GdkWindow *requestor, diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h index a05a721721..b46bf4704b 100644 --- a/gdk/gdkdisplayprivate.h +++ b/gdk/gdkdisplayprivate.h @@ -185,13 +185,6 @@ struct _GdkDisplayClass guchar **data, GdkAtom *type, gint *format); - void (*clear_selection_targets)(GdkDisplay *display, - GdkAtom selection); - void (*add_selection_targets) (GdkDisplay *display, - GdkWindow *window, - GdkAtom selection, - GdkAtom *targets, - guint ntargets); void (*convert_selection) (GdkDisplay *display, GdkWindow *requestor, GdkAtom selection, diff --git a/gdk/gdkselection.c b/gdk/gdkselection.c index 91bb4aed5b..38dc054197 100644 --- a/gdk/gdkselection.c +++ b/gdk/gdkselection.c @@ -330,23 +330,3 @@ gdk_utf8_to_string_target (const gchar *str) return GDK_DISPLAY_GET_CLASS (display)->utf8_to_string_target (display, str); } -void -gdk_selection_clear_targets (GdkDisplay *display, - GdkAtom selection) -{ -} - -void -gdk_selection_add_targets (GdkWindow *window, - GdkAtom selection, - GdkAtom *targets, - guint n_targets) -{ - GdkDisplay *display; - - g_return_if_fail (GDK_IS_WINDOW (window)); - - display = gdk_window_get_display (window); - - GDK_DISPLAY_GET_CLASS (display)->add_selection_targets (display, window, selection, targets, n_targets); -} diff --git a/gdk/gdkselection.h b/gdk/gdkselection.h index a97c745d04..8146a5158c 100644 --- a/gdk/gdkselection.h +++ b/gdk/gdkselection.h @@ -209,16 +209,6 @@ void gdk_selection_send_notify_for_display (GdkDisplay *display, GdkAtom property, guint32 time_); -GDK_AVAILABLE_IN_3_94 -void gdk_selection_clear_targets (GdkDisplay *display, - GdkAtom selection); - -GDK_AVAILABLE_IN_3_94 -void gdk_selection_add_targets (GdkWindow *window, - GdkAtom selection, - GdkAtom *targets, - guint n_targets); - G_END_DECLS #endif /* __GDK_SELECTION_H__ */ diff --git a/gdk/quartz/gdkdisplay-quartz.c b/gdk/quartz/gdkdisplay-quartz.c index 9aaab92538..fcef6702ab 100644 --- a/gdk/quartz/gdkdisplay-quartz.c +++ b/gdk/quartz/gdkdisplay-quartz.c @@ -279,8 +279,6 @@ gdk_quartz_display_class_init (GdkQuartzDisplayClass *class) display_class->get_selection_owner = _gdk_quartz_display_get_selection_owner; display_class->set_selection_owner = _gdk_quartz_display_set_selection_owner; display_class->get_selection_property = _gdk_quartz_display_get_selection_property; - display_class->clear_selection_targets = gdk_quartz_display_clear_selection_targets; - display_class->add_selection_targets = gdk_quartz_display_add_selection_targets; display_class->convert_selection = _gdk_quartz_display_convert_selection; display_class->text_property_to_utf8_list = _gdk_quartz_display_text_property_to_utf8_list; display_class->utf8_to_string_target = _gdk_quartz_display_utf8_to_string_target; diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 790974b209..8403938f3b 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -1023,8 +1023,6 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class) display_class->set_selection_owner = _gdk_wayland_display_set_selection_owner; display_class->send_selection_notify = _gdk_wayland_display_send_selection_notify; display_class->get_selection_property = _gdk_wayland_display_get_selection_property; - display_class->clear_selection_targets = gdk_wayland_display_clear_selection_targets; - display_class->add_selection_targets = gdk_wayland_display_add_selection_targets; display_class->convert_selection = _gdk_wayland_display_convert_selection; display_class->text_property_to_utf8_list = _gdk_wayland_display_text_property_to_utf8_list; display_class->utf8_to_string_target = _gdk_wayland_display_utf8_to_string_target; diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h index a6ee0c0cdb..f1ec0c79c2 100644 --- a/gdk/wayland/gdkprivate-wayland.h +++ b/gdk/wayland/gdkprivate-wayland.h @@ -147,13 +147,6 @@ gint _gdk_wayland_display_get_selection_property (GdkDisplay *display, guchar **data, GdkAtom *ret_type, gint *ret_format); -void gdk_wayland_display_clear_selection_targets (GdkDisplay *display, - GdkAtom selection); -void gdk_wayland_display_add_selection_targets (GdkDisplay *display, - GdkWindow *window, - GdkAtom selection, - GdkAtom *targets, - guint ntargets); void _gdk_wayland_display_convert_selection (GdkDisplay *display, GdkWindow *requestor, GdkAtom selection, diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c index 6d1904822a..b456318918 100644 --- a/gdk/wayland/gdkselection-wayland.c +++ b/gdk/wayland/gdkselection-wayland.c @@ -96,8 +96,6 @@ struct _GdkWaylandSelection /* Source-side data */ StoredSelection stored_selection; - GArray *source_targets; - GdkAtom requested_target; struct wl_data_source *dnd_source; /* Owned by the GdkDragContext */ GdkWindow *dnd_owner; @@ -325,7 +323,6 @@ gdk_wayland_selection_new (void) g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) data_offer_data_free); selection->stored_selection.fd = -1; - selection->source_targets = g_array_new (FALSE, FALSE, sizeof (GdkAtom)); return selection; } @@ -337,8 +334,6 @@ gdk_wayland_selection_free (GdkWaylandSelection *selection) for (i = 0; i < G_N_ELEMENTS (selection->selections); i++) g_hash_table_destroy (selection->selections[i].buffers); - g_array_unref (selection->source_targets); - g_hash_table_destroy (selection->offers); g_free (selection->stored_selection.data); @@ -854,7 +849,6 @@ static void data_source_dnd_finished (void *data, struct wl_data_source *source) { - GdkDisplay *display = gdk_display_get_default (); GdkDragContext *context; context = gdk_wayland_drag_context_lookup_by_data_source (source); @@ -871,7 +865,6 @@ data_source_dnd_finished (void *data, g_signal_emit_by_name (context, "dnd-finished"); gdk_selection_owner_set (NULL, atoms[ATOM_DND], GDK_CURRENT_TIME, TRUE); - gdk_wayland_display_clear_selection_targets (display, atoms[ATOM_DND]); } static void @@ -1272,46 +1265,6 @@ _gdk_wayland_display_utf8_to_string_target (GdkDisplay *display, return sanitize_utf8 (str, TRUE); } -void -gdk_wayland_display_add_selection_targets (GdkDisplay *display, - GdkWindow *window, - GdkAtom selection, - GdkAtom *targets, - guint ntargets) -{ - GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display); - gpointer data_source; - guint i; - - g_return_if_fail (GDK_IS_WINDOW (window)); - - data_source = gdk_wayland_selection_get_data_source (window, selection); - - if (!data_source) - return; - - g_array_append_vals (wayland_selection->source_targets, targets, ntargets); - - for (i = 0; i < ntargets; i++) - { - gchar *mimetype = gdk_atom_name (targets[i]); - - wl_data_source_offer (data_source, mimetype); - g_free (mimetype); - } -} - -void -gdk_wayland_display_clear_selection_targets (GdkDisplay *display, - GdkAtom selection) -{ - GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display); - - wayland_selection->requested_target = NULL; - g_array_set_size (wayland_selection->source_targets, 0); - gdk_wayland_selection_unset_data_source (display, selection); -} - gboolean gdk_wayland_selection_set_current_offer_actions (GdkDisplay *display, uint32_t action) diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c index fa32842672..71a14abd99 100644 --- a/gdk/win32/gdkdisplay-win32.c +++ b/gdk/win32/gdkdisplay-win32.c @@ -1248,8 +1248,6 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass) display_class->set_selection_owner = _gdk_win32_display_set_selection_owner; display_class->send_selection_notify = _gdk_win32_display_send_selection_notify; display_class->get_selection_property = _gdk_win32_display_get_selection_property; - display_class->clear_selection_targets = gdk_win32_display_clear_selection_targets; - display_class->add_selection_targets = gdk_win32_display_add_selection_targets; display_class->convert_selection = _gdk_win32_display_convert_selection; display_class->text_property_to_utf8_list = _gdk_win32_display_text_property_to_utf8_list; display_class->utf8_to_string_target = _gdk_win32_display_utf8_to_string_target; diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h index ae2be8cdc7..515a0971cf 100644 --- a/gdk/win32/gdkprivate-win32.h +++ b/gdk/win32/gdkprivate-win32.h @@ -397,13 +397,6 @@ gint _gdk_win32_display_get_selection_property (GdkDisplay *display, guchar **data, GdkAtom *ret_type, gint *ret_format); -void gdk_win32_display_clear_selection_targets (GdkDisplay *display, - GdkAtom selection); -void gdk_win32_display_add_selection_targets (GdkDisplay *display, - GdkWindow *window, - GdkAtom selection, - GdkAtom *targets, - guint ntargets); void _gdk_win32_display_convert_selection (GdkDisplay *display, GdkWindow *requestor, GdkAtom selection, diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c index d793f739c7..18a285908a 100644 --- a/gdk/win32/gdkselection-win32.c +++ b/gdk/win32/gdkselection-win32.c @@ -2805,12 +2805,6 @@ _gdk_win32_add_target_to_selformats (GdkAtom target, return added_count; } -void -gdk_win32_display_clear_selection_targets (GdkDisplay *display, - GdkAtom selection) -{ -} - /* This function is called from gtk_selection_add_target() and * gtk_selection_add_targets() in gtkselection.c. It is this function * that takes care of setting those clipboard formats for which we use diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index ba8b69bc30..b138d7313d 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -3222,8 +3222,6 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class) display_class->set_selection_owner = _gdk_x11_display_set_selection_owner; display_class->send_selection_notify = _gdk_x11_display_send_selection_notify; display_class->get_selection_property = _gdk_x11_display_get_selection_property; - display_class->clear_selection_targets = gdk_x11_display_clear_selection_targets; - display_class->add_selection_targets = gdk_x11_display_add_selection_targets; display_class->convert_selection = _gdk_x11_display_convert_selection; display_class->text_property_to_utf8_list = _gdk_x11_display_text_property_to_utf8_list; display_class->utf8_to_string_target = _gdk_x11_display_utf8_to_string_target; diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index 431ca7ddc8..4930d69945 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -166,13 +166,6 @@ gint _gdk_x11_display_get_selection_property (GdkDisplay *display, guchar **data, GdkAtom *ret_type, gint *ret_format); -void gdk_x11_display_clear_selection_targets (GdkDisplay *display, - GdkAtom selection); -void gdk_x11_display_add_selection_targets (GdkDisplay *display, - GdkWindow *window, - GdkAtom selection, - GdkAtom *targets, - guint ntargets); void _gdk_x11_display_convert_selection (GdkDisplay *display, GdkWindow *requestor, GdkAtom selection, diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c index 04b60186ba..abef9b02ff 100644 --- a/gdk/x11/gdkselection-x11.c +++ b/gdk/x11/gdkselection-x11.c @@ -311,21 +311,6 @@ _gdk_x11_display_get_selection_property (GdkDisplay *display, return 0; } -void -gdk_x11_display_clear_selection_targets (GdkDisplay *display, - GdkAtom selection) -{ -} - -void -gdk_x11_display_add_selection_targets (GdkDisplay *display, - GdkWindow *window, - GdkAtom selection, - GdkAtom *targets, - guint ntargets) -{ -} - void _gdk_x11_display_send_selection_notify (GdkDisplay *display, GdkWindow *requestor, diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c index f90f5efd95..ec23053807 100644 --- a/gtk/gtkselection.c +++ b/gtk/gtkselection.c @@ -551,158 +551,6 @@ gtk_selection_target_list_get (GtkWidget *widget, return sellist->list; } -static void -gtk_selection_target_list_add (GtkWidget *widget, - GdkAtom selection, - GdkContentFormats *formats) -{ - GtkSelectionTargetList *sellist; - GList *tmp_list; - GList *lists; - - lists = g_object_get_data (G_OBJECT (widget), gtk_selection_handler_key); - - tmp_list = lists; - while (tmp_list) - { - sellist = tmp_list->data; - if (sellist->selection == selection) - { - sellist->list = gdk_content_formats_union (sellist->list, formats); - return; - } - tmp_list = tmp_list->next; - } - - if (tmp_list == NULL) - { - sellist = g_slice_new (GtkSelectionTargetList); - sellist->selection = selection; - sellist->list = gdk_content_formats_ref (formats); - } - - lists = g_list_prepend (lists, sellist); - g_object_set_data (G_OBJECT (widget), I_(gtk_selection_handler_key), lists); -} - -static void -gtk_selection_target_list_remove (GtkWidget *widget) -{ - GtkSelectionTargetList *sellist; - GList *tmp_list; - GList *lists; - - lists = g_object_get_data (G_OBJECT (widget), gtk_selection_handler_key); - - tmp_list = lists; - while (tmp_list) - { - sellist = tmp_list->data; - - gdk_content_formats_unref (sellist->list); - - g_slice_free (GtkSelectionTargetList, sellist); - tmp_list = tmp_list->next; - } - - g_list_free (lists); - g_object_set_data (G_OBJECT (widget), I_(gtk_selection_handler_key), NULL); -} - -/** - * gtk_selection_clear_targets: - * @widget: a #GtkWidget - * @selection: an atom representing a selection - * - * Remove all targets registered for the given selection for the - * widget. - **/ -void -gtk_selection_clear_targets (GtkWidget *widget, - GdkAtom selection) -{ - GtkSelectionTargetList *sellist; - GList *tmp_list; - GList *lists; - - g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (selection != NULL); - - gdk_selection_clear_targets (gtk_widget_get_display (widget), selection); - - lists = g_object_get_data (G_OBJECT (widget), gtk_selection_handler_key); - - tmp_list = lists; - while (tmp_list) - { - sellist = tmp_list->data; - if (sellist->selection == selection) - { - lists = g_list_delete_link (lists, tmp_list); - gdk_content_formats_unref (sellist->list); - g_slice_free (GtkSelectionTargetList, sellist); - - break; - } - - tmp_list = tmp_list->next; - } - - g_object_set_data (G_OBJECT (widget), I_(gtk_selection_handler_key), lists); -} - -/** - * gtk_selection_add_target: - * @widget: a #GtkWidget - * @selection: the selection - * @target: target to add. - * - * Appends a specified target to the list of supported targets for a - * given widget and selection. - **/ -void -gtk_selection_add_target (GtkWidget *widget, - GdkAtom selection, - GdkAtom target) -{ - GdkContentFormats *list; - - g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (selection != NULL); - - list = gdk_content_formats_new (&target, 1); - gtk_selection_add_targets (widget, selection, list); - gdk_content_formats_unref (list); -} - -/** - * gtk_selection_add_targets: - * @widget: a #GtkWidget - * @selection: the selection - * @targets: the targets to add - * - * Prepends a table of targets to the list of supported targets - * for a given widget and selection. - **/ -void -gtk_selection_add_targets (GtkWidget *widget, - GdkAtom selection, - GdkContentFormats *targets) -{ - const char * const *mime_types; - gsize n_mime_types; - - g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (selection != NULL); - g_return_if_fail (targets != NULL); - - gtk_selection_target_list_add (widget, selection, targets); - - mime_types = gdk_content_formats_get_mime_types (targets, &n_mime_types); - gdk_selection_add_targets (gtk_widget_get_window (widget), selection, (GdkAtom *) mime_types, n_mime_types); -} - - /** * gtk_selection_remove_all: * @widget: a #GtkWidget @@ -759,9 +607,6 @@ gtk_selection_remove_all (GtkWidget *widget) tmp_list = next; } - - /* Remove all selection lists */ - gtk_selection_target_list_remove (widget); } diff --git a/gtk/gtkselection.h b/gtk/gtkselection.h index b386b0f172..edfb676491 100644 --- a/gtk/gtkselection.h +++ b/gtk/gtkselection.h @@ -55,17 +55,6 @@ gboolean gtk_selection_owner_set_for_display (GdkDisplay *display, guint32 time_); GDK_AVAILABLE_IN_ALL -void gtk_selection_add_target (GtkWidget *widget, - GdkAtom selection, - GdkAtom target); -GDK_AVAILABLE_IN_ALL -void gtk_selection_add_targets (GtkWidget *widget, - GdkAtom selection, - GdkContentFormats *targets); -GDK_AVAILABLE_IN_ALL -void gtk_selection_clear_targets (GtkWidget *widget, - GdkAtom selection); -GDK_AVAILABLE_IN_ALL gboolean gtk_selection_convert (GtkWidget *widget, GdkAtom selection, GdkAtom target, diff --git a/tests/testselection.c b/tests/testselection.c index f77f49000f..53ec3815b1 100644 --- a/tests/testselection.c +++ b/tests/testselection.c @@ -384,14 +384,6 @@ main (int argc, char *argv[]) GtkWidget *hbox; GtkWidget *scrolled; - static const char *targetlist[] = { - "STRING", - "TEXT", - "COMPOUND_TEXT" - }; - static gint ntargets = sizeof(targetlist) / sizeof(targetlist[0]); - GdkContentFormats *list; - gtk_init (); init_atoms(); @@ -422,10 +414,6 @@ main (int argc, char *argv[]) g_signal_connect (selection_widget, "selection_received", G_CALLBACK (selection_received), NULL); - list = gdk_content_formats_new (targetlist, ntargets); - gtk_selection_add_targets (selection_widget, GDK_SELECTION_PRIMARY, list); - gdk_content_formats_unref (list); - g_signal_connect (selection_widget, "selection_get", G_CALLBACK (selection_get), NULL);