summaryrefslogtreecommitdiff
path: root/gdk/win32
diff options
context:
space:
mode:
authorDieter Verfaillie <dieterv@optionexplicit.be>2011-09-22 22:47:23 +0200
committerAlexander Larsson <alexl@redhat.com>2011-11-21 14:34:06 +0100
commit2fb8b97b657c2690085957c9c7b6f547ca42265f (patch)
tree3ee6fb03edbc8de94647678b6e7b1b6cdca8f1e1 /gdk/win32
parentc533482f8014437b17c71fbab1a66df6fefd3e70 (diff)
downloadgtk+-2fb8b97b657c2690085957c9c7b6f547ca42265f.tar.gz
win32: get rid of GdkDragContextPrivateWin32 and related machinery.
This turns GdkWin32DragContext into a proper GdkDragContext subclass. Because we now correctly initialize GdkWin32DragContext in gdk_drag_context_new, we no longer crash immediatly when a DnD operation is initialized (the find_window, drag_status, ... vfuncs where all pointing to 0x0 instead of their proper win32 implementations). We now try to consistently refer to GdkDragContext as "context", GdkWin32DragContext as "win32_context" and the ole2 related target_drag_context and source_drag_context as "ctx". Members of GdkWin32DragContext only used by the ole2 DnD codepaths are now explicitly marked with a ole2_dnd_ prefix.
Diffstat (limited to 'gdk/win32')
-rw-r--r--gdk/win32/gdkdnd-win32.c245
1 files changed, 118 insertions, 127 deletions
diff --git a/gdk/win32/gdkdnd-win32.c b/gdk/win32/gdkdnd-win32.c
index e4dbd31a3e..e656f07b53 100644
--- a/gdk/win32/gdkdnd-win32.c
+++ b/gdk/win32/gdkdnd-win32.c
@@ -88,8 +88,6 @@
#include <gdk/gdk.h>
#include <glib/gstdio.h>
-typedef struct _GdkDragContextPrivateWin32 GdkDragContextPrivateWin32;
-
typedef enum {
GDK_DRAG_STATUS_DRAG,
GDK_DRAG_STATUS_MOTION_WAIT,
@@ -97,29 +95,18 @@ typedef enum {
GDK_DRAG_STATUS_DROP
} GdkDragStatus;
-/* Structure that holds information about a drag in progress.
- * this is used on both source and destination sides.
- */
-struct _GdkDragContextPrivateWin32 {
- gboolean being_finalized;
- gint ref_count;
- IUnknown *iface;
- DWORD last_key_state;
- POINT last_pt; /* Coordinates from last event */
- guint drag_status : 4; /* Current status of drag */
- guint drop_failed : 1; /* Whether the drop was unsuccessful */
-};
-
-#define PRIVATE_DATA(context) (GDK_WIN32_DRAG_CONTEXT (context)->windowing_data)
-
-static GList *contexts;
-static GdkDragContext *current_dest_drag = NULL;
-
struct _GdkWin32DragContext
{
GdkDragContext context;
-
- GdkDragContextPrivateWin32 *windowing_data;
+
+ guint drag_status : 4; /* Current status of drag */
+ guint drop_failed : 1; /* Whether the drop was unsuccessful */
+
+ POINT ole2_dnd_last_pt; /* Coordinates from last event */
+ DWORD ole2_dnd_last_key_state; /* Key state from last event */
+ gboolean ole2_dnd_being_finalized;
+ gint ole2_dnd_ref_count;
+ IUnknown *ole2_dnd_iface;
};
struct _GdkWin32DragContextClass
@@ -127,42 +114,42 @@ struct _GdkWin32DragContextClass
GdkDragContextClass parent_class;
};
-G_DEFINE_TYPE (GdkWin32DragContext, gdk_win32_drag_context, GDK_TYPE_DRAG_CONTEXT)
-
+static GList *contexts;
+static GdkDragContext *current_dest_drag = NULL;
static gboolean use_ole2_dnd = FALSE;
+G_DEFINE_TYPE (GdkWin32DragContext, gdk_win32_drag_context, GDK_TYPE_DRAG_CONTEXT)
+
static void
-gdk_win32_drag_context_init (GdkWin32DragContext *dragcontext)
+gdk_win32_drag_context_init (GdkWin32DragContext *context)
{
- GdkDragContextPrivateWin32 *private;
-
- private = G_TYPE_INSTANCE_GET_PRIVATE (dragcontext,
- GDK_TYPE_DRAG_CONTEXT,
- GdkDragContextPrivateWin32);
-
- dragcontext->windowing_data = private;
-
if (!use_ole2_dnd)
{
- contexts = g_list_prepend (contexts, dragcontext);
+ contexts = g_list_prepend (contexts, context);
}
else
{
- private->being_finalized = FALSE;
- private->ref_count = 1;
- private->iface = NULL;
+ context->ole2_dnd_being_finalized = FALSE;
+ context->ole2_dnd_ref_count = 1;
+ context->ole2_dnd_iface = NULL;
}
- GDK_NOTE (DND, g_print ("gdk_drag_context_init %p\n", dragcontext));
+ GDK_NOTE (DND, g_print ("gdk_drag_context_init %p\n", context));
}
static void
gdk_win32_drag_context_finalize (GObject *object)
{
- GdkDragContext *context = GDK_DRAG_CONTEXT (object);
+ GdkDragContext *context;
+ GdkWin32DragContext *context_win32;
GDK_NOTE (DND, g_print ("gdk_drag_context_finalize %p\n", object));
+ g_return_if_fail (GDK_IS_WIN32_DRAG_CONTEXT (object));
+
+ context = GDK_DRAG_CONTEXT (object);
+ context_win32 = GDK_WIN32_DRAG_CONTEXT (object);
+
g_list_free (context->targets);
if (context->source_window)
@@ -180,12 +167,11 @@ gdk_win32_drag_context_finalize (GObject *object)
}
else
{
- GdkDragContextPrivateWin32 *private = PRIVATE_DATA (context);
- if (private->iface)
+ if (context_win32->ole2_dnd_iface)
{
- private->being_finalized = TRUE;
- private->iface->lpVtbl->Release (private->iface);
- private->iface = NULL;
+ context_win32->ole2_dnd_being_finalized = TRUE;
+ context_win32->ole2_dnd_iface->lpVtbl->Release (context_win32->ole2_dnd_iface);
+ context_win32->ole2_dnd_iface = NULL;
}
}
@@ -197,7 +183,13 @@ gdk_win32_drag_context_finalize (GObject *object)
GdkDragContext *
gdk_drag_context_new (void)
{
- return g_object_new (GDK_TYPE_DRAG_CONTEXT, NULL);
+ GdkWin32DragContext *context_win32;
+ GdkDragContext *context;
+
+ context_win32 = g_object_new (GDK_TYPE_WIN32_DRAG_CONTEXT, NULL);
+ context = GDK_DRAG_CONTEXT(context_win32);
+
+ return context;
}
static GdkDragContext *
@@ -207,12 +199,10 @@ gdk_drag_context_find (gboolean is_source,
{
GList *tmp_list = contexts;
GdkDragContext *context;
- GdkDragContextPrivateWin32 *private;
while (tmp_list)
{
context = (GdkDragContext *)tmp_list->data;
- private = PRIVATE_DATA (context);
if ((!context->is_source == !is_source) &&
((source == NULL) || (context->source_window && (context->source_window == source))) &&
@@ -279,8 +269,9 @@ static ULONG STDMETHODCALLTYPE
idroptarget_addref (LPDROPTARGET This)
{
target_drag_context *ctx = (target_drag_context *) This;
- GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
- int ref_count = ++private->ref_count;
+ GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (ctx->context);
+
+ int ref_count = ++context_win32->ole2_dnd_ref_count;
GDK_NOTE (DND, g_print ("idroptarget_addref %p %d\n", This, ref_count));
g_object_ref (G_OBJECT (ctx->context));
@@ -325,12 +316,13 @@ static ULONG STDMETHODCALLTYPE
idroptarget_release (LPDROPTARGET This)
{
target_drag_context *ctx = (target_drag_context *) This;
- GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
- int ref_count = --private->ref_count;
+ GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (ctx->context);
+
+ int ref_count = --context_win32->ole2_dnd_ref_count;
GDK_NOTE (DND, g_print ("idroptarget_release %p %d\n", This, ref_count));
- if (!private->being_finalized)
+ if (!context_win32->ole2_dnd_being_finalized)
g_object_unref (G_OBJECT (ctx->context));
if (ref_count == 0)
@@ -540,8 +532,9 @@ static ULONG STDMETHODCALLTYPE
idropsource_addref (LPDROPSOURCE This)
{
source_drag_context *ctx = (source_drag_context *) This;
- GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
- int ref_count = ++private->ref_count;
+ GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (ctx->context);
+
+ int ref_count = ++context_win32->ole2_dnd_ref_count;
GDK_NOTE (DND, g_print ("idropsource_addref %p %d\n", This, ref_count));
g_object_ref (G_OBJECT (ctx->context));
@@ -586,12 +579,13 @@ static ULONG STDMETHODCALLTYPE
idropsource_release (LPDROPSOURCE This)
{
source_drag_context *ctx = (source_drag_context *) This;
- GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
- int ref_count = --private->ref_count;
+ GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (ctx->context);
+
+ int ref_count = --context_win32->ole2_dnd_ref_count;
GDK_NOTE (DND, g_print ("idropsource_release %p %d\n", This, ref_count));
- if (!private->being_finalized)
+ if (!context_win32->ole2_dnd_being_finalized)
g_object_unref (G_OBJECT (ctx->context));
if (ref_count == 0)
@@ -605,14 +599,14 @@ idropsource_release (LPDROPSOURCE This)
* have been emitted and false otherwise.
*/
static gboolean
-send_change_events (GdkDragContext *ctx,
+send_change_events (GdkDragContext *context,
DWORD key_state,
gboolean esc_pressed)
{
- GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx);
+ GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
POINT pt;
gboolean changed = FALSE;
- HWND hwnd = GDK_WINDOW_HWND (ctx->source_window);
+ HWND hwnd = GDK_WINDOW_HWND (context->source_window);
LPARAM lparam;
WPARAM wparam;
@@ -622,46 +616,46 @@ send_change_events (GdkDragContext *ctx,
if (!API_CALL (ScreenToClient, (hwnd, &pt)))
return FALSE;
- if (pt.x != private->last_pt.x || pt.y != private->last_pt.y ||
- key_state != private->last_key_state)
+ if (pt.x != context_win32->ole2_dnd_last_pt.x || pt.y != context_win32->ole2_dnd_last_pt.y ||
+ key_state != context_win32->ole2_dnd_last_key_state)
{
lparam = MAKELPARAM (pt.x, pt.y);
wparam = key_state;
- if (pt.x != private->last_pt.x || pt.y != private->last_pt.y)
+ if (pt.x != context_win32->ole2_dnd_last_pt.x || pt.y != context_win32->ole2_dnd_last_pt.y)
{
GDK_NOTE (DND, g_print ("Sending WM_MOUSEMOVE (%ld,%ld)\n", pt.x, pt.y));
SendMessage (hwnd, WM_MOUSEMOVE, wparam, lparam);
}
- if ((key_state & MK_LBUTTON) != (private->last_key_state & MK_LBUTTON))
+ if ((key_state & MK_LBUTTON) != (context_win32->ole2_dnd_last_key_state & MK_LBUTTON))
{
if (key_state & MK_LBUTTON)
SendMessage (hwnd, WM_LBUTTONDOWN, wparam, lparam);
else
SendMessage (hwnd, WM_LBUTTONUP, wparam, lparam);
}
- if ((key_state & MK_MBUTTON) != (private->last_key_state & MK_MBUTTON))
+ if ((key_state & MK_MBUTTON) != (context_win32->ole2_dnd_last_key_state & MK_MBUTTON))
{
if (key_state & MK_MBUTTON)
SendMessage (hwnd, WM_MBUTTONDOWN, wparam, lparam);
else
SendMessage (hwnd, WM_MBUTTONUP, wparam, lparam);
}
- if ((key_state & MK_RBUTTON) != (private->last_key_state & MK_RBUTTON))
+ if ((key_state & MK_RBUTTON) != (context_win32->ole2_dnd_last_key_state & MK_RBUTTON))
{
if (key_state & MK_RBUTTON)
SendMessage (hwnd, WM_RBUTTONDOWN, wparam, lparam);
else
SendMessage (hwnd, WM_RBUTTONUP, wparam, lparam);
}
- if ((key_state & MK_CONTROL) != (private->last_key_state & MK_CONTROL))
+ if ((key_state & MK_CONTROL) != (context_win32->ole2_dnd_last_key_state & MK_CONTROL))
{
if (key_state & MK_CONTROL)
SendMessage (hwnd, WM_KEYDOWN, VK_CONTROL, 0);
else
SendMessage (hwnd, WM_KEYUP, VK_CONTROL, 0);
}
- if ((key_state & MK_SHIFT) != (private->last_key_state & MK_SHIFT))
+ if ((key_state & MK_SHIFT) != (context_win32->ole2_dnd_last_key_state & MK_SHIFT))
{
if (key_state & MK_CONTROL)
SendMessage (hwnd, WM_KEYDOWN, VK_SHIFT, 0);
@@ -670,8 +664,8 @@ send_change_events (GdkDragContext *ctx,
}
changed = TRUE;
- private->last_key_state = key_state;
- private->last_pt = pt;
+ context_win32->ole2_dnd_last_key_state = key_state;
+ context_win32->ole2_dnd_last_pt = pt;
}
if (esc_pressed)
@@ -1172,16 +1166,19 @@ static IEnumFORMATETCVtbl ief_vtbl = {
static target_drag_context *
target_context_new (GdkWindow *window)
{
+ GdkDragContext *context;
+ GdkWin32DragContext *context_win32;
target_drag_context *result;
- GdkDragContextPrivateWin32 *private;
GdkDevice *device;
GdkDeviceManager *device_manager;
- result = g_new0 (target_drag_context, 1);
+ context = gdk_drag_context_new ();
+ context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
+ result = g_new0 (target_drag_context, 1);
+ result->context = context;
result->idt.lpVtbl = &idt_vtbl;
- result->context = gdk_drag_context_new ();
result->context->protocol = GDK_DRAG_PROTO_OLE2;
result->context->is_source = FALSE;
@@ -1194,14 +1191,12 @@ target_context_new (GdkWindow *window)
result->context->dest_window = window;
g_object_ref (window);
- /* FIXME: result->context->targets? */
-
+ /* FIXME: context->targets? */
result->context->actions = GDK_ACTION_DEFAULT | GDK_ACTION_COPY | GDK_ACTION_MOVE;
result->context->suggested_action = GDK_ACTION_MOVE;
result->context->action = GDK_ACTION_MOVE;
- private = PRIVATE_DATA(result->context);
- private->iface = (IUnknown *) &result->idt;
+ context_win32->ole2_dnd_iface = (IUnknown *) &result->idt;
idroptarget_addref (&result->idt);
GDK_NOTE (DND, g_print ("target_context_new: %p\n", result));
@@ -1213,16 +1208,19 @@ static source_drag_context *
source_context_new (GdkWindow *window,
GList *targets)
{
+ GdkDragContext *context;
+ GdkWin32DragContext *context_win32;
source_drag_context *result;
- GdkDragContextPrivateWin32 *private;
GdkDevice *device;
GdkDeviceManager *device_manager;
- result = g_new0 (source_drag_context, 1);
+ context = gdk_drag_context_new ();
+ context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
+ result = g_new0 (source_drag_context, 1);
+ result->context = context;
result->ids.lpVtbl = &ids_vtbl;
- result->context = gdk_drag_context_new ();
result->context->protocol = GDK_DRAG_PROTO_OLE2;
result->context->is_source = TRUE;
@@ -1236,8 +1234,7 @@ source_context_new (GdkWindow *window,
result->context->dest_window = NULL;
result->context->targets = g_list_copy (targets);
- private = PRIVATE_DATA(result->context);
- private->iface = (IUnknown *) &result->ids;
+ context_win32->ole2_dnd_iface = (IUnknown *) &result->ids;
idropsource_addref (&result->ids);
GDK_NOTE (DND, g_print ("source_context_new: %p\n", result));
@@ -1667,7 +1664,6 @@ local_send_enter (GdkDragContext *context,
guint32 time)
{
GdkEvent *tmp_event;
- GdkDragContextPrivateWin32 *private;
GdkDragContext *new_context;
GdkDevice *device;
GdkDeviceManager *device_manager;
@@ -1676,8 +1672,6 @@ local_send_enter (GdkDragContext *context,
context,
current_dest_drag));
- private = PRIVATE_DATA (context);
-
if (current_dest_drag != NULL)
{
g_object_unref (G_OBJECT (current_dest_drag));
@@ -1727,6 +1721,7 @@ local_send_motion (GdkDragContext *context,
guint32 time)
{
GdkEvent *tmp_event;
+ GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
GDK_NOTE (DND, g_print ("local_send_motion: context=%p (%d,%d) current_dest_drag=%p\n",
context, x_root, y_root,
@@ -1736,6 +1731,8 @@ local_send_motion (GdkDragContext *context,
(current_dest_drag->protocol == GDK_DRAG_PROTO_LOCAL) &&
(current_dest_drag->source_window == context->source_window))
{
+ GdkWin32DragContext *current_dest_drag_win32;
+
tmp_event = gdk_event_new (GDK_DRAG_MOTION);
tmp_event->dnd.window = g_object_ref (current_dest_drag->dest_window);
tmp_event->dnd.send_event = FALSE;
@@ -1748,10 +1745,11 @@ local_send_motion (GdkDragContext *context,
tmp_event->dnd.x_root = x_root;
tmp_event->dnd.y_root = y_root;
- PRIVATE_DATA (current_dest_drag)->last_pt.x = x_root - _gdk_offset_x;
- PRIVATE_DATA (current_dest_drag)->last_pt.y = y_root - _gdk_offset_y;
+ current_dest_drag_win32 = GDK_WIN32_DRAG_CONTEXT (current_dest_drag);
+ current_dest_drag_win32->ole2_dnd_last_pt.x = x_root - _gdk_offset_x;
+ current_dest_drag_win32->ole2_dnd_last_pt.y = y_root - _gdk_offset_y;
- PRIVATE_DATA (context)->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
+ context_win32->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
GDK_NOTE (EVENTS, _gdk_win32_print_event (tmp_event));
gdk_event_put (tmp_event);
@@ -1773,8 +1771,7 @@ local_send_drop (GdkDragContext *context,
(current_dest_drag->protocol == GDK_DRAG_PROTO_LOCAL) &&
(current_dest_drag->source_window == context->source_window))
{
- GdkDragContextPrivateWin32 *private;
- private = PRIVATE_DATA (current_dest_drag);
+ GdkWin32DragContext *context_win32;
/* Pass ownership of context to the event */
tmp_event = gdk_event_new (GDK_DROP_START);
@@ -1784,8 +1781,9 @@ local_send_drop (GdkDragContext *context,
tmp_event->dnd.time = GDK_CURRENT_TIME;
gdk_event_set_device (tmp_event, gdk_drag_context_get_device (current_dest_drag));
- tmp_event->dnd.x_root = private->last_pt.x + _gdk_offset_x;
- tmp_event->dnd.y_root = private->last_pt.y + _gdk_offset_y;
+ context_win32 = GDK_WIN32_DRAG_CONTEXT (current_dest_drag);
+ tmp_event->dnd.x_root = context_win32->ole2_dnd_last_pt.x + _gdk_offset_x;
+ tmp_event->dnd.y_root = context_win32->ole2_dnd_last_pt.y + _gdk_offset_y;
current_dest_drag = NULL;
@@ -1870,11 +1868,12 @@ _gdk_win32_dnd_do_dragdrop (void)
if (use_ole2_dnd)
{
GdkDragContext* drag_ctx;
- GdkDragContextPrivateWin32 *private;
+ GdkWin32DragContext *drag_ctx_win32;
BYTE kbd_state[256];
data_object *dobj;
HRESULT hr;
DWORD dwEffect;
+
#if 0
HGLOBAL global;
STGMEDIUM medium;
@@ -1884,25 +1883,25 @@ _gdk_win32_dnd_do_dragdrop (void)
return;
drag_ctx = pending_src_context->context;
- private = PRIVATE_DATA (drag_ctx);
+ drag_ctx_win32 = GDK_WIN32_DRAG_CONTEXT (drag_ctx);
dobj = data_object_new (drag_ctx);
- API_CALL (GetCursorPos, (&private->last_pt));
- API_CALL (ScreenToClient, (GDK_WINDOW_HWND (drag_ctx->source_window), &private->last_pt));
- private->last_key_state = 0;
+ API_CALL (GetCursorPos, (&drag_ctx_win32->ole2_dnd_last_pt));
+ API_CALL (ScreenToClient, (GDK_WINDOW_HWND (drag_ctx->source_window), &drag_ctx_win32->ole2_dnd_last_pt));
+ drag_ctx_win32->ole2_dnd_last_key_state = 0;
API_CALL (GetKeyboardState, (kbd_state));
if (kbd_state[VK_CONTROL])
- private->last_key_state |= MK_CONTROL;
+ drag_ctx_win32->ole2_dnd_last_key_state |= MK_CONTROL;
if (kbd_state[VK_SHIFT])
- private->last_key_state |= MK_SHIFT;
+ drag_ctx_win32->ole2_dnd_last_key_state |= MK_SHIFT;
if (kbd_state[VK_LBUTTON])
- private->last_key_state |= MK_LBUTTON;
+ drag_ctx_win32->ole2_dnd_last_key_state |= MK_LBUTTON;
if (kbd_state[VK_MBUTTON])
- private->last_key_state |= MK_MBUTTON;
+ drag_ctx_win32->ole2_dnd_last_key_state |= MK_MBUTTON;
if (kbd_state[VK_RBUTTON])
- private->last_key_state |= MK_RBUTTON;
+ drag_ctx_win32->ole2_dnd_last_key_state |= MK_RBUTTON;
#if 0
global = GlobalAlloc (GMEM_FIXED, sizeof (ctx));
@@ -2097,7 +2096,7 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
GdkDragAction possible_actions,
guint32 time)
{
- GdkDragContextPrivateWin32 *private;
+ GdkWin32DragContext *context_win32;
g_return_val_if_fail (context != NULL, FALSE);
@@ -2113,7 +2112,7 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
_gdk_win32_drag_action_to_string (context->suggested_action),
_gdk_win32_drag_action_to_string (context->action)));
- private = PRIVATE_DATA (context);
+ context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
if (!use_ole2_dnd)
{
@@ -2136,7 +2135,7 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
/* Send a leave to the last destination */
gdk_drag_do_leave (context, time);
- private->drag_status = GDK_DRAG_STATUS_DRAG;
+ context_win32->drag_status = GDK_DRAG_STATUS_DRAG;
/* Check if new destination accepts drags, and which protocol */
if (dest_window)
@@ -2165,7 +2164,7 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
/* Push a status event, to let the client know that
* the drag changed
*/
- tmp_event = gdk_event_new (GDK_DRAG_STATUS);
+ tmp_event = gdk_event_new (GDK_DRAG_STATUS);
tmp_event->dnd.window = g_object_ref (context->source_window);
/* We use this to signal a synthetic status. Perhaps
* we should use an extra field...
@@ -2174,21 +2173,21 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
tmp_event->dnd.context = g_object_ref (context);
tmp_event->dnd.time = time;
- gdk_event_set_device (tmp_event, gdk_drag_context_get_device (context));
+ gdk_event_set_device (tmp_event, gdk_drag_context_get_device (context));
GDK_NOTE (EVENTS, _gdk_win32_print_event (tmp_event));
gdk_event_put (tmp_event);
- gdk_event_free (tmp_event);
+ gdk_event_free (tmp_event);
}
/* Send a drag-motion event */
- private->last_pt.x = x_root - _gdk_offset_x;
- private->last_pt.y = y_root - _gdk_offset_y;
+ context_win32->ole2_dnd_last_pt.x = x_root - _gdk_offset_x;
+ context_win32->ole2_dnd_last_pt.y = y_root - _gdk_offset_y;
if (context->dest_window)
{
- if (private->drag_status == GDK_DRAG_STATUS_DRAG)
+ if (context_win32->drag_status == GDK_DRAG_STATUS_DRAG)
{
switch (context->protocol)
{
@@ -2265,14 +2264,11 @@ gdk_win32_drag_context_drag_status (GdkDragContext *context,
GdkDragAction action,
guint32 time)
{
- GdkDragContextPrivateWin32 *private;
GdkDragContext *src_context;
GdkEvent *tmp_event;
g_return_if_fail (context != NULL);
- private = PRIVATE_DATA (context);
-
GDK_NOTE (DND, g_print ("gdk_drag_status: %s\n"
" context=%p:{actions=%s,suggested=%s,action=%s}\n",
_gdk_win32_drag_action_to_string (action),
@@ -2291,17 +2287,17 @@ gdk_win32_drag_context_drag_status (GdkDragContext *context,
if (src_context)
{
- GdkDragContextPrivateWin32 *private = PRIVATE_DATA (src_context);
+ GdkWin32DragContext *src_context_win32 = GDK_WIN32_DRAG_CONTEXT (src_context);
- if (private->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
- private->drag_status = GDK_DRAG_STATUS_DRAG;
+ if (src_context_win32->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
+ src_context_win32->drag_status = GDK_DRAG_STATUS_DRAG;
tmp_event = gdk_event_new (GDK_DRAG_STATUS);
tmp_event->dnd.window = g_object_ref (context->source_window);
tmp_event->dnd.send_event = FALSE;
tmp_event->dnd.context = g_object_ref (src_context);
tmp_event->dnd.time = GDK_CURRENT_TIME; /* FIXME? */
- gdk_event_set_device (tmp_event, gdk_drag_context_get_device (src_context));
+ gdk_event_set_device (tmp_event, gdk_drag_context_get_device (src_context));
if (action == GDK_ACTION_DEFAULT)
action = 0;
@@ -2310,7 +2306,7 @@ gdk_win32_drag_context_drag_status (GdkDragContext *context,
GDK_NOTE (EVENTS, _gdk_win32_print_event (tmp_event));
gdk_event_put (tmp_event);
- gdk_event_free (tmp_event);
+ gdk_event_free (tmp_event);
}
}
}
@@ -2337,7 +2333,6 @@ gdk_win32_drag_context_drop_finish (GdkDragContext *context,
gboolean success,
guint32 time)
{
- GdkDragContextPrivateWin32 *private;
GdkDragContext *src_context;
GdkEvent *tmp_event;
@@ -2345,8 +2340,6 @@ gdk_win32_drag_context_drop_finish (GdkDragContext *context,
GDK_NOTE (DND, g_print ("gdk_drop_finish\n"));
- private = PRIVATE_DATA (context);
-
if (!use_ole2_dnd)
{
src_context = gdk_drag_context_find (TRUE,
@@ -2467,7 +2460,9 @@ _gdk_win32_window_register_dnd (GdkWindow *window)
static gboolean
gdk_win32_drag_context_drop_status (GdkDragContext *context)
{
- return ! PRIVATE_DATA (context)->drop_failed;
+ GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
+
+ return ! context_win32->drop_failed;
}
static GdkAtom
@@ -2492,8 +2487,6 @@ gdk_win32_drag_context_class_init (GdkWin32DragContextClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
- gdk_win32_drag_context_parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = gdk_win32_drag_context_finalize;
context_class->find_window = gdk_win32_drag_context_find_window;
@@ -2505,6 +2498,4 @@ gdk_win32_drag_context_class_init (GdkWin32DragContextClass *klass)
context_class->drop_finish = gdk_win32_drag_context_drop_finish;
context_class->drop_status = gdk_win32_drag_context_drop_status;
context_class->get_selection = gdk_win32_drag_context_get_selection;
-
- g_type_class_add_private (object_class, sizeof (GdkDragContextPrivateWin32));
}