2 * Copyright © 2010 Intel Corporation
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.
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.
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.
22 #include "gdkdndprivate.h"
25 #include "gdkinternals.h"
26 #include "gdkproperty.h"
27 #include "gdkprivate-wayland.h"
28 #include "gdkscreen-wayland.h"
29 #include "gdkdisplay-wayland.h"
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))
40 typedef struct _GdkWaylandDragContext GdkWaylandDragContext;
41 typedef struct _GdkWaylandDragContextClass GdkWaylandDragContextClass;
43 struct _GdkWaylandDragContext
45 GdkDragContext context;
48 struct _GdkWaylandDragContextClass
50 GdkDragContextClass parent_class;
53 static GList *contexts;
55 G_DEFINE_TYPE (GdkWaylandDragContext, gdk_wayland_drag_context, GDK_TYPE_DRAG_CONTEXT)
58 gdk_wayland_drag_context_finalize (GObject *object)
60 GdkDragContext *context = GDK_DRAG_CONTEXT (object);
62 contexts = g_list_remove (contexts, context);
64 G_OBJECT_CLASS (gdk_wayland_drag_context_parent_class)->finalize (object);
68 gdk_wayland_drag_context_find_window (GdkDragContext *context,
69 GdkWindow *drag_window,
73 GdkDragProtocol *protocol)
79 gdk_wayland_drag_context_drag_motion (GdkDragContext *context,
80 GdkWindow *dest_window,
81 GdkDragProtocol protocol,
84 GdkDragAction suggested_action,
85 GdkDragAction possible_actions,
92 gdk_wayland_drag_context_drag_abort (GdkDragContext *context,
98 gdk_wayland_drag_context_drag_drop (GdkDragContext *context,
103 /* Destination side */
106 gdk_wayland_drag_context_drag_status (GdkDragContext *context,
107 GdkDragAction action,
113 gdk_wayland_drag_context_drop_reply (GdkDragContext *context,
120 gdk_wayland_drag_context_drop_finish (GdkDragContext *context,
127 gdk_wayland_drag_context_drop_status (GdkDragContext *context)
133 gdk_wayland_drag_context_get_selection (GdkDragContext *context)
139 gdk_wayland_drag_context_init (GdkWaylandDragContext *context)
141 contexts = g_list_prepend (contexts, context);
145 gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
147 GObjectClass *object_class = G_OBJECT_CLASS (klass);
148 GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
150 object_class->finalize = gdk_wayland_drag_context_finalize;
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;
164 _gdk_wayland_window_get_drag_protocol (GdkWindow *window, GdkWindow **target)
170 _gdk_wayland_window_register_dnd (GdkWindow *window)
175 _gdk_wayland_window_drag_begin (GdkWindow *window,
179 GdkDragContext *context;
181 context = (GdkDragContext *) g_object_new (GDK_TYPE_WAYLAND_DRAG_CONTEXT, NULL);
183 gdk_drag_context_set_device (context, device);