1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1999 Peter Mattis, Spencer Kimball and Josh MacDonald
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.
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.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
27 #include "gdkdndprivate.h"
29 #include "gdkinternals.h"
30 #include "gdkproperty.h"
31 #include "gdkprivate-broadway.h"
32 #include "gdkinternals.h"
33 #include "gdkscreen-broadway.h"
34 #include "gdkdisplay-broadway.h"
38 #define GDK_TYPE_BROADWAY_DRAG_CONTEXT (gdk_broadway_drag_context_get_type ())
39 #define GDK_BROADWAY_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContext))
40 #define GDK_BROADWAY_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass))
41 #define GDK_IS_BROADWAY_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT))
42 #define GDK_IS_BROADWAY_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT))
43 #define GDK_BROADWAY_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass))
45 #ifdef GDK_COMPILATION
46 typedef struct _GdkBroadwayDragContext GdkBroadwayDragContext;
48 typedef GdkDragContext GdkBroadwayDragContext;
50 typedef struct _GdkBroadwayDragContextClass GdkBroadwayDragContextClass;
52 GType gdk_broadway_drag_context_get_type (void);
54 struct _GdkBroadwayDragContext {
55 GdkDragContext context;
58 struct _GdkBroadwayDragContextClass
60 GdkDragContextClass parent_class;
63 static void gdk_broadway_drag_context_finalize (GObject *object);
65 static GList *contexts;
67 G_DEFINE_TYPE (GdkBroadwayDragContext, gdk_broadway_drag_context, GDK_TYPE_DRAG_CONTEXT)
70 gdk_broadway_drag_context_init (GdkBroadwayDragContext *dragcontext)
72 contexts = g_list_prepend (contexts, dragcontext);
76 gdk_broadway_drag_context_finalize (GObject *object)
78 GdkDragContext *context = GDK_DRAG_CONTEXT (object);
80 contexts = g_list_remove (contexts, context);
82 G_OBJECT_CLASS (gdk_broadway_drag_context_parent_class)->finalize (object);
88 _gdk_broadway_window_drag_begin (GdkWindow *window,
92 GdkDragContext *new_context;
94 g_return_val_if_fail (window != NULL, NULL);
95 g_return_val_if_fail (GDK_WINDOW_IS_BROADWAY (window), NULL);
97 new_context = g_object_new (GDK_TYPE_BROADWAY_DRAG_CONTEXT,
104 _gdk_broadway_window_get_drag_protocol (GdkWindow *window,
107 return GDK_DRAG_PROTO_NONE;
111 gdk_broadway_drag_context_find_window (GdkDragContext *context,
112 GdkWindow *drag_window,
116 GdkDragProtocol *protocol)
118 g_return_val_if_fail (context != NULL, NULL);
123 gdk_broadway_drag_context_drag_motion (GdkDragContext *context,
124 GdkWindow *dest_window,
125 GdkDragProtocol protocol,
128 GdkDragAction suggested_action,
129 GdkDragAction possible_actions,
132 g_return_val_if_fail (context != NULL, FALSE);
133 g_return_val_if_fail (dest_window == NULL || GDK_WINDOW_IS_BROADWAY (dest_window), FALSE);
139 gdk_broadway_drag_context_drag_drop (GdkDragContext *context,
142 g_return_if_fail (context != NULL);
146 gdk_broadway_drag_context_drag_abort (GdkDragContext *context,
149 g_return_if_fail (context != NULL);
152 /* Destination side */
155 gdk_broadway_drag_context_drag_status (GdkDragContext *context,
156 GdkDragAction action,
159 g_return_if_fail (context != NULL);
163 gdk_broadway_drag_context_drop_reply (GdkDragContext *context,
167 g_return_if_fail (context != NULL);
171 gdk_broadway_drag_context_drop_finish (GdkDragContext *context,
175 g_return_if_fail (context != NULL);
179 _gdk_broadway_window_register_dnd (GdkWindow *window)
184 gdk_broadway_drag_context_get_selection (GdkDragContext *context)
186 g_return_val_if_fail (context != NULL, GDK_NONE);
192 gdk_broadway_drag_context_drop_status (GdkDragContext *context)
194 g_return_val_if_fail (context != NULL, FALSE);
200 _gdk_broadway_display_init_dnd (GdkDisplay *display)
205 gdk_broadway_drag_context_class_init (GdkBroadwayDragContextClass *klass)
207 GObjectClass *object_class = G_OBJECT_CLASS (klass);
208 GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
210 object_class->finalize = gdk_broadway_drag_context_finalize;
212 context_class->find_window = gdk_broadway_drag_context_find_window;
213 context_class->drag_status = gdk_broadway_drag_context_drag_status;
214 context_class->drag_motion = gdk_broadway_drag_context_drag_motion;
215 context_class->drag_abort = gdk_broadway_drag_context_drag_abort;
216 context_class->drag_drop = gdk_broadway_drag_context_drag_drop;
217 context_class->drop_reply = gdk_broadway_drag_context_drop_reply;
218 context_class->drop_finish = gdk_broadway_drag_context_drop_finish;
219 context_class->drop_status = gdk_broadway_drag_context_drop_status;
220 context_class->get_selection = gdk_broadway_drag_context_get_selection;