summaryrefslogtreecommitdiff
path: root/gtk/gtkselection.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2009-05-17 18:35:51 -0400
committerMatthias Clasen <mclasen@redhat.com>2009-05-17 20:41:50 -0400
commit94b63ec9b7791036b0b09d4c2059059a1d7e9695 (patch)
treef6236abd1abb68a4f8645e7731fe75874683552a /gtk/gtkselection.c
parent375d19aa9258662a9406c00cfb2e7cc418214dbe (diff)
downloadgtk+-94b63ec9b7791036b0b09d4c2059059a1d7e9695.tar.gz
Avoid a warning when persisting clipboards
Correctly handle conversion to SAVE_TARGETS as a side-effect target with no side-effect, by returning a zero-sized property of type NULL. See section 2.6.3 of the ICCCM.
Diffstat (limited to 'gtk/gtkselection.c')
-rw-r--r--gtk/gtkselection.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index 6b22c32cc7..4c4ab7301c 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -94,6 +94,7 @@ enum {
MULTIPLE,
TARGETS,
TIMESTAMP,
+ SAVE_TARGETS,
LAST_ATOM
};
@@ -2172,6 +2173,7 @@ gtk_selection_init (void)
gtk_selection_atoms[MULTIPLE] = gdk_atom_intern_static_string ("MULTIPLE");
gtk_selection_atoms[TIMESTAMP] = gdk_atom_intern_static_string ("TIMESTAMP");
gtk_selection_atoms[TARGETS] = gdk_atom_intern_static_string ("TARGETS");
+ gtk_selection_atoms[SAVE_TARGETS] = gdk_atom_intern_static_string ("SAVE_TARGETS");
initialize = FALSE;
}
@@ -2377,7 +2379,6 @@ _gtk_selection_request (GtkWidget *widget,
#endif
gtk_selection_invoke_handler (widget, &data, event->time);
-
if (data.length < 0)
{
info->conversions[i].property = GDK_NONE;
@@ -2968,7 +2969,8 @@ gtk_selection_invoke_handler (GtkWidget *widget,
g_return_if_fail (widget != NULL);
target_list = gtk_selection_target_list_get (widget, data->selection);
- if (target_list &&
+ if (data->target != gtk_selection_atoms[SAVE_TARGETS] &&
+ target_list &&
gtk_target_list_find (target_list, data->target, &info))
{
g_signal_emit_by_name (widget,
@@ -3061,6 +3063,12 @@ gtk_selection_default_handler (GtkWidget *widget,
tmp_list = tmp_list->next;
}
}
+ else if (data->target == gtk_selection_atom[SAVE_TARGETS])
+ {
+ gtk_selection_data_set (data,
+ gdk_atom_intern_static_string ("NULL"),
+ 32, "", 0);
+ }
else
{
data->length = -1;