]> Pileus Git - ~andy/gtk/blob - gdk/gdkselection.c
Inclusion cleanups in sources
[~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
29 #include "gdkselection.h"
30
31 #include "gdkproperty.h"
32 #include "gdkdisplay.h"
33
34
35 gboolean
36 gdk_selection_owner_set (GdkWindow *owner,
37                          GdkAtom    selection,
38                          guint32    time,
39                          gboolean   send_event)
40 {
41   return gdk_selection_owner_set_for_display (gdk_display_get_default (),
42                                               owner, selection, 
43                                               time, send_event);
44 }
45
46 GdkWindow*
47 gdk_selection_owner_get (GdkAtom selection)
48 {
49   return gdk_selection_owner_get_for_display (gdk_display_get_default (), 
50                                               selection);
51 }
52
53 void
54 gdk_selection_send_notify (GdkNativeWindow requestor,
55                            GdkAtom         selection,
56                            GdkAtom         target,
57                            GdkAtom         property,
58                            guint32         time)
59 {
60   gdk_selection_send_notify_for_display (gdk_display_get_default (), 
61                                          requestor, selection, 
62                                          target, property, time);
63 }
64
65 gint
66 gdk_text_property_to_text_list (GdkAtom       encoding,
67                                 gint          format, 
68                                 const guchar *text,
69                                 gint          length,
70                                 gchar      ***list)
71 {
72   return gdk_text_property_to_text_list_for_display (gdk_display_get_default (),
73                                                      encoding, format, text, length, list);
74 }
75
76 /**
77  * gdk_text_property_to_utf8_list:
78  * @encoding: an atom representing the encoding of the text
79  * @format:   the format of the property
80  * @text:     the text to convert
81  * @length:   the length of @text, in bytes
82  * @list: (allow-none):     location to store the list of strings or %NULL. The
83  *            list should be freed with g_strfreev().
84  * 
85  * Convert a text property in the giving encoding to
86  * a list of UTF-8 strings. 
87  * 
88  * Return value: the number of strings in the resulting
89  *               list.
90  **/
91 gint 
92 gdk_text_property_to_utf8_list (GdkAtom        encoding,
93                                 gint           format,
94                                 const guchar  *text,
95                                 gint           length,
96                                 gchar       ***list)
97 {
98   return gdk_text_property_to_utf8_list_for_display (gdk_display_get_default (),
99                                                      encoding, format, text, length, list);
100 }
101
102 gint
103 gdk_string_to_compound_text (const gchar *str,
104                              GdkAtom     *encoding,
105                              gint        *format,
106                              guchar     **ctext,
107                              gint        *length)
108 {
109   return gdk_string_to_compound_text_for_display (gdk_display_get_default (),
110                                                   str, encoding, format, 
111                                                   ctext, length);
112 }
113
114 /**
115  * gdk_utf8_to_compound_text:
116  * @str:      a UTF-8 string
117  * @encoding: location to store resulting encoding
118  * @format:   location to store format of the result
119  * @ctext:    location to store the data of the result
120  * @length:   location to store the length of the data
121  *            stored in @ctext
122  * 
123  * Convert from UTF-8 to compound text. 
124  * 
125  * Return value: %TRUE if the conversion succeeded, otherwise
126  *               false.
127  **/
128 gboolean
129 gdk_utf8_to_compound_text (const gchar *str,
130                            GdkAtom     *encoding,
131                            gint        *format,
132                            guchar     **ctext,
133                            gint        *length)
134 {
135   return gdk_utf8_to_compound_text_for_display (gdk_display_get_default (),
136                                                 str, encoding, format, 
137                                                 ctext, length);
138 }