| 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, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
#include "config.h" |
| 20 |
#include "gdkdnd.h" |
| 21 |
#include "gdkquartzdnd.h" |
| 22 |
#include "gdkprivate-quartz.h" |
| 23 |
#include "gdkinternal-quartz.h" |
| 24 |
#include "gdkquartz-gtk-only.h" |
| 25 |
|
| 26 |
G_DEFINE_TYPE (GdkQuartzDragContext, gdk_quartz_drag_context, GDK_TYPE_DRAG_CONTEXT) |
| 27 |
|
| 28 |
|
| 29 |
GdkDragContext *_gdk_quartz_drag_source_context = NULL; |
| 30 |
|
| 31 |
GdkDragContext * |
| 32 |
gdk_quartz_drag_source_context_libgtk_only () |
| 33 |
{ |
| 34 |
return _gdk_quartz_drag_source_context; |
| 35 |
} |
| 36 |
|
| 37 |
GdkDragContext * |
| 38 |
_gdk_quartz_window_drag_begin (GdkWindow *window, |
| 39 |
GdkDevice *device, |
| 40 |
GList *targets, |
| 41 |
gint x_root, |
| 42 |
gint y_root) |
| 43 |
{ |
| 44 |
g_assert (_gdk_quartz_drag_source_context == NULL); |
| 45 |
|
| 46 |
/* Create fake context */ |
| 47 |
_gdk_quartz_drag_source_context = g_object_new (GDK_TYPE_QUARTZ_DRAG_CONTEXT, |
| 48 |
NULL); |
| 49 |
_gdk_quartz_drag_source_context->display = gdk_window_get_display (window); |
| 50 |
_gdk_quartz_drag_source_context->is_source = TRUE; |
| 51 |
|
| 52 |
_gdk_quartz_drag_source_context->source_window = window; |
| 53 |
g_object_ref (window); |
| 54 |
|
| 55 |
_gdk_quartz_drag_source_context->targets = targets; |
| 56 |
|
| 57 |
gdk_drag_context_set_device (_gdk_quartz_drag_source_context, device); |
| 58 |
|
| 59 |
return _gdk_quartz_drag_source_context; |
| 60 |
} |
| 61 |
|
| 62 |
void |
| 63 |
_gdk_quartz_drag_source_context_destroy_gtk_only () |
| 64 |
{ |
| 65 |
if (_gdk_quartz_drag_source_context) |
| 66 |
g_object_unref (_gdk_quartz_drag_source_context); |
| 67 |
_gdk_quartz_drag_source_context = NULL; |
| 68 |
} |
| 69 |
|
| 70 |
static gboolean |
| 71 |
gdk_quartz_drag_context_drag_motion (GdkDragContext *context, |
| 72 |
GdkWindow *dest_window, |
| 73 |
GdkDragProtocol protocol, |
| 74 |
gint x_root, |
| 75 |
gint y_root, |
| 76 |
GdkDragAction suggested_action, |
| 77 |
GdkDragAction possible_actions, |
| 78 |
guint32 time) |
| 79 |
{ |
| 80 |
/* FIXME: Implement */ |
| 81 |
return FALSE; |
| 82 |
} |
| 83 |
|
| 84 |
static GdkWindow * |
| 85 |
gdk_quartz_drag_context_find_window (GdkDragContext *context, |
| 86 |
GdkWindow *drag_window, |
| 87 |
GdkScreen *screen, |
| 88 |
gint x_root, |
| 89 |
gint y_root, |
| 90 |
GdkDragProtocol *protocol) |
| 91 |
{ |
| 92 |
/* FIXME: Implement */ |
| 93 |
return NULL; |
| 94 |
} |
| 95 |
|
| 96 |
static void |
| 97 |
gdk_quartz_drag_context_drag_drop (GdkDragContext *context, |
| 98 |
guint32 time) |
| 99 |
{ |
| 100 |
/* FIXME: Implement */ |
| 101 |
} |
| 102 |
|
| 103 |
static void |
| 104 |
gdk_quartz_drag_context_drag_abort (GdkDragContext *context, |
| 105 |
guint32 time) |
| 106 |
{ |
| 107 |
/* FIXME: Implement */ |
| 108 |
} |
| 109 |
|
| 110 |
static void |
| 111 |
gdk_quartz_drag_context_drag_status (GdkDragContext *context, |
| 112 |
GdkDragAction action, |
| 113 |
guint32 time) |
| 114 |
{ |
| 115 |
context->action = action; |
| 116 |
} |
| 117 |
|
| 118 |
static void |
| 119 |
gdk_quartz_drag_context_drop_reply (GdkDragContext *context, |
| 120 |
gboolean ok, |
| 121 |
guint32 time) |
| 122 |
{ |
| 123 |
/* FIXME: Implement */ |
| 124 |
} |
| 125 |
|
| 126 |
static void |
| 127 |
gdk_quartz_drag_context_drop_finish (GdkDragContext *context, |
| 128 |
gboolean success, |
| 129 |
guint32 time) |
| 130 |
{ |
| 131 |
/* FIXME: Implement */ |
| 132 |
} |
| 133 |
|
| 134 |
void |
| 135 |
_gdk_quartz_window_register_dnd (GdkWindow *window) |
| 136 |
{ |
| 137 |
/* FIXME: Implement */ |
| 138 |
} |
| 139 |
|
| 140 |
static GdkAtom |
| 141 |
gdk_quartz_drag_context_get_selection (GdkDragContext *context) |
| 142 |
{ |
| 143 |
/* FIXME: Implement */ |
| 144 |
return GDK_NONE; |
| 145 |
} |
| 146 |
|
| 147 |
static gboolean |
| 148 |
gdk_quartz_drag_context_drop_status (GdkDragContext *context) |
| 149 |
{ |
| 150 |
/* FIXME: Implement */ |
| 151 |
return FALSE; |
| 152 |
} |
| 153 |
|
| 154 |
id |
| 155 |
gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext *context) |
| 156 |
{ |
| 157 |
return GDK_QUARTZ_DRAG_CONTEXT (context)->dragging_info; |
| 158 |
} |
| 159 |
|
| 160 |
static void |
| 161 |
gdk_quartz_drag_context_init (GdkQuartzDragContext *context) |
| 162 |
{ |
| 163 |
} |
| 164 |
|
| 165 |
static void |
| 166 |
gdk_quartz_drag_context_finalize (GObject *object) |
| 167 |
{ |
| 168 |
G_OBJECT_CLASS (gdk_quartz_drag_context_parent_class)->finalize (object); |
| 169 |
} |
| 170 |
|
| 171 |
static void |
| 172 |
gdk_quartz_drag_context_class_init (GdkQuartzDragContextClass *klass) |
| 173 |
{ |
| 174 |
GObjectClass *object_class = G_OBJECT_CLASS (klass); |
| 175 |
GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass); |
| 176 |
|
| 177 |
object_class->finalize = gdk_quartz_drag_context_finalize; |
| 178 |
|
| 179 |
context_class->find_window = gdk_quartz_drag_context_find_window; |
| 180 |
context_class->drag_status = gdk_quartz_drag_context_drag_status; |
| 181 |
context_class->drag_motion = gdk_quartz_drag_context_drag_motion; |
| 182 |
context_class->drag_abort = gdk_quartz_drag_context_drag_abort; |
| 183 |
context_class->drag_drop = gdk_quartz_drag_context_drag_drop; |
| 184 |
context_class->drop_reply = gdk_quartz_drag_context_drop_reply; |
| 185 |
context_class->drop_finish = gdk_quartz_drag_context_drop_finish; |
| 186 |
context_class->drop_status = gdk_quartz_drag_context_drop_status; |
| 187 |
context_class->get_selection = gdk_quartz_drag_context_get_selection; |
| 188 |
} |