[gtk+] Avoid a warning when persisting clipboards
- From: Matthias Clasen <matthiasc src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+] Avoid a warning when persisting clipboards
- Date: Sun, 17 May 2009 20:42:02 -0400 (EDT)
commit 94b63ec9b7791036b0b09d4c2059059a1d7e9695
Author: Matthias Clasen <mclasen redhat com>
Date: Sun May 17 18:35:51 2009 -0400
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.
---
gtk/gtkselection.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index 6b22c32..4c4ab73 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]