1 /* gdkselection-quartz.c
3 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * Copyright (C) 1998-2002 Tor Lillqvist
5 * Copyright (C) 2005 Imendio AB
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
25 #include "gdkselection.h"
26 #include "gdkproperty.h"
29 gdk_selection_owner_set_for_display (GdkDisplay *display,
35 /* FIXME: Implement */
40 gdk_selection_owner_get_for_display (GdkDisplay *display,
43 /* FIXME: Implement */
48 gdk_selection_convert (GdkWindow *requestor,
53 /* FIXME: Implement */
57 gdk_selection_property_get (GdkWindow *requestor,
62 /* FIXME: Implement */
67 gdk_selection_send_notify_for_display (GdkDisplay *display,
74 /* FIXME: Implement */
78 gdk_text_property_to_text_list_for_display (GdkDisplay *display,
85 /* FIXME: Implement */
90 gdk_string_to_compound_text_for_display (GdkDisplay *display,
97 /* FIXME: Implement */
101 void gdk_free_compound_text (guchar *ctext)
103 /* FIXME: Implement */
107 gdk_utf8_to_string_target (const gchar *str)
109 /* FIXME: Implement */
114 gdk_utf8_to_compound_text_for_display (GdkDisplay *display,
121 /* FIXME: Implement */
126 gdk_free_text_list (gchar **list)
128 g_return_if_fail (list != NULL);
135 make_list (const gchar *text,
140 GSList *strings = NULL;
143 const gchar *p = text;
146 GError *error = NULL;
148 while (p < text + length)
153 while (*q && q < text + length)
158 str = g_convert (p, q - p,
159 "UTF-8", "ISO-8859-1",
164 g_warning ("Error converting selection from STRING: %s",
166 g_error_free (error);
170 str = g_strndup (p, q - p);
174 strings = g_slist_prepend (strings, str);
182 *list = g_new (gchar *, n_strings + 1);
184 (*list)[n_strings] = NULL;
191 (*list)[--i] = tmp_list->data;
193 g_free (tmp_list->data);
195 tmp_list = tmp_list->next;
198 g_slist_free (strings);
204 gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
211 g_return_val_if_fail (text != NULL, 0);
212 g_return_val_if_fail (length >= 0, 0);
214 if (encoding == GDK_TARGET_STRING)
216 return make_list ((gchar *)text, length, TRUE, list);
218 else if (encoding == gdk_atom_intern_static_string ("UTF8_STRING"))
220 return make_list ((gchar *)text, length, FALSE, list);
224 gchar *enc_name = gdk_atom_name (encoding);
226 g_warning ("gdk_text_property_to_utf8_list_for_display: encoding %s not handled\n", enc_name);