]> Pileus Git - ~andy/gtk/blob - gdk/quartz/gdkdnd-quartz.c
Redo the fix for bug #492117, by adding a getter for the private drag
[~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_drag_begin (GdkWindow     *window,
106                 GList         *targets)
107 {
108   g_assert (_gdk_quartz_drag_source_context == NULL);
109   
110   /* Create fake context */
111   _gdk_quartz_drag_source_context = gdk_drag_context_new ();
112   _gdk_quartz_drag_source_context->is_source = TRUE;
113   
114   return _gdk_quartz_drag_source_context;
115 }
116
117 gboolean        
118 gdk_drag_motion (GdkDragContext *context,
119                  GdkWindow      *dest_window,
120                  GdkDragProtocol protocol,
121                  gint            x_root, 
122                  gint            y_root,
123                  GdkDragAction   suggested_action,
124                  GdkDragAction   possible_actions,
125                  guint32         time)
126 {
127   /* FIXME: Implement */
128   return FALSE;
129 }
130
131 guint32
132 gdk_drag_get_protocol_for_display (GdkDisplay      *display,
133                                    guint32          xid,
134                                    GdkDragProtocol *protocol)
135 {
136   /* FIXME: Implement */
137   return 0;
138 }
139
140 void
141 gdk_drag_find_window_for_screen (GdkDragContext  *context,
142                                  GdkWindow       *drag_window,
143                                  GdkScreen       *screen,
144                                  gint             x_root,
145                                  gint             y_root,
146                                  GdkWindow      **dest_window,
147                                  GdkDragProtocol *protocol)
148 {
149   /* FIXME: Implement */
150 }
151
152 void
153 gdk_drag_drop (GdkDragContext *context,
154                guint32         time)
155 {
156   /* FIXME: Implement */
157 }
158
159 void
160 gdk_drag_abort (GdkDragContext *context,
161                 guint32         time)
162 {
163   g_return_if_fail (context != NULL);
164   
165   /* FIXME: Implement */
166 }
167
168 void             
169 gdk_drag_status (GdkDragContext   *context,
170                  GdkDragAction     action,
171                  guint32           time)
172 {
173   context->action = action;
174 }
175
176 void 
177 gdk_drop_reply (GdkDragContext   *context,
178                 gboolean          ok,
179                 guint32           time)
180 {
181   g_return_if_fail (context != NULL);
182
183   /* FIXME: Implement */
184 }
185
186 void             
187 gdk_drop_finish (GdkDragContext   *context,
188                  gboolean          success,
189                  guint32           time)
190 {
191   /* FIXME: Implement */
192 }
193
194 void            
195 gdk_window_register_dnd (GdkWindow *window)
196 {
197   /* FIXME: Implement */
198 }
199
200 GdkAtom       
201 gdk_drag_get_selection (GdkDragContext *context)
202 {
203   /* FIXME: Implement */
204   return GDK_NONE;
205 }
206
207 gboolean 
208 gdk_drag_drop_succeeded (GdkDragContext *context)
209 {
210   /* FIXME: Implement */
211   return FALSE;
212 }
213
214 id
215 gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext *context)
216 {
217   return GDK_DRAG_CONTEXT_PRIVATE (context)->dragging_info;
218 }