]> Pileus Git - ~andy/gtk/blob - gdk/broadway/gdkdnd-broadway.c
cf07081b89b241fea21675fda03438a97b8329b0
[~andy/gtk] / gdk / broadway / gdkdnd-broadway.c
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 1995-1999 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 "gdkdndprivate.h"
30
31 #include "gdkinternals.h"
32 #include "gdkproperty.h"
33 #include "gdkprivate-broadway.h"
34 #include "gdkinternals.h"
35 #include "gdkscreen-broadway.h"
36 #include "gdkdisplay-broadway.h"
37
38 #include <string.h>
39
40 #define GDK_TYPE_BROADWAY_DRAG_CONTEXT              (gdk_broadway_drag_context_get_type ())
41 #define GDK_BROADWAY_DRAG_CONTEXT(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContext))
42 #define GDK_BROADWAY_DRAG_CONTEXT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass))
43 #define GDK_IS_BROADWAY_DRAG_CONTEXT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT))
44 #define GDK_IS_BROADWAY_DRAG_CONTEXT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT))
45 #define GDK_BROADWAY_DRAG_CONTEXT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass))
46
47 #ifdef GDK_COMPILATION
48 typedef struct _GdkBroadwayDragContext GdkBroadwayDragContext;
49 #else
50 typedef GdkDragContext GdkBroadwayDragContext;
51 #endif
52 typedef struct _GdkBroadwayDragContextClass GdkBroadwayDragContextClass;
53
54 GType     gdk_broadway_drag_context_get_type (void);
55
56 struct _GdkBroadwayDragContext {
57   GdkDragContext context;
58 };
59
60 struct _GdkBroadwayDragContextClass
61 {
62   GdkDragContextClass parent_class;
63 };
64
65 static void gdk_broadway_drag_context_finalize (GObject *object);
66
67 static GList *contexts;
68
69 G_DEFINE_TYPE (GdkBroadwayDragContext, gdk_broadway_drag_context, GDK_TYPE_DRAG_CONTEXT)
70
71 static void
72 gdk_broadway_drag_context_init (GdkBroadwayDragContext *dragcontext)
73 {
74   contexts = g_list_prepend (contexts, dragcontext);
75 }
76
77 static void
78 gdk_broadway_drag_context_finalize (GObject *object)
79 {
80   GdkDragContext *context = GDK_DRAG_CONTEXT (object);
81
82   contexts = g_list_remove (contexts, context);
83
84   G_OBJECT_CLASS (gdk_broadway_drag_context_parent_class)->finalize (object);
85 }
86
87 /* Drag Contexts */
88
89 GdkDragContext *
90 _gdk_broadway_window_drag_begin (GdkWindow *window,
91                                  GdkDevice *device,
92                                  GList     *targets)
93 {
94   GdkDragContext *new_context;
95
96   g_return_val_if_fail (window != NULL, NULL);
97   g_return_val_if_fail (GDK_WINDOW_IS_BROADWAY (window), NULL);
98
99   new_context = g_object_new (GDK_TYPE_BROADWAY_DRAG_CONTEXT,
100                               NULL);
101
102   return new_context;
103 }
104
105 GdkDragProtocol
106 _gdk_broadway_window_get_drag_protocol (GdkWindow *window,
107                                         GdkWindow **target)
108 {
109   return GDK_DRAG_PROTO_NONE;
110 }
111
112 static GdkWindow *
113 gdk_broadway_drag_context_find_window (GdkDragContext  *context,
114                                        GdkWindow       *drag_window,
115                                        GdkScreen       *screen,
116                                        gint             x_root,
117                                        gint             y_root,
118                                        GdkDragProtocol *protocol)
119 {
120   g_return_val_if_fail (context != NULL, NULL);
121   return NULL;
122 }
123
124 static gboolean
125 gdk_broadway_drag_context_drag_motion (GdkDragContext *context,
126                                        GdkWindow      *dest_window,
127                                        GdkDragProtocol protocol,
128                                        gint            x_root,
129                                        gint            y_root,
130                                        GdkDragAction   suggested_action,
131                                        GdkDragAction   possible_actions,
132                                        guint32         time)
133 {
134   g_return_val_if_fail (context != NULL, FALSE);
135   g_return_val_if_fail (dest_window == NULL || GDK_WINDOW_IS_BROADWAY (dest_window), FALSE);
136
137   return FALSE;
138 }
139
140 static void
141 gdk_broadway_drag_context_drag_drop (GdkDragContext *context,
142                                      guint32         time)
143 {
144   g_return_if_fail (context != NULL);
145 }
146
147 static void
148 gdk_broadway_drag_context_drag_abort (GdkDragContext *context,
149                                       guint32         time)
150 {
151   g_return_if_fail (context != NULL);
152 }
153
154 /* Destination side */
155
156 static void
157 gdk_broadway_drag_context_drag_status (GdkDragContext   *context,
158                                        GdkDragAction     action,
159                                        guint32           time)
160 {
161   g_return_if_fail (context != NULL);
162 }
163
164 static void
165 gdk_broadway_drag_context_drop_reply (GdkDragContext   *context,
166                                       gboolean          ok,
167                                       guint32           time)
168 {
169   g_return_if_fail (context != NULL);
170 }
171
172 static void
173 gdk_broadway_drag_context_drop_finish (GdkDragContext   *context,
174                                        gboolean          success,
175                                        guint32           time)
176 {
177   g_return_if_fail (context != NULL);
178 }
179
180 void
181 _gdk_broadway_window_register_dnd (GdkWindow      *window)
182 {
183 }
184
185 static GdkAtom
186 gdk_broadway_drag_context_get_selection (GdkDragContext *context)
187 {
188   g_return_val_if_fail (context != NULL, GDK_NONE);
189
190   return GDK_NONE;
191 }
192
193 static gboolean
194 gdk_broadway_drag_context_drop_status (GdkDragContext *context)
195 {
196   g_return_val_if_fail (context != NULL, FALSE);
197
198   return FALSE;
199 }
200
201 void
202 _gdk_broadway_display_init_dnd (GdkDisplay *display)
203 {
204 }
205
206 static void
207 gdk_broadway_drag_context_class_init (GdkBroadwayDragContextClass *klass)
208 {
209   GObjectClass *object_class = G_OBJECT_CLASS (klass);
210   GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
211
212   object_class->finalize = gdk_broadway_drag_context_finalize;
213
214   context_class->find_window = gdk_broadway_drag_context_find_window;
215   context_class->drag_status = gdk_broadway_drag_context_drag_status;
216   context_class->drag_motion = gdk_broadway_drag_context_drag_motion;
217   context_class->drag_abort = gdk_broadway_drag_context_drag_abort;
218   context_class->drag_drop = gdk_broadway_drag_context_drag_drop;
219   context_class->drop_reply = gdk_broadway_drag_context_drop_reply;
220   context_class->drop_finish = gdk_broadway_drag_context_drop_finish;
221   context_class->drop_status = gdk_broadway_drag_context_drop_status;
222   context_class->get_selection = gdk_broadway_drag_context_get_selection;
223 }