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, see <http://www.gnu.org/licenses/>.
16  */
17 
18 /*
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/.
23  */
24 
25 #include "config.h"
26 
27 #include "gdkdndprivate.h"
28 
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"
35 
36 #include <string.h>
37 
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))
44 
45 #ifdef GDK_COMPILATION
46 typedef struct _GdkBroadwayDragContext GdkBroadwayDragContext;
47 #else
48 typedef GdkDragContext GdkBroadwayDragContext;
49 #endif
50 typedef struct _GdkBroadwayDragContextClass GdkBroadwayDragContextClass;
51 
52 GType     gdk_broadway_drag_context_get_type (void);
53 
54 struct _GdkBroadwayDragContext {
55   GdkDragContext context;
56 };
57 
58 struct _GdkBroadwayDragContextClass
59 {
60   GdkDragContextClass parent_class;
61 };
62 
63 static void gdk_broadway_drag_context_finalize (GObject *object);
64 
65 static GList *contexts;
66 
G_DEFINE_TYPE(GdkBroadwayDragContext,gdk_broadway_drag_context,GDK_TYPE_DRAG_CONTEXT)67 G_DEFINE_TYPE (GdkBroadwayDragContext, gdk_broadway_drag_context, GDK_TYPE_DRAG_CONTEXT)
68 
69 static void
70 gdk_broadway_drag_context_init (GdkBroadwayDragContext *dragcontext)
71 {
72   contexts = g_list_prepend (contexts, dragcontext);
73 }
74 
75 static void
gdk_broadway_drag_context_finalize(GObject * object)76 gdk_broadway_drag_context_finalize (GObject *object)
77 {
78   GdkDragContext *context = GDK_DRAG_CONTEXT (object);
79 
80   contexts = g_list_remove (contexts, context);
81 
82   G_OBJECT_CLASS (gdk_broadway_drag_context_parent_class)->finalize (object);
83 }
84 
85 /* Drag Contexts */
86 
87 GdkDragContext *
_gdk_broadway_window_drag_begin(GdkWindow * window,GdkDevice * device,GList * targets,gint x_root,gint y_root)88 _gdk_broadway_window_drag_begin (GdkWindow *window,
89 				 GdkDevice *device,
90 				 GList     *targets,
91                                  gint       x_root,
92                                  gint       y_root)
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   new_context->display = gdk_window_get_display (window);
102 
103   return new_context;
104 }
105 
106 GdkDragProtocol
_gdk_broadway_window_get_drag_protocol(GdkWindow * window,GdkWindow ** target)107 _gdk_broadway_window_get_drag_protocol (GdkWindow *window,
108 					GdkWindow **target)
109 {
110   return GDK_DRAG_PROTO_NONE;
111 }
112 
113 static GdkWindow *
gdk_broadway_drag_context_find_window(GdkDragContext * context,GdkWindow * drag_window,GdkScreen * screen,gint x_root,gint y_root,GdkDragProtocol * protocol)114 gdk_broadway_drag_context_find_window (GdkDragContext  *context,
115 				       GdkWindow       *drag_window,
116 				       GdkScreen       *screen,
117 				       gint             x_root,
118 				       gint             y_root,
119 				       GdkDragProtocol *protocol)
120 {
121   g_return_val_if_fail (context != NULL, NULL);
122   return NULL;
123 }
124 
125 static gboolean
gdk_broadway_drag_context_drag_motion(GdkDragContext * context,GdkWindow * dest_window,GdkDragProtocol protocol,gint x_root,gint y_root,GdkDragAction suggested_action,GdkDragAction possible_actions,guint32 time)126 gdk_broadway_drag_context_drag_motion (GdkDragContext *context,
127 				       GdkWindow      *dest_window,
128 				       GdkDragProtocol protocol,
129 				       gint            x_root,
130 				       gint            y_root,
131 				       GdkDragAction   suggested_action,
132 				       GdkDragAction   possible_actions,
133 				       guint32         time)
134 {
135   g_return_val_if_fail (context != NULL, FALSE);
136   g_return_val_if_fail (dest_window == NULL || GDK_WINDOW_IS_BROADWAY (dest_window), FALSE);
137 
138   return FALSE;
139 }
140 
141 static void
gdk_broadway_drag_context_drag_drop(GdkDragContext * context,guint32 time)142 gdk_broadway_drag_context_drag_drop (GdkDragContext *context,
143 				     guint32         time)
144 {
145   g_return_if_fail (context != NULL);
146 }
147 
148 static void
gdk_broadway_drag_context_drag_abort(GdkDragContext * context,guint32 time)149 gdk_broadway_drag_context_drag_abort (GdkDragContext *context,
150 				      guint32         time)
151 {
152   g_return_if_fail (context != NULL);
153 }
154 
155 /* Destination side */
156 
157 static void
gdk_broadway_drag_context_drag_status(GdkDragContext * context,GdkDragAction action,guint32 time)158 gdk_broadway_drag_context_drag_status (GdkDragContext   *context,
159 				       GdkDragAction     action,
160 				       guint32           time)
161 {
162   g_return_if_fail (context != NULL);
163 }
164 
165 static void
gdk_broadway_drag_context_drop_reply(GdkDragContext * context,gboolean ok,guint32 time)166 gdk_broadway_drag_context_drop_reply (GdkDragContext   *context,
167 				      gboolean          ok,
168 				      guint32           time)
169 {
170   g_return_if_fail (context != NULL);
171 }
172 
173 static void
gdk_broadway_drag_context_drop_finish(GdkDragContext * context,gboolean success,guint32 time)174 gdk_broadway_drag_context_drop_finish (GdkDragContext   *context,
175 				       gboolean          success,
176 				       guint32           time)
177 {
178   g_return_if_fail (context != NULL);
179 }
180 
181 void
_gdk_broadway_window_register_dnd(GdkWindow * window)182 _gdk_broadway_window_register_dnd (GdkWindow      *window)
183 {
184 }
185 
186 static GdkAtom
gdk_broadway_drag_context_get_selection(GdkDragContext * context)187 gdk_broadway_drag_context_get_selection (GdkDragContext *context)
188 {
189   g_return_val_if_fail (context != NULL, GDK_NONE);
190 
191   return GDK_NONE;
192 }
193 
194 static gboolean
gdk_broadway_drag_context_drop_status(GdkDragContext * context)195 gdk_broadway_drag_context_drop_status (GdkDragContext *context)
196 {
197   g_return_val_if_fail (context != NULL, FALSE);
198 
199   return FALSE;
200 }
201 
202 void
_gdk_broadway_display_init_dnd(GdkDisplay * display)203 _gdk_broadway_display_init_dnd (GdkDisplay *display)
204 {
205 }
206 
207 static void
gdk_broadway_drag_context_class_init(GdkBroadwayDragContextClass * klass)208 gdk_broadway_drag_context_class_init (GdkBroadwayDragContextClass *klass)
209 {
210   GObjectClass *object_class = G_OBJECT_CLASS (klass);
211   GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
212 
213   object_class->finalize = gdk_broadway_drag_context_finalize;
214 
215   context_class->find_window = gdk_broadway_drag_context_find_window;
216   context_class->drag_status = gdk_broadway_drag_context_drag_status;
217   context_class->drag_motion = gdk_broadway_drag_context_drag_motion;
218   context_class->drag_abort = gdk_broadway_drag_context_drag_abort;
219   context_class->drag_drop = gdk_broadway_drag_context_drag_drop;
220   context_class->drop_reply = gdk_broadway_drag_context_drop_reply;
221   context_class->drop_finish = gdk_broadway_drag_context_drop_finish;
222   context_class->drop_status = gdk_broadway_drag_context_drop_status;
223   context_class->get_selection = gdk_broadway_drag_context_get_selection;
224 }
225