]> Pileus Git - ~andy/gtk/blob - gdk/gdkselection.c
Revert name change
[~andy/gtk] / gdk / gdkselection.c
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
25  */
26
27 #include "config.h"
28 #include "gdkproperty.h"
29 #include "gdkdisplay.h"
30 #include "gdkselection.h"
31 #include "gdkalias.h"
32
33 gboolean
34 gdk_selection_owner_set (GdkWindow *owner,
35                          GdkAtom    selection,
36                          guint32    time,
37                          gboolean   send_event)
38 {
39   return gdk_selection_owner_set_for_display (gdk_display_get_default (),
40                                               owner, selection, 
41                                               time, send_event);
42 }
43
44 GdkWindow*
45 gdk_selection_owner_get (GdkAtom selection)
46 {
47   return gdk_selection_owner_get_for_display (gdk_display_get_default (), 
48                                               selection);
49 }
50
51 void
52 gdk_selection_send_notify (guint32  requestor,
53                            GdkAtom  selection,
54                            GdkAtom  target,
55                            GdkAtom  property,
56                            guint32  time)
57 {
58   gdk_selection_send_notify_for_display (gdk_display_get_default (), 
59                                          requestor, selection, 
60                                          target, property, time);
61 }
62
63 gint
64 gdk_text_property_to_text_list (GdkAtom       encoding,
65                                 gint          format, 
66                                 const guchar *text,
67                                 gint          length,
68                                 gchar      ***list)
69 {
70   return gdk_text_property_to_text_list_for_display (gdk_display_get_default (),
71                                                      encoding, format, text, length, list);
72 }
73
74 /**
75  * gdk_text_property_to_utf8_list:
76  * @encoding: an atom representing the encoding of the text
77  * @format:   the format of the property
78  * @text:     the text to convert
79  * @length:   the length of @text, in bytes
80  * @list:     location to store the list of strings or %NULL. The
81  *            list should be freed with g_strfreev().
82  * 
83  * Convert a text property in the giving encoding to
84  * a list of UTF-8 strings. 
85  * 
86  * Return value: the number of strings in the resulting
87  *               list.
88  **/
89 gint 
90 gdk_text_property_to_utf8_list (GdkAtom        encoding,
91                                 gint           format,
92                                 const guchar  *text,
93                                 gint           length,
94                                 gchar       ***list)
95 {
96   return gdk_text_property_to_utf8_list_for_display (gdk_display_get_default (),
97                                                      encoding, format, text, length, list);
98 }
99
100 gint
101 gdk_string_to_compound_text (const gchar *str,
102                              GdkAtom     *encoding,
103                              gint        *format,
104                              guchar     **ctext,
105                              gint        *length)
106 {
107   return gdk_string_to_compound_text_for_display (gdk_display_get_default (),
108                                                   str, encoding, format, 
109                                                   ctext, length);
110 }
111
112 /**
113  * gdk_utf8_to_compound_text:
114  * @str:      a UTF-8 string
115  * @encoding: location to store resulting encoding
116  * @format:   location to store format of the result
117  * @ctext:    location to store the data of the result
118  * @length:   location to store the length of the data
119  *            stored in @ctext
120  * 
121  * Convert from UTF-8 to compound text. 
122  * 
123  * Return value: %TRUE if the conversion succeeded, otherwise
124  *               false.
125  **/
126 gboolean
127 gdk_utf8_to_compound_text (const gchar *str,
128                            GdkAtom     *encoding,
129                            gint        *format,
130                            guchar     **ctext,
131                            gint        *length)
132 {
133   return gdk_utf8_to_compound_text_for_display (gdk_display_get_default (),
134                                                 str, encoding, format, 
135                                                 ctext, length);
136 }
137
138 #define __GDK_SELECTION_C__
139 #include "gdkaliasdef.c"