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, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
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/.
32 #include "gdkproperty.h"
33 #include "gdkprivate-broadway.h"
34 #include "gdkinternals.h"
35 #include "gdkscreen-broadway.h"
36 #include "gdkdisplay-broadway.h"
40 typedef struct _GdkDragContextPrivateBroadway GdkDragContextPrivateBroadway;
42 /* Structure that holds information about a drag in progress.
43 * this is used on both source and destination sides.
45 struct _GdkDragContextPrivateBroadway {
46 GdkDragContext context;
49 #define PRIVATE_DATA(context) ((GdkDragContextPrivateBroadway *) GDK_DRAG_CONTEXT (context)->windowing_data)
51 static void gdk_drag_context_finalize (GObject *object);
53 static GList *contexts;
55 G_DEFINE_TYPE (GdkDragContext, gdk_drag_context, G_TYPE_OBJECT)
58 gdk_drag_context_init (GdkDragContext *dragcontext)
60 GdkDragContextPrivateBroadway *private;
62 private = G_TYPE_INSTANCE_GET_PRIVATE (dragcontext,
63 GDK_TYPE_DRAG_CONTEXT,
64 GdkDragContextPrivateBroadway);
66 dragcontext->windowing_data = private;
68 contexts = g_list_prepend (contexts, dragcontext);
72 gdk_drag_context_class_init (GdkDragContextClass *klass)
74 GObjectClass *object_class = G_OBJECT_CLASS (klass);
76 object_class->finalize = gdk_drag_context_finalize;
78 g_type_class_add_private (object_class, sizeof (GdkDragContextPrivateBroadway));
82 gdk_drag_context_finalize (GObject *object)
84 GdkDragContext *context = GDK_DRAG_CONTEXT (object);
86 contexts = g_list_remove (contexts, context);
88 G_OBJECT_CLASS (gdk_drag_context_parent_class)->finalize (object);
94 gdk_drag_context_new (void)
96 return g_object_new (GDK_TYPE_DRAG_CONTEXT, NULL);
100 gdk_drag_context_set_device (GdkDragContext *context,
103 g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
104 g_return_if_fail (GDK_IS_DEVICE (device));
108 gdk_drag_context_get_device (GdkDragContext *context)
110 g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
116 gdk_drag_begin (GdkWindow *window,
119 GdkDragContext *new_context;
121 g_return_val_if_fail (window != NULL, NULL);
122 g_return_val_if_fail (GDK_WINDOW_IS_BROADWAY (window), NULL);
124 new_context = gdk_drag_context_new ();
130 gdk_drag_get_protocol_for_display (GdkDisplay *display,
132 GdkDragProtocol *protocol)
138 gdk_drag_find_window_for_screen (GdkDragContext *context,
139 GdkWindow *drag_window,
143 GdkWindow **dest_window,
144 GdkDragProtocol *protocol)
146 g_return_if_fail (context != NULL);
150 gdk_drag_motion (GdkDragContext *context,
151 GdkWindow *dest_window,
152 GdkDragProtocol protocol,
155 GdkDragAction suggested_action,
156 GdkDragAction possible_actions,
159 g_return_val_if_fail (context != NULL, FALSE);
160 g_return_val_if_fail (dest_window == NULL || GDK_WINDOW_IS_BROADWAY (dest_window), FALSE);
166 gdk_drag_drop (GdkDragContext *context,
169 g_return_if_fail (context != NULL);
173 gdk_drag_abort (GdkDragContext *context,
176 g_return_if_fail (context != NULL);
179 /* Destination side */
182 gdk_drag_status (GdkDragContext *context,
183 GdkDragAction action,
186 g_return_if_fail (context != NULL);
190 gdk_drop_reply (GdkDragContext *context,
194 g_return_if_fail (context != NULL);
198 gdk_drop_finish (GdkDragContext *context,
202 g_return_if_fail (context != NULL);
206 gdk_window_register_dnd (GdkWindow *window)
211 gdk_drag_get_selection (GdkDragContext *context)
213 g_return_val_if_fail (context != NULL, GDK_NONE);
219 gdk_drag_drop_succeeded (GdkDragContext *context)
221 g_return_val_if_fail (context != NULL, FALSE);
227 _gdk_dnd_init (GdkDisplay *display)