summaryrefslogtreecommitdiff
path: root/gtk/gtkclipboard-quartz.c
diff options
context:
space:
mode:
authorRichard Hult <richard@imendio.com>2008-06-26 13:01:40 +0000
committerRichard Hult <rhult@src.gnome.org>2008-06-26 13:01:40 +0000
commit2f29e8d9f5c00ec14aa27f4f81b1bf092bcf6b45 (patch)
treea76cee2580de4536249d9d46e9f77d40c06197b4 /gtk/gtkclipboard-quartz.c
parent2e6f82b987aad795e376c635618e67eb3b49f345 (diff)
downloadgtk+-2f29e8d9f5c00ec14aa27f4f81b1bf092bcf6b45.tar.gz
Patch from Christian Dywan to clean up selection data setting.
2008-06-26 Richard Hult <richard@imendio.com> * gtk/gtkclipboard-quartz.c: (gtk_clipboard_wait_for_contents): * gtk/gtkquartz.c: (_gtk_quartz_get_selection_data_from_pasteboard), (_gtk_quartz_set_selection_data_for_pasteboard): Patch from Christian Dywan to clean up selection data setting. svn path=/trunk/; revision=20690
Diffstat (limited to 'gtk/gtkclipboard-quartz.c')
-rw-r--r--gtk/gtkclipboard-quartz.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/gtk/gtkclipboard-quartz.c b/gtk/gtkclipboard-quartz.c
index 45bd2f6f3a..6c209ee728 100644
--- a/gtk/gtkclipboard-quartz.c
+++ b/gtk/gtkclipboard-quartz.c
@@ -872,31 +872,29 @@ gtk_clipboard_wait_for_contents (GtkClipboard *clipboard,
if (target == gdk_atom_intern_static_string ("TARGETS"))
{
NSArray *types = [clipboard->pasteboard types];
- int i, count;
+ int i, length;
GList *atom_list, *l;
GdkAtom *atoms;
- count = [types count];
- atom_list = _gtk_quartz_pasteboard_types_to_atom_list (types);
+ length = [types count] * sizeof (GdkAtom);
selection_data = g_slice_new (GtkSelectionData);
selection_data->selection = clipboard->selection;
selection_data->target = target;
- selection_data->type = GDK_SELECTION_TYPE_ATOM;
- selection_data->format = 32;
- selection_data->length = count * sizeof (GdkAtom);
- atoms = g_malloc (selection_data->length + 1);
-
+ atoms = g_malloc (length);
+
+ atom_list = _gtk_quartz_pasteboard_types_to_atom_list (types);
for (l = atom_list, i = 0; l ; l = l->next, i++)
atoms[i] = GDK_POINTER_TO_ATOM (l->data);
+ g_list_free (atom_list);
- selection_data->data = (guchar *)atoms;
- selection_data->data[selection_data->length] = '\0';
+ gtk_selection_data_set (selection_data,
+ GDK_SELECTION_TYPE_ATOM, 32,
+ (guchar *)atoms, length);
[pool release];
- g_list_free (atom_list);
return selection_data;
}
@@ -905,6 +903,7 @@ gtk_clipboard_wait_for_contents (GtkClipboard *clipboard,
clipboard->selection);
[pool release];
+
return selection_data;
}