Use G_DEFINE_TYPE. Some debugging printout changes. Hacking on the
2009-03-11 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c: Use G_DEFINE_TYPE. Some debugging printout changes. Hacking on the OLE2_DND code, which still doesn't work, though, and is not normally compiled. svn path=/trunk/; revision=22517
This commit is contained in:
parent
93bb740db3
commit
e51f525a76
@ -1,3 +1,9 @@
|
|||||||
|
2009-03-11 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* gdk/win32/gdkdnd-win32.c: Use G_DEFINE_TYPE. Some debugging
|
||||||
|
printout changes. Hacking on the OLE2_DND code, which still
|
||||||
|
doesn't work, though, and is not normally compiled.
|
||||||
|
|
||||||
2009-03-11 Tor Lillqvist <tml@iki.fi>
|
2009-03-11 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
Bug 570896 - gdkevents-win32.c(2947) : error C4053: one void
|
Bug 570896 - gdkevents-win32.c(2947) : error C4053: one void
|
||||||
|
@ -89,7 +89,9 @@ static int nformats;
|
|||||||
*/
|
*/
|
||||||
struct _GdkDragContextPrivateWin32 {
|
struct _GdkDragContextPrivateWin32 {
|
||||||
#ifdef OLE2_DND
|
#ifdef OLE2_DND
|
||||||
|
gboolean being_finalized;
|
||||||
gint ref_count;
|
gint ref_count;
|
||||||
|
IUnknown *iface;
|
||||||
#endif
|
#endif
|
||||||
guint16 last_x; /* Coordinates from last event */
|
guint16 last_x; /* Coordinates from last event */
|
||||||
guint16 last_y;
|
guint16 last_y;
|
||||||
@ -98,7 +100,7 @@ struct _GdkDragContextPrivateWin32 {
|
|||||||
guint drop_failed : 1; /* Whether the drop was unsuccessful */
|
guint drop_failed : 1; /* Whether the drop was unsuccessful */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GDK_DRAG_CONTEXT_PRIVATE_DATA(context) ((GdkDragContextPrivateWin32 *) GDK_DRAG_CONTEXT (context)->windowing_data)
|
#define PRIVATE_DATA(context) ((GdkDragContextPrivateWin32 *) GDK_DRAG_CONTEXT (context)->windowing_data)
|
||||||
|
|
||||||
static GdkDragContext *current_dest_drag = NULL;
|
static GdkDragContext *current_dest_drag = NULL;
|
||||||
|
|
||||||
@ -109,45 +111,27 @@ static void gdk_drag_context_finalize (GObject *object);
|
|||||||
static gpointer parent_class = NULL;
|
static gpointer parent_class = NULL;
|
||||||
static GList *contexts;
|
static GList *contexts;
|
||||||
|
|
||||||
GType
|
G_DEFINE_TYPE (GdkDragContext, gdk_drag_context, G_TYPE_OBJECT)
|
||||||
gdk_drag_context_get_type (void)
|
|
||||||
{
|
|
||||||
static GType object_type = 0;
|
|
||||||
|
|
||||||
if (!object_type)
|
|
||||||
{
|
|
||||||
static const GTypeInfo object_info =
|
|
||||||
{
|
|
||||||
sizeof (GdkDragContextClass),
|
|
||||||
(GBaseInitFunc) NULL,
|
|
||||||
(GBaseFinalizeFunc) NULL,
|
|
||||||
(GClassInitFunc) gdk_drag_context_class_init,
|
|
||||||
NULL, /* class_finalize */
|
|
||||||
NULL, /* class_data */
|
|
||||||
sizeof (GdkDragContext),
|
|
||||||
0, /* n_preallocs */
|
|
||||||
(GInstanceInitFunc) gdk_drag_context_init,
|
|
||||||
};
|
|
||||||
|
|
||||||
object_type = g_type_register_static (G_TYPE_OBJECT,
|
|
||||||
"GdkDragContext",
|
|
||||||
&object_info, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return object_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_drag_context_init (GdkDragContext *dragcontext)
|
gdk_drag_context_init (GdkDragContext *dragcontext)
|
||||||
{
|
{
|
||||||
GdkDragContextPrivateWin32 *private = g_new0 (GdkDragContextPrivateWin32, 1);
|
GdkDragContextPrivateWin32 *private;
|
||||||
|
|
||||||
|
private = G_TYPE_INSTANCE_GET_PRIVATE (dragcontext,
|
||||||
|
GDK_TYPE_DRAG_CONTEXT,
|
||||||
|
GdkDragContextPrivateWin32);
|
||||||
|
|
||||||
dragcontext->windowing_data = private;
|
dragcontext->windowing_data = private;
|
||||||
#ifdef OLE2_DND
|
#ifdef OLE2_DND
|
||||||
|
private->being_finalized = FALSE;
|
||||||
private->ref_count = 1;
|
private->ref_count = 1;
|
||||||
|
private->iface = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
contexts = g_list_prepend (contexts, dragcontext);
|
contexts = g_list_prepend (contexts, dragcontext);
|
||||||
|
|
||||||
|
GDK_NOTE (DND, g_print ("gdk_drag_context_init %p\n", dragcontext));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -158,22 +142,21 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
|
|||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
object_class->finalize = gdk_drag_context_finalize;
|
object_class->finalize = gdk_drag_context_finalize;
|
||||||
|
|
||||||
|
g_type_class_add_private (object_class, sizeof (GdkDragContextPrivateWin32));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_drag_context_finalize (GObject *object)
|
gdk_drag_context_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
|
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
|
||||||
GdkDragContextPrivateWin32 *private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
|
|
||||||
|
|
||||||
GDK_NOTE (DND, g_print ("gdk_drag_context_finalize\n"));
|
GDK_NOTE (DND, g_print ("gdk_drag_context_finalize %p\n", object));
|
||||||
|
|
||||||
g_list_free (context->targets);
|
g_list_free (context->targets);
|
||||||
|
|
||||||
if (context->source_window)
|
if (context->source_window)
|
||||||
{
|
|
||||||
g_object_unref (context->source_window);
|
g_object_unref (context->source_window);
|
||||||
}
|
|
||||||
|
|
||||||
if (context->dest_window)
|
if (context->dest_window)
|
||||||
g_object_unref (context->dest_window);
|
g_object_unref (context->dest_window);
|
||||||
@ -183,7 +166,17 @@ gdk_drag_context_finalize (GObject *object)
|
|||||||
if (context == current_dest_drag)
|
if (context == current_dest_drag)
|
||||||
current_dest_drag = NULL;
|
current_dest_drag = NULL;
|
||||||
|
|
||||||
g_free (private);
|
#ifdef OLE2_DND
|
||||||
|
{
|
||||||
|
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (context);
|
||||||
|
if (private->iface)
|
||||||
|
{
|
||||||
|
private->being_finalized = TRUE;
|
||||||
|
private->iface->lpVtbl->Release (private->iface);
|
||||||
|
private->iface = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
@ -193,7 +186,7 @@ gdk_drag_context_finalize (GObject *object)
|
|||||||
GdkDragContext *
|
GdkDragContext *
|
||||||
gdk_drag_context_new (void)
|
gdk_drag_context_new (void)
|
||||||
{
|
{
|
||||||
return g_object_new (gdk_drag_context_get_type (), NULL);
|
return g_object_new (GDK_TYPE_DRAG_CONTEXT, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -224,7 +217,7 @@ gdk_drag_context_find (gboolean is_source,
|
|||||||
while (tmp_list)
|
while (tmp_list)
|
||||||
{
|
{
|
||||||
context = (GdkDragContext *)tmp_list->data;
|
context = (GdkDragContext *)tmp_list->data;
|
||||||
private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
|
private = PRIVATE_DATA (context);
|
||||||
|
|
||||||
if ((!context->is_source == !is_source) &&
|
if ((!context->is_source == !is_source) &&
|
||||||
((source == NULL) || (context->source_window && (context->source_window == source))) &&
|
((source == NULL) || (context->source_window && (context->source_window == source))) &&
|
||||||
@ -237,23 +230,18 @@ gdk_drag_context_find (gboolean is_source,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef OLE2_DND
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#ifdef OLE2_DND
|
|
||||||
IDropTarget idt;
|
IDropTarget idt;
|
||||||
#endif
|
|
||||||
GdkDragContext *context;
|
GdkDragContext *context;
|
||||||
} target_drag_context;
|
} target_drag_context;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#ifdef OLE2_DND
|
|
||||||
IDropSource ids;
|
IDropSource ids;
|
||||||
#endif
|
|
||||||
GdkDragContext *context;
|
GdkDragContext *context;
|
||||||
} source_drag_context;
|
} source_drag_context;
|
||||||
|
|
||||||
#ifdef OLE2_DND
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
IDataObject ido;
|
IDataObject ido;
|
||||||
int ref_count;
|
int ref_count;
|
||||||
@ -271,11 +259,11 @@ static ULONG STDMETHODCALLTYPE
|
|||||||
idroptarget_addref (LPDROPTARGET This)
|
idroptarget_addref (LPDROPTARGET This)
|
||||||
{
|
{
|
||||||
target_drag_context *ctx = (target_drag_context *) This;
|
target_drag_context *ctx = (target_drag_context *) This;
|
||||||
GdkDragContextPrivateWin32 *private = GDK_DRAG_CONTEXT_PRIVATE_DATA (ctx->context);
|
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
|
||||||
int ref_count = ++private->ref_count;
|
int ref_count = ++private->ref_count;
|
||||||
|
|
||||||
gdk_drag_context_ref (ctx->context);
|
|
||||||
GDK_NOTE (DND, g_print ("idroptarget_addref %p %d\n", This, ref_count));
|
GDK_NOTE (DND, g_print ("idroptarget_addref %p %d\n", This, ref_count));
|
||||||
|
g_object_ref (G_OBJECT (ctx->context));
|
||||||
|
|
||||||
return ref_count;
|
return ref_count;
|
||||||
}
|
}
|
||||||
@ -307,7 +295,7 @@ idroptarget_queryinterface (LPDROPTARGET This,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_print ("...Huh?\n");
|
g_print ("...Nope\n");
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -316,12 +304,14 @@ static ULONG STDMETHODCALLTYPE
|
|||||||
idroptarget_release (LPDROPTARGET This)
|
idroptarget_release (LPDROPTARGET This)
|
||||||
{
|
{
|
||||||
target_drag_context *ctx = (target_drag_context *) This;
|
target_drag_context *ctx = (target_drag_context *) This;
|
||||||
GdkDragContextPrivateWin32 *private = GDK_DRAG_CONTEXT_PRIVATE_DATA (ctx->context);
|
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
|
||||||
int ref_count = --private->ref_count;
|
int ref_count = --private->ref_count;
|
||||||
|
|
||||||
gdk_drag_context_unref (ctx->context);
|
|
||||||
GDK_NOTE (DND, g_print ("idroptarget_release %p %d\n", This, ref_count));
|
GDK_NOTE (DND, g_print ("idroptarget_release %p %d\n", This, ref_count));
|
||||||
|
|
||||||
|
if (!private->being_finalized)
|
||||||
|
g_object_unref (G_OBJECT (ctx->context));
|
||||||
|
|
||||||
if (ref_count == 0)
|
if (ref_count == 0)
|
||||||
g_free (This);
|
g_free (This);
|
||||||
|
|
||||||
@ -335,9 +325,20 @@ idroptarget_dragenter (LPDROPTARGET This,
|
|||||||
POINTL pt,
|
POINTL pt,
|
||||||
LPDWORD pdwEffect)
|
LPDWORD pdwEffect)
|
||||||
{
|
{
|
||||||
GDK_NOTE (DND, g_print ("idroptarget_dragenter %p\n", This));
|
IEnumFORMATETC* iefp;
|
||||||
|
FORMATETC formatetc;
|
||||||
|
|
||||||
return E_UNEXPECTED;
|
GDK_NOTE (DND, g_print ("idroptarget_dragenter %p formats:\n", This));
|
||||||
|
|
||||||
|
pDataObj->lpVtbl->EnumFormatEtc (pDataObj, DATADIR_GET, &iefp);
|
||||||
|
while (iefp->lpVtbl->Next (iefp, 1, &formatetc, NULL) == S_OK)
|
||||||
|
{
|
||||||
|
GDK_NOTE (DND, g_print (" %s\n", _gdk_win32_cf_to_string (formatetc.cfFormat)));
|
||||||
|
}
|
||||||
|
iefp->lpVtbl->Release (iefp);
|
||||||
|
|
||||||
|
*pdwEffect = DROPEFFECT_COPY;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE
|
static HRESULT STDMETHODCALLTYPE
|
||||||
@ -348,7 +349,8 @@ idroptarget_dragover (LPDROPTARGET This,
|
|||||||
{
|
{
|
||||||
GDK_NOTE (DND, g_print ("idroptarget_dragover %p\n", This));
|
GDK_NOTE (DND, g_print ("idroptarget_dragover %p\n", This));
|
||||||
|
|
||||||
return E_UNEXPECTED;
|
*pdwEffect = DROPEFFECT_COPY;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE
|
static HRESULT STDMETHODCALLTYPE
|
||||||
@ -356,7 +358,7 @@ idroptarget_dragleave (LPDROPTARGET This)
|
|||||||
{
|
{
|
||||||
GDK_NOTE (DND, g_print ("idroptarget_dragleave %p\n", This));
|
GDK_NOTE (DND, g_print ("idroptarget_dragleave %p\n", This));
|
||||||
|
|
||||||
return E_UNEXPECTED;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE
|
static HRESULT STDMETHODCALLTYPE
|
||||||
@ -368,20 +370,21 @@ idroptarget_drop (LPDROPTARGET This,
|
|||||||
{
|
{
|
||||||
GDK_NOTE (DND, g_print ("idroptarget_drop %p\n", This));
|
GDK_NOTE (DND, g_print ("idroptarget_drop %p\n", This));
|
||||||
|
|
||||||
return E_UNEXPECTED;
|
*pdwEffect = DROPEFFECT_COPY;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG STDMETHODCALLTYPE
|
static ULONG STDMETHODCALLTYPE
|
||||||
idropsource_addref (LPDROPSOURCE This)
|
idropsource_addref (LPDROPSOURCE This)
|
||||||
{
|
{
|
||||||
source_drag_context *ctx = (source_drag_context *) This;
|
source_drag_context *ctx = (source_drag_context *) This;
|
||||||
GdkDragContextPrivateWin32 *private = GDK_DRAG_CONTEXT_PRIVATE_DATA (ctx->context);
|
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
|
||||||
|
int ref_count = ++private->ref_count;
|
||||||
|
|
||||||
gdk_drag_context_ref (ctx->context);
|
GDK_NOTE (DND, g_print ("idropsource_addref %p %d\n", This, ref_count));
|
||||||
GDK_NOTE (DND, g_print ("idropsource_addref %p %d\n",
|
g_object_ref (G_OBJECT (ctx->context));
|
||||||
This, private->ref_count));
|
|
||||||
|
|
||||||
return private->ref_count;
|
return ref_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE
|
static HRESULT STDMETHODCALLTYPE
|
||||||
@ -410,7 +413,7 @@ idropsource_queryinterface (LPDROPSOURCE This,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_print ("...Huh?\n");
|
g_print ("...Nope\n");
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -419,12 +422,14 @@ static ULONG STDMETHODCALLTYPE
|
|||||||
idropsource_release (LPDROPSOURCE This)
|
idropsource_release (LPDROPSOURCE This)
|
||||||
{
|
{
|
||||||
source_drag_context *ctx = (source_drag_context *) This;
|
source_drag_context *ctx = (source_drag_context *) This;
|
||||||
GdkDragContextPrivateWin32 *private = GDK_DRAG_CONTEXT_PRIVATE_DATA (ctx->context);
|
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
|
||||||
int ref_count = --private->ref_count;
|
int ref_count = --private->ref_count;
|
||||||
|
|
||||||
gdk_drag_context_unref (ctx->context);
|
|
||||||
GDK_NOTE (DND, g_print ("idropsource_release %p %d\n", This, ref_count));
|
GDK_NOTE (DND, g_print ("idropsource_release %p %d\n", This, ref_count));
|
||||||
|
|
||||||
|
if (!private->being_finalized)
|
||||||
|
g_object_unref (G_OBJECT (ctx->context));
|
||||||
|
|
||||||
if (ref_count == 0)
|
if (ref_count == 0)
|
||||||
g_free (This);
|
g_free (This);
|
||||||
|
|
||||||
@ -487,7 +492,7 @@ idataobject_queryinterface (LPDATAOBJECT This,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_print ("...Huh?\n");
|
g_print ("...Nope\n");
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -647,7 +652,7 @@ ienumformatetc_queryinterface (LPENUMFORMATETC This,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_print ("...Huh?\n");
|
g_print ("...Nope\n");
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -785,6 +790,7 @@ static target_drag_context *
|
|||||||
target_context_new (void)
|
target_context_new (void)
|
||||||
{
|
{
|
||||||
target_drag_context *result;
|
target_drag_context *result;
|
||||||
|
GdkDragContextPrivateWin32 *private;
|
||||||
|
|
||||||
result = g_new0 (target_drag_context, 1);
|
result = g_new0 (target_drag_context, 1);
|
||||||
|
|
||||||
@ -793,6 +799,10 @@ target_context_new (void)
|
|||||||
result->context = gdk_drag_context_new ();
|
result->context = gdk_drag_context_new ();
|
||||||
result->context->is_source = FALSE;
|
result->context->is_source = FALSE;
|
||||||
|
|
||||||
|
private = result->context->windowing_data;
|
||||||
|
private->iface = (IUnknown *) &result->idt;
|
||||||
|
idroptarget_addref (&result->idt);
|
||||||
|
|
||||||
GDK_NOTE (DND, g_print ("target_context_new: %p\n", result));
|
GDK_NOTE (DND, g_print ("target_context_new: %p\n", result));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -802,6 +812,7 @@ static source_drag_context *
|
|||||||
source_context_new (void)
|
source_context_new (void)
|
||||||
{
|
{
|
||||||
source_drag_context *result;
|
source_drag_context *result;
|
||||||
|
GdkDragContextPrivateWin32 *private;
|
||||||
|
|
||||||
result = g_new0 (source_drag_context, 1);
|
result = g_new0 (source_drag_context, 1);
|
||||||
|
|
||||||
@ -810,6 +821,10 @@ source_context_new (void)
|
|||||||
result->context = gdk_drag_context_new ();
|
result->context = gdk_drag_context_new ();
|
||||||
result->context->is_source = TRUE;
|
result->context->is_source = TRUE;
|
||||||
|
|
||||||
|
private = result->context->windowing_data;
|
||||||
|
private->iface = (IUnknown *) &result->ids;
|
||||||
|
idropsource_addref (&result->ids);
|
||||||
|
|
||||||
GDK_NOTE (DND, g_print ("source_context_new: %p\n", result));
|
GDK_NOTE (DND, g_print ("source_context_new: %p\n", result));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -945,7 +960,7 @@ gdk_dropfiles_filter (GdkXEvent *xev,
|
|||||||
GDK_NOTE (DND, g_print ("WM_DROPFILES: %p\n", msg->hwnd));
|
GDK_NOTE (DND, g_print ("WM_DROPFILES: %p\n", msg->hwnd));
|
||||||
|
|
||||||
context = gdk_drag_context_new ();
|
context = gdk_drag_context_new ();
|
||||||
private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
|
private = PRIVATE_DATA (context);
|
||||||
context->protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
|
context->protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
|
||||||
context->is_source = FALSE;
|
context->is_source = FALSE;
|
||||||
context->source_window = _gdk_root;
|
context->source_window = _gdk_root;
|
||||||
@ -1090,11 +1105,11 @@ local_send_enter (GdkDragContext *context,
|
|||||||
GdkDragContextPrivateWin32 *private;
|
GdkDragContextPrivateWin32 *private;
|
||||||
GdkDragContext *new_context;
|
GdkDragContext *new_context;
|
||||||
|
|
||||||
private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
|
private = PRIVATE_DATA (context);
|
||||||
|
|
||||||
if (current_dest_drag != NULL)
|
if (current_dest_drag != NULL)
|
||||||
{
|
{
|
||||||
gdk_drag_context_unref (current_dest_drag);
|
g_object_unref (G_OBJECT (current_dest_drag));
|
||||||
current_dest_drag = NULL;
|
current_dest_drag = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1150,10 +1165,10 @@ local_send_motion (GdkDragContext *context,
|
|||||||
tmp_event.dnd.x_root = x_root;
|
tmp_event.dnd.x_root = x_root;
|
||||||
tmp_event.dnd.y_root = y_root;
|
tmp_event.dnd.y_root = y_root;
|
||||||
|
|
||||||
(GDK_DRAG_CONTEXT_PRIVATE_DATA (current_dest_drag))->last_x = x_root;
|
PRIVATE_DATA (current_dest_drag)->last_x = x_root;
|
||||||
(GDK_DRAG_CONTEXT_PRIVATE_DATA (current_dest_drag))->last_y = y_root;
|
PRIVATE_DATA (current_dest_drag)->last_y = y_root;
|
||||||
|
|
||||||
GDK_DRAG_CONTEXT_PRIVATE_DATA (context)->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
|
PRIVATE_DATA (context)->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
|
||||||
|
|
||||||
gdk_event_put (&tmp_event);
|
gdk_event_put (&tmp_event);
|
||||||
}
|
}
|
||||||
@ -1170,7 +1185,7 @@ local_send_drop (GdkDragContext *context,
|
|||||||
(current_dest_drag->source_window == context->source_window))
|
(current_dest_drag->source_window == context->source_window))
|
||||||
{
|
{
|
||||||
GdkDragContextPrivateWin32 *private;
|
GdkDragContextPrivateWin32 *private;
|
||||||
private = GDK_DRAG_CONTEXT_PRIVATE_DATA (current_dest_drag);
|
private = PRIVATE_DATA (current_dest_drag);
|
||||||
|
|
||||||
/* Pass ownership of context to the event */
|
/* Pass ownership of context to the event */
|
||||||
tmp_event.dnd.type = GDK_DROP_START;
|
tmp_event.dnd.type = GDK_DROP_START;
|
||||||
@ -1215,32 +1230,8 @@ GdkDragContext *
|
|||||||
gdk_drag_begin (GdkWindow *window,
|
gdk_drag_begin (GdkWindow *window,
|
||||||
GList *targets)
|
GList *targets)
|
||||||
{
|
{
|
||||||
#ifndef OLE2_DND
|
#ifdef OLE2_DND
|
||||||
GList *tmp_list;
|
|
||||||
GdkDragContext *new_context;
|
|
||||||
|
|
||||||
g_return_val_if_fail (window != NULL, NULL);
|
|
||||||
|
|
||||||
new_context = gdk_drag_context_new ();
|
|
||||||
new_context->is_source = TRUE;
|
|
||||||
new_context->source_window = window;
|
|
||||||
g_object_ref (window);
|
|
||||||
|
|
||||||
tmp_list = g_list_last (targets);
|
|
||||||
new_context->targets = NULL;
|
|
||||||
while (tmp_list)
|
|
||||||
{
|
|
||||||
new_context->targets = g_list_prepend (new_context->targets,
|
|
||||||
tmp_list->data);
|
|
||||||
tmp_list = tmp_list->prev;
|
|
||||||
}
|
|
||||||
|
|
||||||
new_context->actions = 0;
|
|
||||||
|
|
||||||
return new_context;
|
|
||||||
#else
|
|
||||||
source_drag_context *ctx;
|
source_drag_context *ctx;
|
||||||
GList *tmp_list;
|
|
||||||
data_object *dobj;
|
data_object *dobj;
|
||||||
HRESULT hResult;
|
HRESULT hResult;
|
||||||
DWORD dwEffect;
|
DWORD dwEffect;
|
||||||
@ -1256,14 +1247,7 @@ gdk_drag_begin (GdkWindow *window,
|
|||||||
ctx->context->source_window = window;
|
ctx->context->source_window = window;
|
||||||
g_object_ref (window);
|
g_object_ref (window);
|
||||||
|
|
||||||
tmp_list = g_list_last (targets);
|
ctx->context->targets = g_list_copy (targets);
|
||||||
ctx->context->targets = NULL;
|
|
||||||
while (tmp_list)
|
|
||||||
{
|
|
||||||
ctx->context->targets = g_list_prepend (ctx->context->targets,
|
|
||||||
tmp_list->data);
|
|
||||||
tmp_list = tmp_list->prev;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx->context->actions = 0;
|
ctx->context->actions = 0;
|
||||||
|
|
||||||
@ -1291,6 +1275,21 @@ gdk_drag_begin (GdkWindow *window,
|
|||||||
ctx->ids.lpVtbl->Release (&ctx->ids);
|
ctx->ids.lpVtbl->Release (&ctx->ids);
|
||||||
|
|
||||||
return ctx->context;
|
return ctx->context;
|
||||||
|
#else
|
||||||
|
GdkDragContext *new_context;
|
||||||
|
|
||||||
|
g_return_val_if_fail (window != NULL, NULL);
|
||||||
|
|
||||||
|
new_context = gdk_drag_context_new ();
|
||||||
|
new_context->is_source = TRUE;
|
||||||
|
new_context->source_window = window;
|
||||||
|
g_object_ref (window);
|
||||||
|
|
||||||
|
new_context->targets = g_list_copy (targets);
|
||||||
|
|
||||||
|
new_context->actions = 0;
|
||||||
|
|
||||||
|
return new_context;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1301,15 +1300,20 @@ gdk_drag_get_protocol_for_display (GdkDisplay *display,
|
|||||||
{
|
{
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
|
|
||||||
GDK_NOTE (DND, g_print ("gdk_drag_get_protocol\n"));
|
|
||||||
|
|
||||||
window = gdk_window_lookup (xid);
|
window = gdk_window_lookup (xid);
|
||||||
|
if (window &&
|
||||||
if (GPOINTER_TO_INT (gdk_drawable_get_data (window, "gdk-dnd-registered")))
|
gdk_window_get_window_type (window) != GDK_WINDOW_FOREIGN)
|
||||||
{
|
{
|
||||||
|
if (g_object_get_data (G_OBJECT (window), "gdk-dnd-registered") != NULL)
|
||||||
|
{
|
||||||
|
#ifdef OLE2_DND
|
||||||
|
*protocol = GDK_DRAG_PROTO_OLE2;
|
||||||
|
#else
|
||||||
*protocol = GDK_DRAG_PROTO_LOCAL;
|
*protocol = GDK_DRAG_PROTO_LOCAL;
|
||||||
|
#endif
|
||||||
return xid;
|
return xid;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1381,7 +1385,11 @@ gdk_drag_find_window_for_screen (GdkDragContext *context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (context->source_window)
|
if (context->source_window)
|
||||||
|
#ifdef OLE2_DND
|
||||||
|
*protocol = GDK_DRAG_PROTO_OLE2;
|
||||||
|
#else
|
||||||
*protocol = GDK_DRAG_PROTO_LOCAL;
|
*protocol = GDK_DRAG_PROTO_LOCAL;
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
*protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
|
*protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
|
||||||
}
|
}
|
||||||
@ -1411,7 +1419,7 @@ gdk_drag_motion (GdkDragContext *context,
|
|||||||
|
|
||||||
GDK_NOTE (DND, g_print ("gdk_drag_motion\n"));
|
GDK_NOTE (DND, g_print ("gdk_drag_motion\n"));
|
||||||
|
|
||||||
private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
|
private = PRIVATE_DATA (context);
|
||||||
|
|
||||||
if (context->dest_window != dest_window)
|
if (context->dest_window != dest_window)
|
||||||
{
|
{
|
||||||
@ -1546,7 +1554,9 @@ gdk_drag_status (GdkDragContext *context,
|
|||||||
|
|
||||||
g_return_if_fail (context != NULL);
|
g_return_if_fail (context != NULL);
|
||||||
|
|
||||||
private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
|
GDK_NOTE (DND, g_print ("gdk_drag_status\n"));
|
||||||
|
|
||||||
|
private = PRIVATE_DATA (context);
|
||||||
|
|
||||||
context->action = action;
|
context->action = action;
|
||||||
|
|
||||||
@ -1556,7 +1566,7 @@ gdk_drag_status (GdkDragContext *context,
|
|||||||
|
|
||||||
if (src_context)
|
if (src_context)
|
||||||
{
|
{
|
||||||
GdkDragContextPrivateWin32 *private = GDK_DRAG_CONTEXT_PRIVATE_DATA (src_context);
|
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (src_context);
|
||||||
|
|
||||||
if (private->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
|
if (private->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
|
||||||
private->drag_status = GDK_DRAG_STATUS_DRAG;
|
private->drag_status = GDK_DRAG_STATUS_DRAG;
|
||||||
@ -1610,9 +1620,9 @@ gdk_drop_finish (GdkDragContext *context,
|
|||||||
|
|
||||||
g_return_if_fail (context != NULL);
|
g_return_if_fail (context != NULL);
|
||||||
|
|
||||||
GDK_NOTE (DND, g_print ("gdk_drop_finish"));
|
GDK_NOTE (DND, g_print ("gdk_drop_finish\n"));
|
||||||
|
|
||||||
private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
|
private = PRIVATE_DATA (context);
|
||||||
|
|
||||||
src_context = gdk_drag_context_find (TRUE,
|
src_context = gdk_drag_context_find (TRUE,
|
||||||
context->source_window,
|
context->source_window,
|
||||||
@ -1646,7 +1656,7 @@ gdk_destroy_filter (GdkXEvent *xev,
|
|||||||
idtp->lpVtbl->Release (idtp);
|
idtp->lpVtbl->Release (idtp);
|
||||||
#endif
|
#endif
|
||||||
RevokeDragDrop (msg->hwnd);
|
RevokeDragDrop (msg->hwnd);
|
||||||
CoLockObjectExternal (idtp, FALSE, TRUE);
|
CoLockObjectExternal ((IUnknown*) idtp, FALSE, TRUE);
|
||||||
}
|
}
|
||||||
return GDK_FILTER_CONTINUE;
|
return GDK_FILTER_CONTINUE;
|
||||||
}
|
}
|
||||||
@ -1662,13 +1672,12 @@ gdk_window_register_dnd (GdkWindow *window)
|
|||||||
|
|
||||||
g_return_if_fail (window != NULL);
|
g_return_if_fail (window != NULL);
|
||||||
|
|
||||||
if (GPOINTER_TO_INT (gdk_drawable_get_data (window, "gdk-dnd-registered")))
|
if (g_object_get_data (G_OBJECT (window), "gdk-dnd-registered") != NULL)
|
||||||
return;
|
return;
|
||||||
|
else
|
||||||
|
g_object_set_data (G_OBJECT (window), "gdk-dnd-registered", GINT_TO_POINTER (TRUE));
|
||||||
|
|
||||||
gdk_drawable_set_data (window, "gdk-dnd-registered", GINT_TO_POINTER(TRUE), NULL);
|
GDK_NOTE (DND, g_print ("gdk_window_register_dnd: %p\n", GDK_WINDOW_HWND (window)));
|
||||||
|
|
||||||
GDK_NOTE (DND, g_print ("gdk_window_register_dnd: %p\n",
|
|
||||||
GDK_WINDOW_HWND (window)));
|
|
||||||
|
|
||||||
/* We always claim to accept dropped files, but in fact we might not,
|
/* We always claim to accept dropped files, but in fact we might not,
|
||||||
* of course. This function is called in such a way that it cannot know
|
* of course. This function is called in such a way that it cannot know
|
||||||
@ -1734,7 +1743,7 @@ gdk_drag_drop_succeeded (GdkDragContext *context)
|
|||||||
|
|
||||||
g_return_val_if_fail (context != NULL, FALSE);
|
g_return_val_if_fail (context != NULL, FALSE);
|
||||||
|
|
||||||
private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context);
|
private = PRIVATE_DATA (context);
|
||||||
|
|
||||||
/* FIXME: Can we set drop_failed when the drop has failed? */
|
/* FIXME: Can we set drop_failed when the drop has failed? */
|
||||||
return !private->drop_failed;
|
return !private->drop_failed;
|
||||||
|
Loading…
Reference in New Issue
Block a user