]> Pileus Git - ~andy/gtk/blob - gdk/broadway/gdkselection-broadway.c
Merge branch 'master' into broadway
[~andy/gtk] / gdk / broadway / gdkselection-broadway.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 "gdkprivate.h"
33 #include "gdkprivate-broadway.h"
34 #include "gdkdisplay-broadway.h"
35
36 #include <string.h>
37
38
39 typedef struct _OwnerInfo OwnerInfo;
40
41 struct _OwnerInfo
42 {
43   GdkAtom    selection;
44   GdkWindow *owner;
45   gulong     serial;
46 };
47
48 static GSList *owner_list;
49
50 /* When a window is destroyed we check if it is the owner
51  * of any selections. This is somewhat inefficient, but
52  * owner_list is typically short, and it is a low memory,
53  * low code solution
54  */
55 void
56 _gdk_selection_window_destroyed (GdkWindow *window)
57 {
58   GSList *tmp_list = owner_list;
59   while (tmp_list)
60     {
61       OwnerInfo *info = tmp_list->data;
62       tmp_list = tmp_list->next;
63
64       if (info->owner == window)
65         {
66           owner_list = g_slist_remove (owner_list, info);
67           g_free (info);
68         }
69     }
70 }
71
72 gboolean
73 gdk_selection_owner_set_for_display (GdkDisplay *display,
74                                      GdkWindow  *owner,
75                                      GdkAtom     selection,
76                                      guint32     time,
77                                      gboolean    send_event)
78 {
79   return FALSE;
80 }
81
82 GdkWindow *
83 gdk_selection_owner_get_for_display (GdkDisplay *display,
84                                      GdkAtom     selection)
85 {
86   return NULL;
87 }
88
89 void
90 gdk_selection_convert (GdkWindow *requestor,
91                        GdkAtom    selection,
92                        GdkAtom    target,
93                        guint32    time)
94 {
95 }
96
97 gint
98 gdk_selection_property_get (GdkWindow  *requestor,
99                             guchar    **data,
100                             GdkAtom    *ret_type,
101                             gint       *ret_format)
102 {
103   if (ret_type)
104     *ret_type = GDK_NONE;
105   if (ret_format)
106     *ret_format = 0;
107   if (data)
108     *data = NULL;
109
110   return 0;
111 }
112
113 void
114 gdk_selection_send_notify_for_display (GdkDisplay       *display,
115                                        GdkNativeWindow  requestor,
116                                        GdkAtom          selection,
117                                        GdkAtom          target,
118                                        GdkAtom          property, 
119                                        guint32          time)
120 {
121   g_return_if_fail (GDK_IS_DISPLAY (display));
122 }
123
124 gint
125 gdk_text_property_to_text_list_for_display (GdkDisplay   *display,
126                                             GdkAtom       encoding,
127                                             gint          format, 
128                                             const guchar *text,
129                                             gint          length,
130                                             gchar      ***list)
131 {
132   return 0;
133 }
134
135 void
136 gdk_free_text_list (gchar **list)
137 {
138   g_return_if_fail (list != NULL);
139
140   g_strfreev (list);
141 }
142
143 gint 
144 gdk_text_property_to_utf8_list_for_display (GdkDisplay    *display,
145                                             GdkAtom        encoding,
146                                             gint           format,
147                                             const guchar  *text,
148                                             gint           length,
149                                             gchar       ***list)
150 {
151   g_return_val_if_fail (text != NULL, 0);
152   g_return_val_if_fail (length >= 0, 0);
153   g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
154
155   return 0;
156 }
157
158 gint
159 gdk_string_to_compound_text_for_display (GdkDisplay  *display,
160                                          const gchar *str,
161                                          GdkAtom     *encoding,
162                                          gint        *format,
163                                          guchar     **ctext,
164                                          gint        *length)
165 {
166   g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
167
168   return 1;
169 }
170
171 gchar *
172 gdk_utf8_to_string_target (const gchar *str)
173 {
174   return g_strdup (str);
175 }
176
177 gboolean
178 gdk_utf8_to_compound_text_for_display (GdkDisplay  *display,
179                                        const gchar *str,
180                                        GdkAtom     *encoding,
181                                        gint        *format,
182                                        guchar     **ctext,
183                                        gint        *length)
184 {
185   return FALSE;
186 }
187
188 void gdk_free_compound_text (guchar *ctext)
189 {
190   g_free (ctext);
191 }