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