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, see <http://www.gnu.org/licenses/>.
23 #include "gdkselection.h"
24 #include "gdkproperty.h"
27 _gdk_quartz_display_set_selection_owner (GdkDisplay *display,
33 /* FIXME: Implement */
38 _gdk_quartz_display_get_selection_owner (GdkDisplay *display,
41 /* FIXME: Implement */
46 _gdk_quartz_display_convert_selection (GdkDisplay *display,
52 /* FIXME: Implement */
56 _gdk_quartz_display_get_selection_property (GdkDisplay *display,
62 /* FIXME: Implement */
67 _gdk_quartz_display_utf8_to_string_target (GdkDisplay *display,
70 /* FIXME: Implement */
75 make_list (const gchar *text,
80 GSList *strings = NULL;
83 const gchar *p = text;
88 while (p < text + length)
93 while (*q && q < text + length)
98 str = g_convert (p, q - p,
99 "UTF-8", "ISO-8859-1",
104 g_warning ("Error converting selection from STRING: %s",
106 g_error_free (error);
110 str = g_strndup (p, q - p);
114 strings = g_slist_prepend (strings, str);
122 *list = g_new0 (gchar *, n_strings + 1);
129 (*list)[--i] = tmp_list->data;
131 g_free (tmp_list->data);
133 tmp_list = tmp_list->next;
136 g_slist_free (strings);
142 _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *display,
149 g_return_val_if_fail (text != NULL, 0);
150 g_return_val_if_fail (length >= 0, 0);
152 if (encoding == GDK_TARGET_STRING)
154 return make_list ((gchar *)text, length, TRUE, list);
156 else if (encoding == gdk_atom_intern_static_string ("UTF8_STRING"))
158 return make_list ((gchar *)text, length, FALSE, list);
162 gchar *enc_name = gdk_atom_name (encoding);
164 g_warning ("gdk_text_property_to_utf8_list_for_display: encoding %s not handled\n", enc_name);