win32: Adapt to dnd api changes

Follow the GdkDragContext -> GdkDrag change.
This commit is contained in:
Matthias Clasen 2018-07-02 18:04:51 +02:00
parent 64f5afe608
commit c8e082f296
7 changed files with 227 additions and 229 deletions

View File

@ -280,7 +280,7 @@ Otherwise it's similar to how the clipboard works. Only the DnD server
#include "gdkclipboard-win32.h" #include "gdkclipboard-win32.h"
#include "gdkclipdrop-win32.h" #include "gdkclipdrop-win32.h"
#include "gdkhdataoutputstream-win32.h" #include "gdkhdataoutputstream-win32.h"
#include "gdk/gdkdndprivate.h" #include "gdk/gdkdragprivate.h"
#include "gdkwin32dnd.h" #include "gdkwin32dnd.h"
#include "gdkwin32dnd-private.h" #include "gdkwin32dnd-private.h"
#include "gdkwin32.h" #include "gdkwin32.h"

View File

@ -130,7 +130,7 @@
* From that point forward the context gets any events emitted * From that point forward the context gets any events emitted
* by GDK, and can prevent these events from going anywhere else. * by GDK, and can prevent these events from going anywhere else.
* They are all handled in * They are all handled in
* S: gdk_drag_context_handle_source_event() -> backend:handle_event() * S: gdk_drag_handle_source_event() -> backend:handle_event()
* (except for wayland backend - it doesn't have that function). * (except for wayland backend - it doesn't have that function).
* *
* That function catches the following events: * That function catches the following events:
@ -195,14 +195,14 @@
/* For C-style COM wrapper macros */ /* For C-style COM wrapper macros */
#define COBJMACROS #define COBJMACROS
#include "gdkdnd.h" #include "gdkdrag.h"
#include "gdkproperty.h" #include "gdkproperty.h"
#include "gdkinternals.h" #include "gdkinternals.h"
#include "gdkprivate-win32.h" #include "gdkprivate-win32.h"
#include "gdkwin32.h" #include "gdkwin32.h"
#include "gdkwin32dnd.h" #include "gdkwin32dnd.h"
#include "gdkdisplayprivate.h" #include "gdkdisplayprivate.h"
#include "gdk/gdkdndprivate.h" #include "gdk/gdkdragprivate.h"
#include "gdkwin32dnd-private.h" #include "gdkwin32dnd-private.h"
#include "gdkdisplay-win32.h" #include "gdkdisplay-win32.h"
#include "gdkdeviceprivate.h" #include "gdkdeviceprivate.h"
@ -226,12 +226,12 @@ typedef struct
IDropSource ids; IDropSource ids;
IDropSourceNotify idsn; IDropSourceNotify idsn;
gint ref_count; gint ref_count;
GdkDragContext *drag; GdkDrag *drag;
/* These are thread-local /* These are thread-local
* copies of the similar fields from GdkWin32DragContext * copies of the similar fields from GdkWin32Drag
*/ */
GdkWin32DragContextUtilityData util_data; GdkWin32DragUtilityData util_data;
/* Cached here, so that we don't have to look in /* Cached here, so that we don't have to look in
* the context every time. * the context every time.
@ -249,7 +249,7 @@ typedef struct
typedef struct { typedef struct {
IDataObject ido; IDataObject ido;
int ref_count; int ref_count;
GdkDragContext *drag; GdkDrag *drag;
GArray *formats; GArray *formats;
} data_object; } data_object;
@ -342,8 +342,8 @@ struct _GdkWin32DnDThreadUpdateDragState
{ {
GdkWin32DnDThreadQueueItem base; GdkWin32DnDThreadQueueItem base;
gpointer opaque_ddd; gpointer opaque_ddd;
GdkWin32DragContextUtilityData produced_util_data; GdkWin32DragUtilityData produced_util_data;
}; };
typedef struct _GdkWin32DnDThread GdkWin32DnDThread; typedef struct _GdkWin32DnDThread GdkWin32DnDThread;
@ -485,10 +485,10 @@ process_dnd_queue (gboolean timed,
} }
void void
_gdk_win32_local_drag_context_drop_response (GdkDragContext *drag, _gdk_win32_local_drag_drop_response (GdkDrag *drag,
GdkDragAction action) GdkDragAction action)
{ {
GDK_NOTE (DND, g_print ("_gdk_win32_local_drag_context_drop_response: 0x%p\n", GDK_NOTE (DND, g_print ("_gdk_win32_local_drag_drop_response: 0x%p\n",
drag)); drag));
g_signal_emit_by_name (drag, "dnd-finished"); g_signal_emit_by_name (drag, "dnd-finished");
@ -500,8 +500,8 @@ do_drag_drop_response (gpointer user_data)
{ {
GdkWin32DnDThreadDoDragDrop *ddd = (GdkWin32DnDThreadDoDragDrop *) user_data; GdkWin32DnDThreadDoDragDrop *ddd = (GdkWin32DnDThreadDoDragDrop *) user_data;
HRESULT hr = ddd->received_result; HRESULT hr = ddd->received_result;
GdkDragContext *drag = GDK_DRAG_CONTEXT (ddd->base.opaque_context); GdkDrag *drag = GDK_DRAG (ddd->base.opaque_context);
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get (); GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
gpointer table_value = g_hash_table_lookup (clipdrop->active_source_drags, drag); gpointer table_value = g_hash_table_lookup (clipdrop->active_source_drags, drag);
@ -560,7 +560,7 @@ received_drag_context_data (GObject *drag,
GdkWin32DnDThreadGetData *getdata = (GdkWin32DnDThreadGetData *) user_data; GdkWin32DnDThreadGetData *getdata = (GdkWin32DnDThreadGetData *) user_data;
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get (); GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
if (!gdk_drag_context_write_finish (GDK_DRAG_CONTEXT (drag), result, &error)) if (!gdk_drag_write_finish (GDK_DRAG (drag), result, &error))
{ {
HANDLE handle; HANDLE handle;
gboolean is_hdata; gboolean is_hdata;
@ -593,7 +593,7 @@ get_data_response (gpointer user_data)
{ {
GdkWin32DnDThreadGetData *getdata = (GdkWin32DnDThreadGetData *) user_data; GdkWin32DnDThreadGetData *getdata = (GdkWin32DnDThreadGetData *) user_data;
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get (); GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
GdkDragContext *drag = GDK_DRAG_CONTEXT (getdata->base.opaque_context); GdkDrag *drag = GDK_DRAG (getdata->base.opaque_context);
gpointer ddd = g_hash_table_lookup (clipdrop->active_source_drags, drag); gpointer ddd = g_hash_table_lookup (clipdrop->active_source_drags, drag);
GDK_NOTE (DND, g_print ("idataobject_getdata will request target 0x%p (%s)", GDK_NOTE (DND, g_print ("idataobject_getdata will request target 0x%p (%s)",
@ -610,7 +610,7 @@ get_data_response (gpointer user_data)
if (stream) if (stream)
{ {
getdata->stream = GDK_WIN32_HDATA_OUTPUT_STREAM (stream); getdata->stream = GDK_WIN32_HDATA_OUTPUT_STREAM (stream);
gdk_drag_context_write_async (drag, gdk_drag_write_async (drag,
getdata->pair.contentformat, getdata->pair.contentformat,
stream, stream,
G_PRIORITY_DEFAULT, G_PRIORITY_DEFAULT,
@ -721,16 +721,16 @@ typedef enum {
static gboolean use_ole2_dnd = TRUE; static gboolean use_ole2_dnd = TRUE;
static gboolean drag_context_grab (GdkDragContext *drag); static gboolean drag_context_grab (GdkDrag *drag);
G_DEFINE_TYPE (GdkWin32DragContext, gdk_win32_drag_context, GDK_TYPE_DRAG_CONTEXT) G_DEFINE_TYPE (GdkWin32Drag, gdk_win32_drag, GDK_TYPE_DRAG)
static void static void
move_drag_surface (GdkDragContext *drag, move_drag_surface (GdkDrag *drag,
guint x_root, guint x_root,
guint y_root) guint y_root)
{ {
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
g_assert (_win32_main_thread == NULL || g_assert (_win32_main_thread == NULL ||
_win32_main_thread == g_thread_self ()); _win32_main_thread == g_thread_self ());
@ -742,7 +742,7 @@ move_drag_surface (GdkDragContext *drag,
} }
static void static void
gdk_win32_drag_context_init (GdkWin32DragContext *drag) gdk_win32_drag_init (GdkWin32Drag *drag)
{ {
g_assert (_win32_main_thread == NULL || g_assert (_win32_main_thread == NULL ||
_win32_main_thread == g_thread_self ()); _win32_main_thread == g_thread_self ());
@ -750,32 +750,32 @@ gdk_win32_drag_context_init (GdkWin32DragContext *drag)
drag->handle_events = TRUE; drag->handle_events = TRUE;
drag->dest_window = INVALID_HANDLE_VALUE; drag->dest_window = INVALID_HANDLE_VALUE;
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_init %p\n", drag)); GDK_NOTE (DND, g_print ("gdk_win32_drag_init %p\n", drag));
} }
static void static void
gdk_win32_drag_context_finalize (GObject *object) gdk_win32_drag_finalize (GObject *object)
{ {
GdkDragContext *drag; GdkDrag *drag;
GdkWin32DragContext *drag_win32; GdkWin32Drag *drag_win32;
GdkSurface *drag_surface; GdkSurface *drag_surface;
g_assert (_win32_main_thread == NULL || g_assert (_win32_main_thread == NULL ||
_win32_main_thread == g_thread_self ()); _win32_main_thread == g_thread_self ());
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_finalize %p\n", object)); GDK_NOTE (DND, g_print ("gdk_win32_drag_finalize %p\n", object));
g_return_if_fail (GDK_IS_WIN32_DRAG_CONTEXT (object)); g_return_if_fail (GDK_IS_WIN32_DRAG (object));
drag = GDK_DRAG_CONTEXT (object); drag = GDK_DRAG (object);
drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); drag_win32 = GDK_WIN32_DRAG (drag);
gdk_drag_context_set_cursor (drag, NULL); gdk_drag_set_cursor (drag, NULL);
g_set_object (&drag_win32->grab_surface, NULL); g_set_object (&drag_win32->grab_surface, NULL);
drag_surface = drag_win32->drag_surface; drag_surface = drag_win32->drag_surface;
G_OBJECT_CLASS (gdk_win32_drag_context_parent_class)->finalize (object); G_OBJECT_CLASS (gdk_win32_drag_parent_class)->finalize (object);
if (drag_surface) if (drag_surface)
gdk_surface_destroy (drag_surface); gdk_surface_destroy (drag_surface);
@ -783,30 +783,30 @@ gdk_win32_drag_context_finalize (GObject *object)
/* Drag Contexts */ /* Drag Contexts */
static GdkDragContext * static GdkDrag *
gdk_drag_context_new (GdkDisplay *display, gdk_drag_new (GdkDisplay *display,
GdkContentProvider *content, GdkContentProvider *content,
GdkDragAction actions, GdkDragAction actions,
GdkDevice *device, GdkDevice *device,
GdkDragProtocol protocol) GdkDragProtocol protocol)
{ {
GdkWin32DragContext *drag_win32; GdkWin32Drag *drag_win32;
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display); GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
GdkDragContext *drag; GdkDrag *drag;
drag_win32 = g_object_new (GDK_TYPE_WIN32_DRAG_CONTEXT, drag_win32 = g_object_new (GDK_TYPE_WIN32_DRAG,
"device", device, "device", device,
"content", content, "content", content,
NULL); NULL);
drag = GDK_DRAG_CONTEXT (drag_win32); drag = GDK_DRAG (drag_win32);
if (win32_display->has_fixed_scale) if (win32_display->has_fixed_scale)
drag_win32->scale = win32_display->surface_scale; drag_win32->scale = win32_display->surface_scale;
else else
drag_win32->scale = _gdk_win32_display_get_monitor_scale_factor (win32_display, NULL, NULL, NULL); drag_win32->scale = _gdk_win32_display_get_monitor_scale_factor (win32_display, NULL, NULL, NULL);
gdk_drag_context_set_actions (drag, actions, actions); gdk_drag_set_actions (drag, actions, actions);
drag_win32->protocol = protocol; drag_win32->protocol = protocol;
return drag; return drag;
@ -828,15 +828,15 @@ gdk_drag_context_new (GdkDisplay *display,
static enum_formats *enum_formats_new (GArray *formats); static enum_formats *enum_formats_new (GArray *formats);
/* Finds a GdkDragContext object that corresponds to a DnD operation /* Finds a GdkDrag object that corresponds to a DnD operation
* which is currently targetting the dest_window * which is currently targetting the dest_window
* Does not give a reference. * Does not give a reference.
*/ */
GdkDragContext * GdkDrag *
_gdk_win32_find_drag_for_dest_window (HWND dest_window) _gdk_win32_find_drag_for_dest_window (HWND dest_window)
{ {
GHashTableIter iter; GHashTableIter iter;
GdkWin32DragContext *drag_win32; GdkWin32Drag *drag_win32;
GdkWin32DnDThreadDoDragDrop *ddd; GdkWin32DnDThreadDoDragDrop *ddd;
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get (); GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
@ -844,7 +844,7 @@ _gdk_win32_find_drag_for_dest_window (HWND dest_window)
while (g_hash_table_iter_next (&iter, (gpointer *) &drag_win32, (gpointer *) &ddd)) while (g_hash_table_iter_next (&iter, (gpointer *) &drag_win32, (gpointer *) &ddd))
if (ddd->src_context->dest_window_handle == dest_window) if (ddd->src_context->dest_window_handle == dest_window)
return GDK_DRAG_CONTEXT (drag_win32); return GDK_DRAG (drag_win32);
return NULL; return NULL;
} }
@ -888,7 +888,7 @@ static gboolean
notify_dnd_enter (gpointer user_data) notify_dnd_enter (gpointer user_data)
{ {
GdkWin32DnDEnterLeaveNotify *notify = (GdkWin32DnDEnterLeaveNotify *) user_data; GdkWin32DnDEnterLeaveNotify *notify = (GdkWin32DnDEnterLeaveNotify *) user_data;
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (notify->opaque_context); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (notify->opaque_context);
drag_win32->dest_window = notify->target_window_handle; drag_win32->dest_window = notify->target_window_handle;
@ -901,7 +901,7 @@ static gboolean
notify_dnd_leave (gpointer user_data) notify_dnd_leave (gpointer user_data)
{ {
GdkWin32DnDEnterLeaveNotify *notify = (GdkWin32DnDEnterLeaveNotify *) user_data; GdkWin32DnDEnterLeaveNotify *notify = (GdkWin32DnDEnterLeaveNotify *) user_data;
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (notify->opaque_context); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (notify->opaque_context);
if (notify->target_window_handle != drag_win32->dest_window) if (notify->target_window_handle != drag_win32->dest_window)
g_warning ("DnD leave says that the window handle is 0x%p, but drag has 0x%p", notify->target_window_handle, drag_win32->dest_window); g_warning ("DnD leave says that the window handle is 0x%p, but drag has 0x%p", notify->target_window_handle, drag_win32->dest_window);
@ -998,7 +998,7 @@ idropsource_queryinterface (LPDROPSOURCE This,
static gboolean static gboolean
unref_context_in_main_thread (gpointer opaque_context) unref_context_in_main_thread (gpointer opaque_context)
{ {
GdkDragContext *drag = GDK_DRAG_CONTEXT (opaque_context); GdkDrag *drag = GDK_DRAG (opaque_context);
g_clear_object (&drag); g_clear_object (&drag);
@ -1066,21 +1066,21 @@ idropsource_querycontinuedrag (LPDROPSOURCE This,
} }
static void static void
maybe_emit_action_changed (GdkWin32DragContext *drag_win32, maybe_emit_action_changed (GdkWin32Drag *drag_win32,
GdkDragAction actions) GdkDragAction actions)
{ {
if (actions != drag_win32->current_action) if (actions != drag_win32->current_action)
{ {
drag_win32->current_action = actions; drag_win32->current_action = actions;
g_signal_emit_by_name (GDK_DRAG_CONTEXT (drag_win32), "action-changed", actions); g_signal_emit_by_name (GDK_DRAG (drag_win32), "action-changed", actions);
} }
} }
void void
_gdk_win32_local_drag_give_feedback (GdkDragContext *drag, _gdk_win32_local_drag_give_feedback (GdkDrag *drag,
GdkDragAction actions) GdkDragAction actions)
{ {
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
if (drag_win32->drag_status == GDK_DRAG_STATUS_MOTION_WAIT) if (drag_win32->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
drag_win32->drag_status = GDK_DRAG_STATUS_DRAG; drag_win32->drag_status = GDK_DRAG_STATUS_DRAG;
@ -1101,8 +1101,8 @@ give_feedback (gpointer user_data)
if (ddd) if (ddd)
{ {
GdkDragContext *drag = GDK_DRAG_CONTEXT (feedback->base.opaque_context); GdkDrag *drag = GDK_DRAG (feedback->base.opaque_context);
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GDK_NOTE (DND, g_print ("gdk_dnd_handle_drag_status: 0x%p\n", GDK_NOTE (DND, g_print ("gdk_dnd_handle_drag_status: 0x%p\n",
drag)); drag));
@ -1587,13 +1587,13 @@ static IEnumFORMATETCVtbl ief_vtbl = {
}; };
static source_drag_context * static source_drag_context *
source_context_new (GdkDragContext *drag, source_context_new (GdkDrag *drag,
GdkContentFormats *formats) GdkContentFormats *formats)
{ {
GdkWin32DragContext *drag_win32; GdkWin32Drag *drag_win32;
source_drag_context *result; source_drag_context *result;
drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); drag_win32 = GDK_WIN32_DRAG (drag);
result = g_new0 (source_drag_context, 1); result = g_new0 (source_drag_context, 1);
result->drag = g_object_ref (drag); result->drag = g_object_ref (drag);
@ -1611,7 +1611,7 @@ source_context_new (GdkDragContext *drag,
} }
static data_object * static data_object *
data_object_new (GdkDragContext *drag) data_object_new (GdkDrag *drag)
{ {
data_object *result; data_object *result;
const char * const *mime_types; const char * const *mime_types;
@ -1624,7 +1624,7 @@ data_object_new (GdkDragContext *drag)
result->drag = drag; result->drag = drag;
result->formats = g_array_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair)); result->formats = g_array_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair));
mime_types = gdk_content_formats_get_mime_types (gdk_drag_context_get_formats (drag), &n_mime_types); mime_types = gdk_content_formats_get_mime_types (gdk_drag_get_formats (drag), &n_mime_types);
for (i = 0; i < n_mime_types; i++) for (i = 0; i < n_mime_types; i++)
{ {
@ -1701,7 +1701,7 @@ create_drag_surface (GdkDisplay *display)
return surface; return surface;
} }
GdkDragContext * GdkDrag *
_gdk_win32_surface_drag_begin (GdkSurface *surface, _gdk_win32_surface_drag_begin (GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkContentProvider *content, GdkContentProvider *content,
@ -1709,19 +1709,19 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
gint dx, gint dx,
gint dy) gint dy)
{ {
GdkDragContext *drag; GdkDrag *drag;
GdkWin32DragContext *drag_win32; GdkWin32Drag *drag_win32;
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get (); GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
int x_root, y_root; int x_root, y_root;
g_return_val_if_fail (surface != NULL, NULL); g_return_val_if_fail (surface != NULL, NULL);
drag = gdk_drag_context_new (gdk_surface_get_display (surface), drag = gdk_drag_new (gdk_surface_get_display (surface),
content, content,
actions, actions,
device, device,
use_ole2_dnd ? GDK_DRAG_PROTO_OLE2 : GDK_DRAG_PROTO_LOCAL); use_ole2_dnd ? GDK_DRAG_PROTO_OLE2 : GDK_DRAG_PROTO_LOCAL);
drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); drag_win32 = GDK_WIN32_DRAG (drag);
g_set_object (&drag->source_surface, surface); g_set_object (&drag->source_surface, surface);
@ -1752,8 +1752,7 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
source_drag_context *source_ctx; source_drag_context *source_ctx;
data_object *data_obj; data_object *data_obj;
source_ctx = source_context_new (drag, source_ctx = source_context_new (drag, gdk_drag_get_formats (drag));
gdk_drag_context_get_formats (drag));
data_obj = data_object_new (drag); data_obj = data_object_new (drag);
ddd->base.item_type = GDK_WIN32_DND_THREAD_QUEUE_ITEM_DO_DRAG_DROP; ddd->base.item_type = GDK_WIN32_DND_THREAD_QUEUE_ITEM_DO_DRAG_DROP;
@ -1830,12 +1829,12 @@ find_window_enum_proc (HWND hwnd,
* drop targets about drags that move over them. * drop targets about drags that move over them.
*/ */
static HWND static HWND
gdk_win32_drag_context_find_window (GdkDragContext *drag, gdk_win32_drag_find_window (GdkDrag *drag,
GdkSurface *drag_surface, GdkSurface *drag_surface,
gint x_root, gint x_root,
gint y_root) gint y_root)
{ {
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
find_window_enum_arg a; find_window_enum_arg a;
HWND result; HWND result;
@ -1848,14 +1847,14 @@ gdk_win32_drag_context_find_window (GdkDragContext *drag,
a.result = INVALID_HANDLE_VALUE; a.result = INVALID_HANDLE_VALUE;
GDK_NOTE (DND, GDK_NOTE (DND,
g_print ("gdk_win32_drag_context_find_window: %p %+d%+d\n", g_print ("gdk_win32_drag_find_window: %p %+d%+d\n",
(drag_surface ? GDK_SURFACE_HWND (drag_surface) : NULL), (drag_surface ? GDK_SURFACE_HWND (drag_surface) : NULL),
a.x, a.y)); a.x, a.y));
EnumWindows (find_window_enum_proc, (LPARAM) &a); EnumWindows (find_window_enum_proc, (LPARAM) &a);
GDK_NOTE (DND, GDK_NOTE (DND,
g_print ("gdk_win32_drag_context_find_window: %p %+d%+d: %p\n", g_print ("gdk_win32_drag_find_window: %p %+d%+d: %p\n",
(drag_surface ? GDK_SURFACE_HWND (drag_surface) : NULL), (drag_surface ? GDK_SURFACE_HWND (drag_surface) : NULL),
x_root, y_root, x_root, y_root,
a.result)); a.result));
@ -1900,7 +1899,7 @@ _gdk_win32_get_drop_for_dest_window (HWND dest_window)
} }
static gboolean static gboolean
gdk_win32_local_drag_motion (GdkDragContext *drag, gdk_win32_local_drag_motion (GdkDrag *drag,
HWND dest_window, HWND dest_window,
gint x_root, gint x_root,
gint y_root, gint y_root,
@ -1908,7 +1907,7 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
DWORD key_state, DWORD key_state,
guint32 time_) guint32 time_)
{ {
GdkWin32DragContext *drag_win32; GdkWin32Drag *drag_win32;
GdkDrop *drop; GdkDrop *drop;
GdkDragAction actions; GdkDragAction actions;
@ -1917,11 +1916,11 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
g_return_val_if_fail (drag != NULL, FALSE); g_return_val_if_fail (drag != NULL, FALSE);
drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); drag_win32 = GDK_WIN32_DRAG (drag);
drop = _gdk_win32_get_drop_for_dest_window (drag_win32->dest_window); drop = _gdk_win32_get_drop_for_dest_window (drag_win32->dest_window);
actions = gdk_drag_context_get_actions (drag); actions = gdk_drag_get_actions (drag);
GDK_NOTE (DND, g_print ("gdk_win32_local_drag_motion: @ %+d:%+d possible=%s\n" GDK_NOTE (DND, g_print ("gdk_win32_local_drag_motion: @ %+d:%+d possible=%s\n"
" dest=%p (current %p) drop=%p drag=%p:{actions=%s,suggested=%s,action=%s}\n", " dest=%p (current %p) drop=%p drag=%p:{actions=%s,suggested=%s,action=%s}\n",
@ -1929,7 +1928,7 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
_gdk_win32_drag_action_to_string (possible_actions), _gdk_win32_drag_action_to_string (possible_actions),
dest_window, drag_win32->dest_window, drop, drag, dest_window, drag_win32->dest_window, drop, drag,
_gdk_win32_drag_action_to_string (actions), _gdk_win32_drag_action_to_string (actions),
_gdk_win32_drag_action_to_string (gdk_drag_context_get_suggested_action (drag)), _gdk_win32_drag_action_to_string (gdk_drag_get_suggested_action (drag)),
_gdk_win32_drag_action_to_string (drag->action))); _gdk_win32_drag_action_to_string (drag->action)));
if (drag_win32->dest_window != dest_window) if (drag_win32->dest_window != dest_window)
@ -1962,7 +1961,7 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
drag_win32->drag_status == GDK_DRAG_STATUS_DRAG && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG &&
_gdk_win32_local_drop_target_will_emit_motion (drop, x_root, y_root, key_state)) _gdk_win32_local_drop_target_will_emit_motion (drop, x_root, y_root, key_state))
{ {
actions = gdk_drag_context_get_actions (drag); actions = gdk_drag_get_actions (drag);
drag_win32->drag_status = GDK_DRAG_STATUS_MOTION_WAIT; drag_win32->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
_gdk_win32_local_drop_target_dragover (drop, drag, x_root, y_root, key_state, time_, &actions); _gdk_win32_local_drop_target_dragover (drop, drag, x_root, y_root, key_state, time_, &actions);
@ -1974,31 +1973,31 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
" drag=%p:{actions=%s,suggested=%s,action=%s}\n", " drag=%p:{actions=%s,suggested=%s,action=%s}\n",
(drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG) ? "TRUE" : "FALSE", (drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG) ? "TRUE" : "FALSE",
drag, drag,
_gdk_win32_drag_action_to_string (gdk_drag_context_get_actions (drag)), _gdk_win32_drag_action_to_string (gdk_drag_get_actions (drag)),
_gdk_win32_drag_action_to_string (gdk_drag_context_get_suggested_action (drag)), _gdk_win32_drag_action_to_string (gdk_drag_get_suggested_action (drag)),
_gdk_win32_drag_action_to_string (drag->action))); _gdk_win32_drag_action_to_string (drag->action)));
return (drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG); return (drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG);
} }
static void static void
send_source_state_update (GdkWin32Clipdrop *clipdrop, send_source_state_update (GdkWin32Clipdrop *clipdrop,
GdkWin32DragContext *context_win32, GdkWin32Drag *drag_win32,
gpointer *ddd) gpointer *ddd)
{ {
GdkWin32DnDThreadUpdateDragState *status = g_new0 (GdkWin32DnDThreadUpdateDragState, 1); GdkWin32DnDThreadUpdateDragState *status = g_new0 (GdkWin32DnDThreadUpdateDragState, 1);
status->base.item_type = GDK_WIN32_DND_THREAD_QUEUE_ITEM_UPDATE_DRAG_STATE; status->base.item_type = GDK_WIN32_DND_THREAD_QUEUE_ITEM_UPDATE_DRAG_STATE;
status->opaque_ddd = ddd; status->opaque_ddd = ddd;
status->produced_util_data = context_win32->util_data; status->produced_util_data = drag_win32->util_data;
increment_dnd_queue_counter (); increment_dnd_queue_counter ();
g_async_queue_push (clipdrop->dnd_queue, status); g_async_queue_push (clipdrop->dnd_queue, status);
API_CALL (PostThreadMessage, (clipdrop->dnd_thread_id, thread_wakeup_message, 0, 0)); API_CALL (PostThreadMessage, (clipdrop->dnd_thread_id, thread_wakeup_message, 0, 0));
} }
static void static void
gdk_win32_drag_context_drag_drop (GdkDragContext *drag, gdk_win32_drag_drop (GdkDrag *drag,
guint32 time_) guint32 time_)
{ {
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get (); GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
g_assert (_win32_main_thread == NULL || g_assert (_win32_main_thread == NULL ||
@ -2006,7 +2005,7 @@ gdk_win32_drag_context_drag_drop (GdkDragContext *drag,
g_return_if_fail (drag != NULL); g_return_if_fail (drag != NULL);
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_drag_drop\n")); GDK_NOTE (DND, g_print ("gdk_win32_drag_drop\n"));
if (drag_win32->protocol == GDK_DRAG_PROTO_LOCAL) if (drag_win32->protocol == GDK_DRAG_PROTO_LOCAL)
{ {
@ -2016,10 +2015,10 @@ gdk_win32_drag_context_drag_drop (GdkDragContext *drag,
{ {
GdkDragAction actions; GdkDragAction actions;
actions = gdk_drag_context_get_actions (drag); actions = gdk_drag_get_actions (drag);
_gdk_win32_local_drop_target_drop (drop, drag, time_, &actions); _gdk_win32_local_drop_target_drop (drop, drag, time_, &actions);
maybe_emit_action_changed (drag_win32, actions); maybe_emit_action_changed (drag_win32, actions);
_gdk_win32_local_drag_context_drop_response (drag, actions); _gdk_win32_local_drag_drop_response (drag, actions);
} }
} }
else if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2) else if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2)
@ -2034,10 +2033,10 @@ gdk_win32_drag_context_drag_drop (GdkDragContext *drag,
} }
static void static void
gdk_win32_drag_context_drag_abort (GdkDragContext *drag, gdk_win32_drag_abort (GdkDrag *drag,
guint32 time_) guint32 time_)
{ {
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get (); GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
g_assert (_win32_main_thread == NULL || g_assert (_win32_main_thread == NULL ||
@ -2045,7 +2044,7 @@ gdk_win32_drag_context_drag_abort (GdkDragContext *drag,
g_return_if_fail (drag != NULL); g_return_if_fail (drag != NULL);
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_drag_abort\n")); GDK_NOTE (DND, g_print ("gdk_win32_drag_abort\n"));
if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2) if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2)
{ {
@ -2059,12 +2058,12 @@ gdk_win32_drag_context_drag_abort (GdkDragContext *drag,
} }
static void static void
gdk_win32_drag_context_set_cursor (GdkDragContext *drag, gdk_win32_drag_set_cursor (GdkDrag *drag,
GdkCursor *cursor) GdkCursor *cursor)
{ {
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_set_cursor: 0x%p 0x%p\n", drag, cursor)); GDK_NOTE (DND, g_print ("gdk_win32_drag_set_cursor: 0x%p 0x%p\n", drag, cursor));
if (!g_set_object (&drag_win32->cursor, cursor)) if (!g_set_object (&drag_win32->cursor, cursor))
return; return;
@ -2092,7 +2091,7 @@ ease_out_cubic (double t)
typedef struct _GdkDragAnim GdkDragAnim; typedef struct _GdkDragAnim GdkDragAnim;
struct _GdkDragAnim { struct _GdkDragAnim {
GdkWin32DragContext *drag; GdkWin32Drag *drag;
GdkFrameClock *frame_clock; GdkFrameClock *frame_clock;
gint64 start_time; gint64 start_time;
}; };
@ -2108,7 +2107,7 @@ static gboolean
gdk_drag_anim_timeout (gpointer data) gdk_drag_anim_timeout (gpointer data)
{ {
GdkDragAnim *anim = data; GdkDragAnim *anim = data;
GdkWin32DragContext *drag = anim->drag; GdkWin32Drag *drag = anim->drag;
GdkFrameClock *frame_clock = anim->frame_clock; GdkFrameClock *frame_clock = anim->frame_clock;
gint64 current_time; gint64 current_time;
double f; double f;
@ -2136,10 +2135,10 @@ gdk_drag_anim_timeout (gpointer data)
} }
static void static void
gdk_win32_drag_context_drop_done (GdkDragContext *drag, gdk_win32_drag_drop_done (GdkDrag *drag,
gboolean success) gboolean success)
{ {
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkDragAnim *anim; GdkDragAnim *anim;
/* /*
cairo_surface_t *win_surface; cairo_surface_t *win_surface;
@ -2148,7 +2147,7 @@ gdk_win32_drag_context_drop_done (GdkDragContext *drag,
*/ */
guint id; guint id;
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_drop_done: 0x%p %s\n", GDK_NOTE (DND, g_print ("gdk_win32_drag_drop_done: 0x%p %s\n",
drag, drag,
success ? "dropped successfully" : "dropped unsuccessfully")); success ? "dropped successfully" : "dropped unsuccessfully"));
@ -2207,7 +2206,7 @@ gdk_win32_drag_context_drop_done (GdkDragContext *drag,
anim->frame_clock = gdk_surface_get_frame_clock (drag_win32->drag_surface); anim->frame_clock = gdk_surface_get_frame_clock (drag_win32->drag_surface);
anim->start_time = gdk_frame_clock_get_frame_time (anim->frame_clock); anim->start_time = gdk_frame_clock_get_frame_time (anim->frame_clock);
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_drop_done: animate the drag window from %d : %d to %d : %d\n", GDK_NOTE (DND, g_print ("gdk_win32_drag_drop_done: animate the drag window from %d : %d to %d : %d\n",
drag_win32->util_data.last_x, drag_win32->util_data.last_y, drag_win32->util_data.last_x, drag_win32->util_data.last_y,
drag_win32->start_x, drag_win32->start_y)); drag_win32->start_x, drag_win32->start_y));
@ -2218,9 +2217,9 @@ gdk_win32_drag_context_drop_done (GdkDragContext *drag,
} }
static gboolean static gboolean
drag_context_grab (GdkDragContext *drag) drag_context_grab (GdkDrag *drag)
{ {
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkSeatCapabilities capabilities; GdkSeatCapabilities capabilities;
GdkSeat *seat; GdkSeat *seat;
GdkCursor *cursor; GdkCursor *cursor;
@ -2232,11 +2231,11 @@ drag_context_grab (GdkDragContext *drag)
if (!drag_win32->grab_surface) if (!drag_win32->grab_surface)
return FALSE; return FALSE;
seat = gdk_device_get_seat (gdk_drag_context_get_device (drag)); seat = gdk_device_get_seat (gdk_drag_get_device (drag));
capabilities = GDK_SEAT_CAPABILITY_ALL; capabilities = GDK_SEAT_CAPABILITY_ALL;
cursor = gdk_drag_get_cursor (drag, gdk_drag_context_get_selected_action (drag)); cursor = gdk_drag_get_cursor (drag, gdk_drag_get_selected_action (drag));
g_set_object (&drag_win32->cursor, cursor); g_set_object (&drag_win32->cursor, cursor);
if (gdk_seat_grab (seat, drag_win32->grab_surface, if (gdk_seat_grab (seat, drag_win32->grab_surface,
@ -2252,9 +2251,9 @@ drag_context_grab (GdkDragContext *drag)
} }
static void static void
drag_context_ungrab (GdkDragContext *drag) drag_context_ungrab (GdkDrag *drag)
{ {
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GDK_NOTE (DND, g_print ("drag_context_ungrab: 0x%p 0x%p\n", GDK_NOTE (DND, g_print ("drag_context_ungrab: 0x%p 0x%p\n",
drag, drag,
@ -2271,10 +2270,10 @@ drag_context_ungrab (GdkDragContext *drag)
} }
static void static void
gdk_win32_drag_context_cancel (GdkDragContext *drag, gdk_win32_drag_cancel (GdkDrag *drag,
GdkDragCancelReason reason) GdkDragCancelReason reason)
{ {
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
const gchar *reason_str = NULL; const gchar *reason_str = NULL;
switch (reason) switch (reason)
@ -2293,7 +2292,7 @@ gdk_win32_drag_context_cancel (GdkDragContext *drag,
break; break;
} }
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_cancel: 0x%p %s\n", GDK_NOTE (DND, g_print ("gdk_win32_drag_cancel: 0x%p %s\n",
drag, drag,
reason_str)); reason_str));
@ -2305,20 +2304,20 @@ gdk_win32_drag_context_cancel (GdkDragContext *drag,
drop = NULL; drop = NULL;
} }
gdk_drag_context_set_cursor (drag, NULL); gdk_drag_set_cursor (drag, NULL);
drag_context_ungrab (drag); drag_context_ungrab (drag);
gdk_drag_drop_done (drag, FALSE); gdk_drag_drop_done (drag, FALSE);
} }
static void static void
gdk_win32_drag_context_drop_performed (GdkDragContext *drag, gdk_win32_drag_drop_performed (GdkDrag *drag,
guint32 time_) guint32 time_)
{ {
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_drop_performed: 0x%p %u\n", GDK_NOTE (DND, g_print ("gdk_win32_drag_drop_performed: 0x%p %u\n",
drag, drag,
time_)); time_));
gdk_drag_drop (drag, time_); gdk_drag_drop (drag, time_);
gdk_drag_context_set_cursor (drag, NULL); gdk_drag_set_cursor (drag, NULL);
drag_context_ungrab (drag); drag_context_ungrab (drag);
} }
@ -2326,33 +2325,33 @@ gdk_win32_drag_context_drop_performed (GdkDragContext *drag,
#define SMALL_STEP 1 #define SMALL_STEP 1
static void static void
gdk_local_drag_update (GdkDragContext *drag, gdk_local_drag_update (GdkDrag *drag,
gdouble x_root, gdouble x_root,
gdouble y_root, gdouble y_root,
DWORD grfKeyState, DWORD grfKeyState,
guint32 evtime) guint32 evtime)
{ {
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
HWND dest_window; HWND dest_window;
g_assert (_win32_main_thread == NULL || g_assert (_win32_main_thread == NULL ||
_win32_main_thread == g_thread_self ()); _win32_main_thread == g_thread_self ());
dest_window = gdk_win32_drag_context_find_window (drag, dest_window = gdk_win32_drag_find_window (drag,
drag_win32->drag_surface, drag_win32->drag_surface,
x_root, y_root); x_root, y_root);
gdk_win32_local_drag_motion (drag, dest_window, x_root, y_root, gdk_win32_local_drag_motion (drag, dest_window, x_root, y_root,
gdk_drag_context_get_actions (drag), gdk_drag_get_actions (drag),
grfKeyState, evtime); grfKeyState, evtime);
} }
static gboolean static gboolean
gdk_dnd_handle_motion_event (GdkDragContext *drag, gdk_dnd_handle_motion_event (GdkDrag *drag,
const GdkEventMotion *event) const GdkEventMotion *event)
{ {
GdkModifierType state; GdkModifierType state;
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
DWORD key_state; DWORD key_state;
if (!gdk_event_get_state ((GdkEvent *) event, &state)) if (!gdk_event_get_state ((GdkEvent *) event, &state))
@ -2391,10 +2390,10 @@ gdk_dnd_handle_motion_event (GdkDragContext *drag,
} }
static gboolean static gboolean
gdk_dnd_handle_key_event (GdkDragContext *drag, gdk_dnd_handle_key_event (GdkDrag *drag,
const GdkEventKey *event) const GdkEventKey *event)
{ {
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkModifierType state; GdkModifierType state;
GdkDevice *pointer; GdkDevice *pointer;
gint dx, dy; gint dx, dy;
@ -2413,7 +2412,7 @@ gdk_dnd_handle_key_event (GdkDragContext *drag,
switch (event->keyval) switch (event->keyval)
{ {
case GDK_KEY_Escape: case GDK_KEY_Escape:
gdk_drag_context_cancel (drag, GDK_DRAG_CANCEL_USER_CANCELLED); gdk_drag_cancel (drag, GDK_DRAG_CANCEL_USER_CANCELLED);
return TRUE; return TRUE;
case GDK_KEY_space: case GDK_KEY_space:
@ -2421,13 +2420,13 @@ gdk_dnd_handle_key_event (GdkDragContext *drag,
case GDK_KEY_ISO_Enter: case GDK_KEY_ISO_Enter:
case GDK_KEY_KP_Enter: case GDK_KEY_KP_Enter:
case GDK_KEY_KP_Space: case GDK_KEY_KP_Space:
if ((gdk_drag_context_get_selected_action (drag) != 0) && if ((gdk_drag_get_selected_action (drag) != 0) &&
(drag_win32->dest_window != INVALID_HANDLE_VALUE)) (drag_win32->dest_window != INVALID_HANDLE_VALUE))
{ {
g_signal_emit_by_name (drag, "drop-performed"); g_signal_emit_by_name (drag, "drop-performed");
} }
else else
gdk_drag_context_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET); gdk_drag_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
return TRUE; return TRUE;
@ -2477,10 +2476,10 @@ gdk_dnd_handle_key_event (GdkDragContext *drag,
} }
static gboolean static gboolean
gdk_dnd_handle_grab_broken_event (GdkDragContext *drag, gdk_dnd_handle_grab_broken_event (GdkDrag *drag,
const GdkEventGrabBroken *event) const GdkEventGrabBroken *event)
{ {
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GDK_NOTE (DND, g_print ("gdk_dnd_handle_grab_broken_event: 0x%p\n", GDK_NOTE (DND, g_print ("gdk_dnd_handle_grab_broken_event: 0x%p\n",
drag)); drag));
@ -2495,15 +2494,15 @@ gdk_dnd_handle_grab_broken_event (GdkDragContext *drag,
return FALSE; return FALSE;
if (gdk_event_get_device ((GdkEvent *) event) != if (gdk_event_get_device ((GdkEvent *) event) !=
gdk_drag_context_get_device (drag)) gdk_drag_get_device (drag))
return FALSE; return FALSE;
gdk_drag_context_cancel (drag, GDK_DRAG_CANCEL_ERROR); gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR);
return TRUE; return TRUE;
} }
static gboolean static gboolean
gdk_dnd_handle_button_event (GdkDragContext *drag, gdk_dnd_handle_button_event (GdkDrag *drag,
const GdkEventButton *event) const GdkEventButton *event)
{ {
GDK_NOTE (DND, g_print ("gdk_dnd_handle_button_event: 0x%p\n", GDK_NOTE (DND, g_print ("gdk_dnd_handle_button_event: 0x%p\n",
@ -2515,22 +2514,22 @@ gdk_dnd_handle_button_event (GdkDragContext *drag,
return FALSE; return FALSE;
#endif #endif
if ((gdk_drag_context_get_selected_action (drag) != 0)) if ((gdk_drag_get_selected_action (drag) != 0))
{ {
g_signal_emit_by_name (drag, "drop-performed"); g_signal_emit_by_name (drag, "drop-performed");
} }
else else
gdk_drag_context_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET); gdk_drag_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
/* Make sure GTK gets mouse release button event */ /* Make sure GTK gets mouse release button event */
return FALSE; return FALSE;
} }
gboolean gboolean
gdk_win32_drag_context_handle_event (GdkDragContext *drag, gdk_win32_drag_handle_event (GdkDrag *drag,
const GdkEvent *event) const GdkEvent *event)
{ {
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
if (!drag_win32->grab_seat) if (!drag_win32->grab_seat)
return FALSE; return FALSE;
@ -2560,29 +2559,29 @@ gdk_win32_drag_context_handle_event (GdkDragContext *drag,
} }
void void
gdk_win32_drag_context_action_changed (GdkDragContext *drag, gdk_win32_drag_action_changed (GdkDrag *drag,
GdkDragAction action) GdkDragAction action)
{ {
GdkCursor *cursor; GdkCursor *cursor;
cursor = gdk_drag_get_cursor (drag, action); cursor = gdk_drag_get_cursor (drag, action);
gdk_drag_context_set_cursor (drag, cursor); gdk_drag_set_cursor (drag, cursor);
} }
static GdkSurface * static GdkSurface *
gdk_win32_drag_context_get_drag_surface (GdkDragContext *drag) gdk_win32_drag_get_drag_surface (GdkDrag *drag)
{ {
return GDK_WIN32_DRAG_CONTEXT (drag)->drag_surface; return GDK_WIN32_DRAG (drag)->drag_surface;
} }
static void static void
gdk_win32_drag_context_set_hotspot (GdkDragContext *drag, gdk_win32_drag_set_hotspot (GdkDrag *drag,
gint hot_x, gint hot_x,
gint hot_y) gint hot_y)
{ {
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag); GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GDK_NOTE (DND, g_print ("gdk_drag_context_set_hotspot: 0x%p %d:%d\n", GDK_NOTE (DND, g_print ("gdk_drag_set_hotspot: 0x%p %d:%d\n",
drag, drag,
hot_x, hot_y)); hot_x, hot_y));
@ -2597,23 +2596,22 @@ gdk_win32_drag_context_set_hotspot (GdkDragContext *drag,
} }
static void static void
gdk_win32_drag_context_class_init (GdkWin32DragContextClass *klass) gdk_win32_drag_class_init (GdkWin32DragClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass); GdkDragClass *drag_class = GDK_DRAG_CLASS (klass);
object_class->finalize = gdk_win32_drag_context_finalize; object_class->finalize = gdk_win32_drag_finalize;
context_class->drag_abort = gdk_win32_drag_context_drag_abort; drag_class->drag_abort = gdk_win32_drag_abort;
context_class->drag_drop = gdk_win32_drag_context_drag_drop; drag_class->drag_drop = gdk_win32_drag_drop;
context_class->get_drag_surface = gdk_win32_drag_context_get_drag_surface;
context_class->set_hotspot = gdk_win32_drag_context_set_hotspot;
context_class->drop_done = gdk_win32_drag_context_drop_done;
context_class->set_cursor = gdk_win32_drag_context_set_cursor;
context_class->cancel = gdk_win32_drag_context_cancel;
context_class->drop_performed = gdk_win32_drag_context_drop_performed;
context_class->handle_event = gdk_win32_drag_context_handle_event;
context_class->action_changed = gdk_win32_drag_context_action_changed;
drag_class->get_drag_surface = gdk_win32_drag_get_drag_surface;
drag_class->set_hotspot = gdk_win32_drag_set_hotspot;
drag_class->drop_done = gdk_win32_drag_drop_done;
drag_class->set_cursor = gdk_win32_drag_set_cursor;
drag_class->cancel = gdk_win32_drag_cancel;
drag_class->drop_performed = gdk_win32_drag_drop_performed;
drag_class->handle_event = gdk_win32_drag_handle_event;
drag_class->action_changed = gdk_win32_drag_action_changed;
} }

View File

@ -41,7 +41,7 @@
#include "gdkdropprivate.h" #include "gdkdropprivate.h"
#include "gdkdnd.h" #include "gdkdrag.h"
#include "gdkproperty.h" #include "gdkproperty.h"
#include "gdkinternals.h" #include "gdkinternals.h"
#include "gdkprivate-win32.h" #include "gdkprivate-win32.h"
@ -172,7 +172,7 @@ gdk_win32_drop_finalize (GObject *object)
static GdkDrop * static GdkDrop *
gdk_drop_new (GdkDisplay *display, gdk_drop_new (GdkDisplay *display,
GdkDevice *device, GdkDevice *device,
GdkDragContext *drag, GdkDrag *drag,
GdkContentFormats *formats, GdkContentFormats *formats,
GdkSurface *surface, GdkSurface *surface,
GdkDragProtocol protocol) GdkDragProtocol protocol)
@ -453,7 +453,7 @@ set_source_actions_helper (GdkDrop *drop,
} }
void void
_gdk_win32_local_drop_target_dragenter (GdkDragContext *drag, _gdk_win32_local_drop_target_dragenter (GdkDrag *drag,
GdkSurface *dest_surface, GdkSurface *dest_surface,
gint x_root, gint x_root,
gint y_root, gint y_root,
@ -478,7 +478,7 @@ _gdk_win32_local_drop_target_dragenter (GdkDragContext *drag,
drop = gdk_drop_new (display, drop = gdk_drop_new (display,
gdk_seat_get_pointer (gdk_display_get_default_seat (display)), gdk_seat_get_pointer (gdk_display_get_default_seat (display)),
drag, drag,
gdk_content_formats_ref (gdk_drag_context_get_formats (drag)), gdk_content_formats_ref (gdk_drag_get_formats (drag)),
dest_surface, dest_surface,
GDK_DRAG_PROTO_LOCAL); GDK_DRAG_PROTO_LOCAL);
drop_win32 = GDK_WIN32_DROP (drop); drop_win32 = GDK_WIN32_DROP (drop);
@ -518,7 +518,7 @@ idroptarget_dragenter (LPDROPTARGET This,
GdkDisplay *display; GdkDisplay *display;
gint pt_x; gint pt_x;
gint pt_y; gint pt_y;
GdkDragContext *drag; GdkDrag *drag;
GdkDragAction source_actions; GdkDragAction source_actions;
GdkDragAction dest_actions; GdkDragAction dest_actions;
@ -531,7 +531,7 @@ idroptarget_dragenter (LPDROPTARGET This,
g_clear_object (&ctx->drop); g_clear_object (&ctx->drop);
/* Try to find the GdkDragContext object for this DnD operation, /* Try to find the GdkDrag object for this DnD operation,
* if it originated in our own application. * if it originated in our own application.
*/ */
drag = NULL; drag = NULL;
@ -593,7 +593,7 @@ _gdk_win32_local_drop_target_will_emit_motion (GdkDrop *drop,
void void
_gdk_win32_local_drop_target_dragover (GdkDrop *drop, _gdk_win32_local_drop_target_dragover (GdkDrop *drop,
GdkDragContext *drag, GdkDrag *drag,
gint x_root, gint x_root,
gint y_root, gint y_root,
DWORD grfKeyState, DWORD grfKeyState,
@ -710,7 +710,7 @@ idroptarget_dragleave (LPDROPTARGET This)
void void
_gdk_win32_local_drop_target_drop (GdkDrop *drop, _gdk_win32_local_drop_target_drop (GdkDrop *drop,
GdkDragContext *drag, GdkDrag *drag,
guint32 time_, guint32 time_,
GdkDragAction *actions) GdkDragAction *actions)
{ {
@ -1065,7 +1065,7 @@ gdk_win32_drop_status (GdkDrop *drop,
GdkDragAction actions) GdkDragAction actions)
{ {
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop); GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
GdkDragContext *drag; GdkDrag *drag;
g_return_if_fail (drop != NULL); g_return_if_fail (drop != NULL);
@ -1090,7 +1090,7 @@ static void
gdk_win32_drop_finish (GdkDrop *drop, gdk_win32_drop_finish (GdkDrop *drop,
GdkDragAction action) GdkDragAction action)
{ {
GdkDragContext *drag; GdkDrag *drag;
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop); GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
g_return_if_fail (drop != NULL); g_return_if_fail (drop != NULL);
@ -1107,7 +1107,7 @@ gdk_win32_drop_finish (GdkDrop *drop,
drag = gdk_drop_get_drag (drop); drag = gdk_drop_get_drag (drop);
if (drag != NULL) if (drag != NULL)
_gdk_win32_local_drag_context_drop_response (drag, action); _gdk_win32_local_drag_drop_response (drag, action);
*/ */
} }

View File

@ -59,7 +59,7 @@
#include "gdkwin32dnd-private.h" #include "gdkwin32dnd-private.h"
#include "gdkdisplay-win32.h" #include "gdkdisplay-win32.h"
//#include "gdkselection-win32.h" //#include "gdkselection-win32.h"
#include "gdkdndprivate.h" #include "gdkdragprivate.h"
#include <windowsx.h> #include <windowsx.h>
@ -873,7 +873,7 @@ _gdk_win32_print_event (const GdkEvent *event)
if (event->dnd.drop != NULL) if (event->dnd.drop != NULL)
g_print ("ctx:%p: %s", g_print ("ctx:%p: %s",
event->dnd.drop, event->dnd.drop,
_gdk_win32_drag_protocol_to_string (GDK_WIN32_DRAG_CONTEXT (event->dnd.drop)->protocol)); _gdk_win32_drag_protocol_to_string (GDK_WIN32_DRAG (event->dnd.drop)->protocol));
break; break;
case GDK_SCROLL: case GDK_SCROLL:
g_print ("(%.4g,%.4g) (%.4g,%.4g) %s ", g_print ("(%.4g,%.4g) (%.4g,%.4g) %s ",

View File

@ -423,12 +423,12 @@ void _gdk_win32_display_create_surface_impl (GdkDisplay *display,
void _gdk_win32_surface_register_dnd (GdkSurface *window); void _gdk_win32_surface_register_dnd (GdkSurface *window);
void _gdk_win32_surface_unregister_dnd (GdkSurface *window); void _gdk_win32_surface_unregister_dnd (GdkSurface *window);
GdkDragContext *_gdk_win32_surface_drag_begin (GdkSurface *window, GdkDrag *_gdk_win32_surface_drag_begin (GdkSurface *window,
GdkDevice *device, GdkDevice *device,
GdkContentProvider *content, GdkContentProvider *content,
GdkDragAction actions, GdkDragAction actions,
gint x_root, gint x_root,
gint y_root); gint y_root);
/* Stray GdkWin32Screen members */ /* Stray GdkWin32Screen members */
gboolean _gdk_win32_get_setting (const gchar *name, GValue *value); gboolean _gdk_win32_get_setting (const gchar *name, GValue *value);

View File

@ -26,12 +26,12 @@
G_BEGIN_DECLS G_BEGIN_DECLS
typedef struct _GdkWin32DragContextUtilityData GdkWin32DragContextUtilityData; typedef struct _GdkWin32DragUtilityData GdkWin32DragUtilityData;
/* This structure is deliberately designed to be /* This structure is deliberately designed to be
* copyable with memcpy(), i.e. no pointers inside. * copyable with memcpy(), i.e. no pointers inside.
*/ */
struct _GdkWin32DragContextUtilityData struct _GdkWin32DragUtilityData
{ {
gint last_x; /* Coordinates from last event, in GDK space */ gint last_x; /* Coordinates from last event, in GDK space */
gint last_y; gint last_y;
@ -39,15 +39,15 @@ struct _GdkWin32DragContextUtilityData
GdkWin32DndState state; GdkWin32DndState state;
}; };
struct _GdkWin32DragContext struct _GdkWin32Drag
{ {
GdkDragContext drag; GdkDrag drag;
/* The drag protocol being used */ /* The drag protocol being used */
GdkDragProtocol protocol; GdkDragProtocol protocol;
/* The surface used for grabs. /* The surface used for grabs.
* Usually the same as GdkDragContext->source_surface * Usually the same as GdkDrag->source_surface
*/ */
GdkSurface *grab_surface; GdkSurface *grab_surface;
@ -71,7 +71,7 @@ struct _GdkWin32DragContext
*/ */
GdkDragAction current_action; GdkDragAction current_action;
GdkWin32DragContextUtilityData util_data; GdkWin32DragUtilityData util_data;
guint scale; /* Temporarily caches the HiDPI scale */ guint scale; /* Temporarily caches the HiDPI scale */
gint hot_x; /* Hotspot offset from the top-left of the drag-window, scaled (can be added to GDK space coordinates) */ gint hot_x; /* Hotspot offset from the top-left of the drag-window, scaled (can be added to GDK space coordinates) */
@ -84,23 +84,23 @@ struct _GdkWin32DragContext
guint handle_events : 1; /* Whether handle_event() should do anything */ guint handle_events : 1; /* Whether handle_event() should do anything */
}; };
struct _GdkWin32DragContextClass struct _GdkWin32DragClass
{ {
GdkDragContextClass parent_class; GdkDragClass parent_class;
}; };
gpointer _gdk_win32_dnd_thread_main (gpointer data); gpointer _gdk_win32_dnd_thread_main (gpointer data);
GdkDragContext *_gdk_win32_find_drag_for_dest_window (HWND dest_window); GdkDrag *_gdk_win32_find_drag_for_dest_window (HWND dest_window);
GdkDrop *_gdk_win32_get_drop_for_dest_surface (GdkSurface *dest); GdkDrop *_gdk_win32_get_drop_for_dest_surface (GdkSurface *dest);
gboolean _gdk_win32_local_drop_target_will_emit_motion (GdkDrop *drop, gboolean _gdk_win32_local_drop_target_will_emit_motion (GdkDrop *drop,
gint x_root, gint x_root,
gint y_root, gint y_root,
DWORD grfKeyState); DWORD grfKeyState);
void _gdk_win32_local_drop_target_dragenter (GdkDragContext *drag, void _gdk_win32_local_drop_target_dragenter (GdkDrag *drag,
GdkSurface *dest_surface, GdkSurface *dest_surface,
gint x_root, gint x_root,
gint y_root, gint y_root,
@ -108,22 +108,22 @@ void _gdk_win32_local_drop_target_dragenter (GdkDragContext *drag,
guint32 time_, guint32 time_,
GdkDragAction *actions); GdkDragAction *actions);
void _gdk_win32_local_drop_target_dragover (GdkDrop *drop, void _gdk_win32_local_drop_target_dragover (GdkDrop *drop,
GdkDragContext *drag, GdkDrag *drag,
gint x_root, gint x_root,
gint y_root, gint y_root,
DWORD grfKeyState, DWORD grfKeyState,
guint32 time_, guint32 time_,
GdkDragAction *actions); GdkDragAction *actions);
void _gdk_win32_local_drop_target_dragleave (GdkDrop *drop, void _gdk_win32_local_drop_target_dragleave (GdkDrop *drop,
guint32 time_); guint32 time_);
void _gdk_win32_local_drop_target_drop (GdkDrop *drop, void _gdk_win32_local_drop_target_drop (GdkDrop *drop,
GdkDragContext *drag, GdkDrag *drag,
guint32 time_, guint32 time_,
GdkDragAction *actions); GdkDragAction *actions);
void _gdk_win32_local_drag_give_feedback (GdkDragContext *drag, void _gdk_win32_local_drag_give_feedback (GdkDrag *drag,
GdkDragAction actions); GdkDragAction actions);
void _gdk_win32_local_drag_context_drop_response (GdkDragContext *drag, void _gdk_win32_local_drag_drop_response (GdkDrag *drag,
GdkDragAction action); GdkDragAction action);

View File

@ -26,23 +26,23 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define GDK_TYPE_WIN32_DRAG_CONTEXT (gdk_win32_drag_context_get_type ()) #define GDK_TYPE_WIN32_DRAG (gdk_win32_drag_get_type ())
#define GDK_WIN32_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WIN32_DRAG_CONTEXT, GdkWin32DragContext)) #define GDK_WIN32_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WIN32_DRAG, GdkWin32Drag))
#define GDK_WIN32_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_DRAG_CONTEXT, GdkWin32DragContextClass)) #define GDK_WIN32_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_DRAG, GdkWin32DragClass))
#define GDK_IS_WIN32_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WIN32_DRAG_CONTEXT)) #define GDK_IS_WIN32_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WIN32_DRAG))
#define GDK_IS_WIN32_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_DRAG_CONTEXT)) #define GDK_IS_WIN32_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_DRAG))
#define GDK_WIN32_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_DRAG_CONTEXT, GdkWin32DragContextClass)) #define GDK_WIN32_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_DRAG, GdkWin32DragClass))
#ifdef GDK_COMPILATION #ifdef GDK_COMPILATION
typedef struct _GdkWin32DragContext GdkWin32DragContext; typedef struct _GdkWin32Drag GdkWin32Drag;
#else #else
typedef GdkDragContext GdkWin32DragContext; typedef GdkDrag GdkWin32Drag;
#endif #endif
typedef struct _GdkWin32DragContextClass GdkWin32DragContextClass; typedef struct _GdkWin32DragClass GdkWin32DragClass;
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GType gdk_win32_drag_context_get_type (void); GType gdk_win32_drag_get_type (void);
G_END_DECLS G_END_DECLS
#endif /* __GDK_WIN32_DRAG_CONTEXT_H__ */ #endif /* __GDK_WIN32_DRAG_H__ */