]> Pileus Git - ~andy/gtk/blob - gdk/broadway/gdkselection-broadway.c
[broadway] Update to new GDK backend APIs
[~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_broadway_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_broadway_display_set_selection_owner (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_broadway_display_get_selection_owner (GdkDisplay *display,
84                                            GdkAtom     selection)
85 {
86   return NULL;
87 }
88
89 void
90 _gdk_broadway_display_convert_selection (GdkDisplay *display,
91                                          GdkWindow *requestor,
92                                          GdkAtom    selection,
93                                          GdkAtom    target,
94                                          guint32    time)
95 {
96 }
97
98 gint
99 _gdk_broadway_display_get_selection_property (GdkDisplay *display,
100                                               GdkWindow  *requestor,
101                                               guchar    **data,
102                                               GdkAtom    *ret_type,
103                                               gint       *ret_format)
104 {
105   if (ret_type)
106     *ret_type = GDK_NONE;
107   if (ret_format)
108     *ret_format = 0;
109   if (data)
110     *data = NULL;
111
112   return 0;
113 }
114
115 void
116 _gdk_broadway_display_send_selection_notify (GdkDisplay      *display,
117                                              GdkWindow       *requestor,
118                                              GdkAtom          selection,
119                                              GdkAtom          target,
120                                              GdkAtom          property, 
121                                              guint32          time)
122 {
123   g_return_if_fail (GDK_IS_DISPLAY (display));
124 }
125
126 gint 
127 _gdk_broadway_display_text_property_to_utf8_list (GdkDisplay    *display,
128                                                   GdkAtom        encoding,
129                                                   gint           format,
130                                                   const guchar  *text,
131                                                   gint           length,
132                                                   gchar       ***list)
133 {
134   g_return_val_if_fail (text != NULL, 0);
135   g_return_val_if_fail (length >= 0, 0);
136   g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
137
138   return 0;
139 }
140
141 gchar *
142 _gdk_broadway_display_utf8_to_string_target (GdkDisplay  *display,
143                                              const gchar *str)
144 {
145   return g_strdup (str);
146 }