]> Pileus Git - ~andy/gtk/blob - gdk/quartz/gdkdnd-quartz.c
Bug 588449 - DnD doesn't work on GDK/Quartz
[~andy/gtk] / gdk / quartz / gdkdnd-quartz.c
1 /* gdkdnd-quartz.c
2  *
3  * Copyright (C) 2005 Imendio AB
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #include "gdkdnd.h"
22 #include "gdkprivate-quartz.h"
23
24 static gpointer parent_class = NULL;
25
26 static void
27 gdk_drag_context_finalize (GObject *object)
28 {
29   GdkDragContext *context = GDK_DRAG_CONTEXT (object);
30   GdkDragContextPrivate *private = GDK_DRAG_CONTEXT_PRIVATE (context);
31  
32   g_free (private);
33   
34   G_OBJECT_CLASS (parent_class)->finalize (object);
35 }
36
37 static void
38 gdk_drag_context_init (GdkDragContext *dragcontext)
39 {
40   GdkDragContextPrivate *priv = g_new0 (GdkDragContextPrivate, 1);
41
42   dragcontext->windowing_data = priv;
43 }
44
45 static void
46 gdk_drag_context_class_init (GdkDragContextClass *klass)
47 {
48   GObjectClass *object_class = G_OBJECT_CLASS (klass);
49   
50   parent_class = g_type_class_peek_parent (klass);
51
52   object_class->finalize = gdk_drag_context_finalize;
53 }
54
55 GType
56 gdk_drag_context_get_type (void)
57 {
58   static GType object_type = 0;
59
60   if (!object_type)
61     {
62       static const GTypeInfo object_info =
63       {
64         sizeof (GdkDragContextClass),
65         (GBaseInitFunc) NULL,
66         (GBaseFinalizeFunc) NULL,
67         (GClassInitFunc) gdk_drag_context_class_init,
68         NULL,           /* class_finalize */
69         NULL,           /* class_data */
70         sizeof (GdkDragContext),
71         0,              /* n_preallocs */
72         (GInstanceInitFunc) gdk_drag_context_init,
73       };
74       
75       object_type = g_type_register_static (G_TYPE_OBJECT,
76                                             "GdkDragContext",
77                                             &object_info,
78                                             0);
79     }
80   
81   return object_type;
82 }
83
84 GdkDragContext *
85 gdk_drag_context_new (void)
86 {
87   return (GdkDragContext *)g_object_new (gdk_drag_context_get_type (), NULL);
88 }
89
90 void            
91 gdk_drag_context_ref (GdkDragContext *context)
92 {
93   g_object_ref (context);
94 }
95
96 void            
97 gdk_drag_context_unref (GdkDragContext *context)
98 {
99   g_object_unref (context);
100 }
101
102 GdkDragContext *_gdk_quartz_drag_source_context = NULL;
103
104 GdkDragContext *
105 gdk_quartz_drag_source_context ()
106 {
107   return _gdk_quartz_drag_source_context;
108 }
109
110 GdkDragContext * 
111 gdk_drag_begin (GdkWindow     *window,
112                 GList         *targets)
113 {
114   g_assert (_gdk_quartz_drag_source_context == NULL);
115   
116   /* Create fake context */
117   _gdk_quartz_drag_source_context = gdk_drag_context_new ();
118   _gdk_quartz_drag_source_context->is_source = TRUE;
119   
120   return _gdk_quartz_drag_source_context;
121 }
122
123 gboolean        
124 gdk_drag_motion (GdkDragContext *context,
125                  GdkWindow      *dest_window,
126                  GdkDragProtocol protocol,
127                  gint            x_root, 
128                  gint            y_root,
129                  GdkDragAction   suggested_action,
130                  GdkDragAction   possible_actions,
131                  guint32         time)
132 {
133   /* FIXME: Implement */
134   return FALSE;
135 }
136
137 guint32
138 gdk_drag_get_protocol_for_display (GdkDisplay      *display,
139                                    guint32          xid,
140                                    GdkDragProtocol *protocol)
141 {
142   /* FIXME: Implement */
143   return 0;
144 }
145
146 void
147 gdk_drag_find_window_for_screen (GdkDragContext  *context,
148                                  GdkWindow       *drag_window,
149                                  GdkScreen       *screen,
150                                  gint             x_root,
151                                  gint             y_root,
152                                  GdkWindow      **dest_window,
153                                  GdkDragProtocol *protocol)
154 {
155   /* FIXME: Implement */
156 }
157
158 void
159 gdk_drag_drop (GdkDragContext *context,
160                guint32         time)
161 {
162   /* FIXME: Implement */
163 }
164
165 void
166 gdk_drag_abort (GdkDragContext *context,
167                 guint32         time)
168 {
169   g_return_if_fail (context != NULL);
170   
171   /* FIXME: Implement */
172 }
173
174 void             
175 gdk_drag_status (GdkDragContext   *context,
176                  GdkDragAction     action,
177                  guint32           time)
178 {
179   context->action = action;
180 }
181
182 void 
183 gdk_drop_reply (GdkDragContext   *context,
184                 gboolean          ok,
185                 guint32           time)
186 {
187   g_return_if_fail (context != NULL);
188
189   /* FIXME: Implement */
190 }
191
192 void             
193 gdk_drop_finish (GdkDragContext   *context,
194                  gboolean          success,
195                  guint32           time)
196 {
197   /* FIXME: Implement */
198 }
199
200 void            
201 gdk_window_register_dnd (GdkWindow *window)
202 {
203   /* FIXME: Implement */
204 }
205
206 GdkAtom       
207 gdk_drag_get_selection (GdkDragContext *context)
208 {
209   /* FIXME: Implement */
210   return GDK_NONE;
211 }
212
213 gboolean 
214 gdk_drag_drop_succeeded (GdkDragContext *context)
215 {
216   /* FIXME: Implement */
217   return FALSE;
218 }
219
220 id
221 gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext *context)
222 {
223   return GDK_DRAG_CONTEXT_PRIVATE (context)->dragging_info;
224 }