]> Pileus Git - ~andy/gtk/blob - gdk/wayland/gdkdnd-wayland.c
Track 2.99.3 API changes
[~andy/gtk] / gdk / wayland / gdkdnd-wayland.c
1 /*
2  * Copyright © 2010 Intel Corporation
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library 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.
18  */
19
20 #include "config.h"
21
22 #include "gdkdndprivate.h"
23
24 #include "gdkmain.h"
25 #include "gdkinternals.h"
26 #include "gdkproperty.h"
27 #include "gdkprivate-wayland.h"
28 #include "gdkscreen-wayland.h"
29 #include "gdkdisplay-wayland.h"
30
31 #include <string.h>
32
33 #define GDK_TYPE_WAYLAND_DRAG_CONTEXT              (gdk_wayland_drag_context_get_type ())
34 #define GDK_WAYLAND_DRAG_CONTEXT(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_DRAG_CONTEXT, GdkWaylandDragContext))
35 #define GDK_WAYLAND_DRAG_CONTEXT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_DRAG_CONTEXT, GdkWaylandDragContextClass))
36 #define GDK_IS_WAYLAND_DRAG_CONTEXT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_DRAG_CONTEXT))
37 #define GDK_IS_WAYLAND_DRAG_CONTEXT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_DRAG_CONTEXT))
38 #define GDK_WAYLAND_DRAG_CONTEXT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_DRAG_CONTEXT, GdkWaylandDragContextClass))
39
40 typedef struct _GdkWaylandDragContext GdkWaylandDragContext;
41 typedef struct _GdkWaylandDragContextClass GdkWaylandDragContextClass;
42
43 struct _GdkWaylandDragContext
44 {
45   GdkDragContext context;
46 };
47
48 struct _GdkWaylandDragContextClass
49 {
50   GdkDragContextClass parent_class;
51 };
52
53 static GList *contexts;
54
55 G_DEFINE_TYPE (GdkWaylandDragContext, gdk_wayland_drag_context, GDK_TYPE_DRAG_CONTEXT)
56
57 static void
58 gdk_wayland_drag_context_finalize (GObject *object)
59 {
60   GdkDragContext *context = GDK_DRAG_CONTEXT (object);
61
62   contexts = g_list_remove (contexts, context);
63
64   G_OBJECT_CLASS (gdk_wayland_drag_context_parent_class)->finalize (object);
65 }
66
67 static GdkWindow *
68 gdk_wayland_drag_context_find_window (GdkDragContext  *context,
69                                       GdkWindow       *drag_window,
70                                       GdkScreen       *screen,
71                                       gint             x_root,
72                                       gint             y_root,
73                                       GdkDragProtocol *protocol)
74 {
75   return NULL;
76 }
77
78 static gboolean
79 gdk_wayland_drag_context_drag_motion (GdkDragContext *context,
80                                       GdkWindow      *dest_window,
81                                       GdkDragProtocol protocol,
82                                       gint            x_root,
83                                       gint            y_root,
84                                       GdkDragAction   suggested_action,
85                                       GdkDragAction   possible_actions,
86                                       guint32         time)
87 {
88   return FALSE;
89 }
90
91 static void
92 gdk_wayland_drag_context_drag_abort (GdkDragContext *context,
93                                      guint32         time)
94 {
95 }
96
97 static void
98 gdk_wayland_drag_context_drag_drop (GdkDragContext *context,
99                                     guint32         time)
100 {
101 }
102
103 /* Destination side */
104
105 static void
106 gdk_wayland_drag_context_drag_status (GdkDragContext *context,
107                                       GdkDragAction   action,
108                                       guint32         time_)
109 {
110 }
111
112 static void
113 gdk_wayland_drag_context_drop_reply (GdkDragContext *context,
114                                      gboolean        accepted,
115                                      guint32         time_)
116 {
117 }
118
119 static void
120 gdk_wayland_drag_context_drop_finish (GdkDragContext *context,
121                                       gboolean        success,
122                                       guint32         time)
123 {
124 }
125
126 static gboolean
127 gdk_wayland_drag_context_drop_status (GdkDragContext *context)
128 {
129   return FALSE;
130 }
131
132 static GdkAtom
133 gdk_wayland_drag_context_get_selection (GdkDragContext *context)
134 {
135     return GDK_NONE;
136 }
137
138 static void
139 gdk_wayland_drag_context_init (GdkWaylandDragContext *context)
140 {
141   contexts = g_list_prepend (contexts, context);
142 }
143
144 static void
145 gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
146 {
147   GObjectClass *object_class = G_OBJECT_CLASS (klass);
148   GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
149
150   object_class->finalize = gdk_wayland_drag_context_finalize;
151
152   context_class->find_window = gdk_wayland_drag_context_find_window;
153   context_class->drag_status = gdk_wayland_drag_context_drag_status;
154   context_class->drag_motion = gdk_wayland_drag_context_drag_motion;
155   context_class->drag_abort = gdk_wayland_drag_context_drag_abort;
156   context_class->drag_drop = gdk_wayland_drag_context_drag_drop;
157   context_class->drop_reply = gdk_wayland_drag_context_drop_reply;
158   context_class->drop_finish = gdk_wayland_drag_context_drop_finish;
159   context_class->drop_status = gdk_wayland_drag_context_drop_status;
160   context_class->get_selection = gdk_wayland_drag_context_get_selection;
161 }
162
163 GdkDragProtocol
164 _gdk_wayland_window_get_drag_protocol (GdkWindow *window, GdkWindow **target)
165 {
166   return 0;
167 }
168
169 void
170 _gdk_wayland_window_register_dnd (GdkWindow *window)
171 {
172 }
173
174 GdkDragContext *
175 _gdk_wayland_window_drag_begin (GdkWindow *window,
176                                 GdkDevice *device,
177                                 GList     *targets)
178 {
179   GdkDragContext *context;
180
181   context = (GdkDragContext *) g_object_new (GDK_TYPE_WAYLAND_DRAG_CONTEXT, NULL);
182
183   gdk_drag_context_set_device (context, device);
184
185   return context;
186 }