mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
Merge branch 'dnd-cleanups' into 'master'
Dnd cleanups See merge request GNOME/gtk!226
This commit is contained in:
commit
12464731f1
@ -120,7 +120,7 @@ get_image_paintable (GtkImage *image)
|
||||
|
||||
static void
|
||||
drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
@ -128,14 +128,14 @@ drag_begin (GtkWidget *widget,
|
||||
paintable = get_image_paintable (GTK_IMAGE (widget));
|
||||
if (paintable)
|
||||
{
|
||||
gtk_drag_set_icon_paintable (context, paintable, -2, -2);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, -2, -2);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
gpointer data)
|
||||
|
@ -376,7 +376,7 @@ search_mode_toggled (GObject *searchbar, GParamSpec *pspec, IconBrowserWindow *w
|
||||
|
||||
static void
|
||||
get_image_data (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection,
|
||||
guint target_info,
|
||||
gpointer data)
|
||||
@ -398,7 +398,7 @@ get_image_data (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
get_scalable_image_data (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection,
|
||||
guint target_info,
|
||||
gpointer data)
|
||||
|
@ -774,38 +774,60 @@ gdk_cursor_get_type
|
||||
<SECTION>
|
||||
<TITLE>Drag and Drop</TITLE>
|
||||
<FILE>dnd</FILE>
|
||||
GdkDragContext
|
||||
GdkDrag
|
||||
GdkDrop
|
||||
GdkDragCancelReason
|
||||
gdk_drag_drop_done
|
||||
gdk_drag_begin
|
||||
GdkDragAction
|
||||
GDK_ACTION_ALL
|
||||
|
||||
gdk_drag_context_get_display
|
||||
gdk_drag_context_get_actions
|
||||
gdk_drag_context_get_suggested_action
|
||||
gdk_drag_context_get_selected_action
|
||||
gdk_drag_context_get_formats
|
||||
gdk_drag_context_get_device
|
||||
gdk_drag_context_get_drag_surface
|
||||
gdk_drag_context_set_hotspot
|
||||
gdk_drag_get_display
|
||||
gdk_drag_get_actions
|
||||
gdk_drag_get_suggested_action
|
||||
gdk_drag_get_selected_action
|
||||
gdk_drag_get_formats
|
||||
gdk_drag_get_device
|
||||
gdk_drag_get_drag_surface
|
||||
gdk_drag_set_hotspot
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_drag_action_is_unique
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_drop_get_display
|
||||
gdk_drop_get_device
|
||||
gdk_drop_get_surface
|
||||
gdk_drop_get_formats
|
||||
gdk_drop_get_actions
|
||||
gdk_drop_get_drag
|
||||
gdk_drop_status
|
||||
gdk_drop_finish
|
||||
gdk_drop_read_async
|
||||
gdk_drop_read_finish
|
||||
gdk_drop_read_value_async
|
||||
gdk_drop_read_value_finish
|
||||
gdk_drop_read_text_async
|
||||
gdk_drop_read_text_finish
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_DRAG_CONTEXT
|
||||
GDK_TYPE_DRAG_CONTEXT
|
||||
GDK_IS_DRAG_CONTEXT
|
||||
GDK_DRAG_CONTEXT_CLASS
|
||||
GDK_DRAG_CONTEXT_GET_CLASS
|
||||
GDK_IS_DRAG_CONTEXT_CLASS
|
||||
GDK_DRAG
|
||||
GDK_TYPE_DRAG
|
||||
GDK_IS_DRAG
|
||||
GDK_DRAG_CLASS
|
||||
GDK_DRAG_GET_CLASS
|
||||
GDK_IS_DRAG_CLASS
|
||||
GDK_TYPE_DRAG_ACTION
|
||||
GDK_TYPE_DRAG_PROTOCOL
|
||||
GDK_TYPE_DROP
|
||||
GDK_DROP
|
||||
GDK_IS_DROP
|
||||
|
||||
<SUBSECTION Private>
|
||||
GdkDragContextClass
|
||||
gdk_drag_context_get_type
|
||||
GdkDragClass
|
||||
gdk_drag_get_type
|
||||
GdkDropClass
|
||||
gdk_drop_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkdragprivate.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkproperty.h"
|
||||
@ -34,56 +34,56 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define GDK_TYPE_BROADWAY_DRAG_CONTEXT (gdk_broadway_drag_context_get_type ())
|
||||
#define GDK_BROADWAY_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContext))
|
||||
#define GDK_BROADWAY_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass))
|
||||
#define GDK_IS_BROADWAY_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT))
|
||||
#define GDK_IS_BROADWAY_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT))
|
||||
#define GDK_BROADWAY_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass))
|
||||
#define GDK_TYPE_BROADWAY_DRAG (gdk_broadway_drag_get_type ())
|
||||
#define GDK_BROADWAY_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DRAG, GdkBroadwayDrag))
|
||||
#define GDK_BROADWAY_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_DRAG, GdkBroadwayDragClass))
|
||||
#define GDK_IS_BROADWAY_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_DRAG))
|
||||
#define GDK_IS_BROADWAY_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_DRAG))
|
||||
#define GDK_BROADWAY_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_DRAG, GdkBroadwayDragClass))
|
||||
|
||||
#ifdef GDK_COMPILATION
|
||||
typedef struct _GdkBroadwayDragContext GdkBroadwayDragContext;
|
||||
typedef struct _GdkBroadwayDrag GdkBroadwayDrag;
|
||||
#else
|
||||
typedef GdkDragContext GdkBroadwayDragContext;
|
||||
typedef GdkDrag GdkBroadwayDrag;
|
||||
#endif
|
||||
typedef struct _GdkBroadwayDragContextClass GdkBroadwayDragContextClass;
|
||||
typedef struct _GdkBroadwayDragClass GdkBroadwayDragClass;
|
||||
|
||||
GType gdk_broadway_drag_context_get_type (void);
|
||||
GType gdk_broadway_drag_get_type (void);
|
||||
|
||||
struct _GdkBroadwayDragContext {
|
||||
GdkDragContext context;
|
||||
struct _GdkBroadwayDrag {
|
||||
GdkDrag context;
|
||||
};
|
||||
|
||||
struct _GdkBroadwayDragContextClass
|
||||
struct _GdkBroadwayDragClass
|
||||
{
|
||||
GdkDragContextClass parent_class;
|
||||
GdkDragClass parent_class;
|
||||
};
|
||||
|
||||
static void gdk_broadway_drag_context_finalize (GObject *object);
|
||||
static void gdk_broadway_drag_finalize (GObject *object);
|
||||
|
||||
static GList *contexts;
|
||||
|
||||
G_DEFINE_TYPE (GdkBroadwayDragContext, gdk_broadway_drag_context, GDK_TYPE_DRAG_CONTEXT)
|
||||
G_DEFINE_TYPE (GdkBroadwayDrag, gdk_broadway_drag, GDK_TYPE_DRAG)
|
||||
|
||||
static void
|
||||
gdk_broadway_drag_context_init (GdkBroadwayDragContext *dragcontext)
|
||||
gdk_broadway_drag_init (GdkBroadwayDrag *dragcontext)
|
||||
{
|
||||
contexts = g_list_prepend (contexts, dragcontext);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_drag_context_finalize (GObject *object)
|
||||
gdk_broadway_drag_finalize (GObject *object)
|
||||
{
|
||||
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
|
||||
GdkDrag *context = GDK_DRAG (object);
|
||||
|
||||
contexts = g_list_remove (contexts, context);
|
||||
|
||||
G_OBJECT_CLASS (gdk_broadway_drag_context_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (gdk_broadway_drag_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/* Drag Contexts */
|
||||
|
||||
GdkDragContext *
|
||||
GdkDrag *
|
||||
_gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
@ -91,12 +91,12 @@ _gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
gint dx,
|
||||
gint dy)
|
||||
{
|
||||
GdkDragContext *new_context;
|
||||
GdkDrag *new_context;
|
||||
|
||||
g_return_val_if_fail (surface != NULL, NULL);
|
||||
g_return_val_if_fail (GDK_SURFACE_IS_BROADWAY (surface), NULL);
|
||||
|
||||
new_context = g_object_new (GDK_TYPE_BROADWAY_DRAG_CONTEXT,
|
||||
new_context = g_object_new (GDK_TYPE_BROADWAY_DRAG,
|
||||
"device", device,
|
||||
"content", content,
|
||||
NULL);
|
||||
@ -105,14 +105,14 @@ _gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_drag_context_drag_drop (GdkDragContext *context,
|
||||
gdk_broadway_drag_drag_drop (GdkDrag *context,
|
||||
guint32 time)
|
||||
{
|
||||
g_return_if_fail (context != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_drag_context_drag_abort (GdkDragContext *context,
|
||||
gdk_broadway_drag_drag_abort (GdkDrag *context,
|
||||
guint32 time)
|
||||
{
|
||||
g_return_if_fail (context != NULL);
|
||||
@ -129,13 +129,13 @@ _gdk_broadway_display_init_dnd (GdkDisplay *display)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_drag_context_class_init (GdkBroadwayDragContextClass *klass)
|
||||
gdk_broadway_drag_class_init (GdkBroadwayDragClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
|
||||
GdkDragClass *context_class = GDK_DRAG_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_broadway_drag_context_finalize;
|
||||
object_class->finalize = gdk_broadway_drag_finalize;
|
||||
|
||||
context_class->drag_abort = gdk_broadway_drag_context_drag_abort;
|
||||
context_class->drag_drop = gdk_broadway_drag_context_drag_drop;
|
||||
context_class->drag_abort = gdk_broadway_drag_drag_abort;
|
||||
context_class->drag_drop = gdk_broadway_drag_drag_drop;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ void gdk_broadway_surface_set_nodes (GdkSurface *surface,
|
||||
GPtrArray *node_textures);
|
||||
|
||||
void _gdk_broadway_surface_register_dnd (GdkSurface *surface);
|
||||
GdkDragContext * _gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDrag * _gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
|
@ -27,7 +27,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkCursor, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDevice, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplay, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplayManager, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDragContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrag, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrawContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameClock, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkGLContext, g_object_unref)
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include <gdk/gdkdevicetool.h>
|
||||
#include <gdk/gdkdisplay.h>
|
||||
#include <gdk/gdkdisplaymanager.h>
|
||||
#include <gdk/gdkdnd.h>
|
||||
#include <gdk/gdkdrag.h>
|
||||
#include <gdk/gdkdrawcontext.h>
|
||||
#include <gdk/gdkdrop.h>
|
||||
#include <gdk/gdkenumtypes.h>
|
||||
|
100
gdk/gdkdnd.h
100
gdk/gdkdnd.h
@ -1,100 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_DND_H__
|
||||
#define __GDK_DND_H__
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdevice.h>
|
||||
#include <gdk/gdkevents.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_DRAG_CONTEXT (gdk_drag_context_get_type ())
|
||||
#define GDK_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG_CONTEXT, GdkDragContext))
|
||||
#define GDK_IS_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG_CONTEXT))
|
||||
|
||||
/**
|
||||
* GdkDragCancelReason:
|
||||
* @GDK_DRAG_CANCEL_NO_TARGET: There is no suitable drop target.
|
||||
* @GDK_DRAG_CANCEL_USER_CANCELLED: Drag cancelled by the user
|
||||
* @GDK_DRAG_CANCEL_ERROR: Unspecified error.
|
||||
*
|
||||
* Used in #GdkDragContext to the reason of a cancelled DND operation.
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_DRAG_CANCEL_NO_TARGET,
|
||||
GDK_DRAG_CANCEL_USER_CANCELLED,
|
||||
GDK_DRAG_CANCEL_ERROR
|
||||
} GdkDragCancelReason;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_drag_context_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDisplay * gdk_drag_context_get_display (GdkDragContext *context);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDevice * gdk_drag_context_get_device (GdkDragContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkContentFormats *gdk_drag_context_get_formats (GdkDragContext *context);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drag_context_get_actions (GdkDragContext *context);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drag_context_get_suggested_action (GdkDragContext *context);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drag_context_get_selected_action (GdkDragContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_drag_action_is_unique (GdkDragAction action);
|
||||
|
||||
/* Source side */
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragContext * gdk_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_drag_drop_done (GdkDragContext *context,
|
||||
gboolean success);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface *gdk_drag_context_get_drag_surface (GdkDragContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_drag_context_set_hotspot (GdkDragContext *context,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DND_H__ */
|
@ -1,105 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2010, Red Hat, Inc
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_DND_PRIVATE_H__
|
||||
#define __GDK_DND_PRIVATE_H__
|
||||
|
||||
#include "gdkdnd.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GDK_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
|
||||
#define GDK_IS_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG_CONTEXT))
|
||||
#define GDK_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
|
||||
|
||||
typedef struct _GdkDragContextClass GdkDragContextClass;
|
||||
|
||||
|
||||
struct _GdkDragContextClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (*drag_abort) (GdkDragContext *context,
|
||||
guint32 time_);
|
||||
void (*drag_drop) (GdkDragContext *context,
|
||||
guint32 time_);
|
||||
GdkSurface* (*get_drag_surface) (GdkDragContext *context);
|
||||
void (*set_hotspot) (GdkDragContext *context,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
void (*drop_done) (GdkDragContext *context,
|
||||
gboolean success);
|
||||
|
||||
void (*set_cursor) (GdkDragContext *context,
|
||||
GdkCursor *cursor);
|
||||
void (*cancel) (GdkDragContext *context,
|
||||
GdkDragCancelReason reason);
|
||||
void (*drop_performed) (GdkDragContext *context,
|
||||
guint32 time);
|
||||
void (*dnd_finished) (GdkDragContext *context);
|
||||
|
||||
gboolean (*handle_event) (GdkDragContext *context,
|
||||
const GdkEvent *event);
|
||||
void (*action_changed) (GdkDragContext *context,
|
||||
GdkDragAction action);
|
||||
};
|
||||
|
||||
struct _GdkDragContext {
|
||||
GObject parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
GdkSurface *source_surface;
|
||||
GdkSurface *drag_surface;
|
||||
|
||||
GdkContentProvider *content;
|
||||
GdkDragAction action;
|
||||
|
||||
guint drop_done : 1; /* Whether gdk_drag_drop_done() was performed */
|
||||
};
|
||||
|
||||
void gdk_drag_context_set_cursor (GdkDragContext *context,
|
||||
GdkCursor *cursor);
|
||||
void gdk_drag_context_set_actions (GdkDragContext *context,
|
||||
GdkDragAction actions,
|
||||
GdkDragAction suggested_action);
|
||||
|
||||
void gdk_drag_context_cancel (GdkDragContext *context,
|
||||
GdkDragCancelReason reason);
|
||||
gboolean gdk_drag_context_handle_source_event (GdkEvent *event);
|
||||
GdkCursor * gdk_drag_get_cursor (GdkDragContext *context,
|
||||
GdkDragAction action);
|
||||
|
||||
void gdk_drag_abort (GdkDragContext *context,
|
||||
guint32 time_);
|
||||
void gdk_drag_drop (GdkDragContext *context,
|
||||
guint32 time_);
|
||||
|
||||
void gdk_drag_context_write_async (GdkDragContext *context,
|
||||
const char *mime_type,
|
||||
GOutputStream *stream,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean gdk_drag_context_write_finish (GdkDragContext *context,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdksurface.h"
|
||||
#include "gdkintl.h"
|
||||
@ -35,9 +35,9 @@
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
|
||||
typedef struct _GdkDragContextPrivate GdkDragContextPrivate;
|
||||
typedef struct _GdkDragPrivate GdkDragPrivate;
|
||||
|
||||
struct _GdkDragContextPrivate
|
||||
struct _GdkDragPrivate
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkDevice *device;
|
||||
@ -77,9 +77,9 @@ enum {
|
||||
|
||||
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
|
||||
static guint signals[N_SIGNALS] = { 0 };
|
||||
static GList *contexts = NULL;
|
||||
static GList *drags = NULL;
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDragContext, gdk_drag_context, G_TYPE_OBJECT)
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDrag, gdk_drag, G_TYPE_OBJECT)
|
||||
|
||||
/**
|
||||
* SECTION:dnd
|
||||
@ -98,142 +98,142 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDragContext, gdk_drag_context, G_TYPE_OB
|
||||
*/
|
||||
|
||||
/**
|
||||
* GdkDragContext:
|
||||
* GdkDrag:
|
||||
*
|
||||
* The GdkDragContext struct contains only private fields and
|
||||
* The GdkDrag struct contains only private fields and
|
||||
* should not be accessed directly.
|
||||
*/
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_display:
|
||||
* @context: a #GdkDragContext
|
||||
* gdk_drag_get_display:
|
||||
* @drag: a #GdkDrag
|
||||
*
|
||||
* Gets the #GdkDisplay that the drag context was created for.
|
||||
* Gets the #GdkDisplay that the drag object was created for.
|
||||
*
|
||||
* Returns: (transfer none): a #GdkDisplay
|
||||
**/
|
||||
GdkDisplay *
|
||||
gdk_drag_context_get_display (GdkDragContext *context)
|
||||
gdk_drag_get_display (GdkDrag *drag)
|
||||
{
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
|
||||
|
||||
return priv->display;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_formats:
|
||||
* @context: a #GdkDragContext
|
||||
* gdk_drag_get_formats:
|
||||
* @drag: a #GdkDrag
|
||||
*
|
||||
* Retrieves the formats supported by this context.
|
||||
* Retrieves the formats supported by this GdkDrag object.
|
||||
*
|
||||
* Returns: (transfer none): a #GdkContentFormats
|
||||
**/
|
||||
GdkContentFormats *
|
||||
gdk_drag_context_get_formats (GdkDragContext *context)
|
||||
gdk_drag_get_formats (GdkDrag *drag)
|
||||
{
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
|
||||
|
||||
return priv->formats;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_actions:
|
||||
* @context: a #GdkDragContext
|
||||
* gdk_drag_get_actions:
|
||||
* @drag: a #GdkDrag
|
||||
*
|
||||
* Determines the bitmask of actions proposed by the source if
|
||||
* gdk_drag_context_get_suggested_action() returns %GDK_ACTION_ASK.
|
||||
* gdk_drag_get_suggested_action() returns %GDK_ACTION_ASK.
|
||||
*
|
||||
* Returns: the #GdkDragAction flags
|
||||
**/
|
||||
GdkDragAction
|
||||
gdk_drag_context_get_actions (GdkDragContext *context)
|
||||
gdk_drag_get_actions (GdkDrag *drag)
|
||||
{
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
|
||||
g_return_val_if_fail (GDK_IS_DRAG (drag), 0);
|
||||
|
||||
return priv->actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_suggested_action:
|
||||
* @context: a #GdkDragContext
|
||||
* gdk_drag_get_suggested_action:
|
||||
* @drag: a #GdkDrag
|
||||
*
|
||||
* Determines the suggested drag action of the context.
|
||||
* Determines the suggested drag action of the GdkDrag object.
|
||||
*
|
||||
* Returns: a #GdkDragAction value
|
||||
**/
|
||||
GdkDragAction
|
||||
gdk_drag_context_get_suggested_action (GdkDragContext *context)
|
||||
gdk_drag_get_suggested_action (GdkDrag *drag)
|
||||
{
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
|
||||
g_return_val_if_fail (GDK_IS_DRAG (drag), 0);
|
||||
|
||||
return priv->suggested_action;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_selected_action:
|
||||
* @context: a #GdkDragContext
|
||||
* gdk_drag_get_selected_action:
|
||||
* @drag: a #GdkDrag
|
||||
*
|
||||
* Determines the action chosen by the drag destination.
|
||||
*
|
||||
* Returns: a #GdkDragAction value
|
||||
**/
|
||||
GdkDragAction
|
||||
gdk_drag_context_get_selected_action (GdkDragContext *context)
|
||||
gdk_drag_get_selected_action (GdkDrag *drag)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
|
||||
g_return_val_if_fail (GDK_IS_DRAG (drag), 0);
|
||||
|
||||
return context->action;
|
||||
return drag->action;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_device:
|
||||
* @context: a #GdkDragContext
|
||||
* gdk_drag_get_device:
|
||||
* @drag: a #GdkDrag
|
||||
*
|
||||
* Returns the #GdkDevice associated to the drag context.
|
||||
* Returns the #GdkDevice associated to the GdkDrag object.
|
||||
*
|
||||
* Returns: (transfer none): The #GdkDevice associated to @context.
|
||||
* Returns: (transfer none): The #GdkDevice associated to @drag.
|
||||
**/
|
||||
GdkDevice *
|
||||
gdk_drag_context_get_device (GdkDragContext *context)
|
||||
gdk_drag_get_device (GdkDrag *drag)
|
||||
{
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
|
||||
|
||||
return priv->device;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_init (GdkDragContext *context)
|
||||
gdk_drag_init (GdkDrag *drag)
|
||||
{
|
||||
contexts = g_list_prepend (contexts, context);
|
||||
drags = g_list_prepend (drags, drag);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
gdk_drag_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkDragContext *context = GDK_DRAG_CONTEXT (gobject);
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDrag *drag = GDK_DRAG (gobject);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_CONTENT:
|
||||
context->content = g_value_dup_object (value);
|
||||
if (context->content)
|
||||
drag->content = g_value_dup_object (value);
|
||||
if (drag->content)
|
||||
{
|
||||
g_assert (priv->formats == NULL);
|
||||
priv->formats = gdk_content_provider_ref_formats (context->content);
|
||||
priv->formats = gdk_content_provider_ref_formats (drag->content);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -267,18 +267,18 @@ gdk_drag_context_set_property (GObject *gobject,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
gdk_drag_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkDragContext *context = GDK_DRAG_CONTEXT (gobject);
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDrag *drag = GDK_DRAG (gobject);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_CONTENT:
|
||||
g_value_set_object (value, context->content);
|
||||
g_value_set_object (value, drag->content);
|
||||
break;
|
||||
|
||||
case PROP_DEVICE:
|
||||
@ -300,36 +300,35 @@ gdk_drag_context_get_property (GObject *gobject,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_finalize (GObject *object)
|
||||
gdk_drag_finalize (GObject *object)
|
||||
{
|
||||
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDrag *drag = GDK_DRAG (object);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
contexts = g_list_remove (contexts, context);
|
||||
drags = g_list_remove (drags, drag);
|
||||
|
||||
g_clear_object (&context->content);
|
||||
g_clear_object (&drag->content);
|
||||
g_clear_pointer (&priv->formats, gdk_content_formats_unref);
|
||||
|
||||
if (context->source_surface)
|
||||
g_object_unref (context->source_surface);
|
||||
if (drag->source_surface)
|
||||
g_object_unref (drag->source_surface);
|
||||
|
||||
G_OBJECT_CLASS (gdk_drag_context_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (gdk_drag_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_class_init (GdkDragContextClass *klass)
|
||||
gdk_drag_class_init (GdkDragClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->get_property = gdk_drag_context_get_property;
|
||||
object_class->set_property = gdk_drag_context_set_property;
|
||||
object_class->finalize = gdk_drag_context_finalize;
|
||||
object_class->get_property = gdk_drag_get_property;
|
||||
object_class->set_property = gdk_drag_set_property;
|
||||
object_class->finalize = gdk_drag_finalize;
|
||||
|
||||
/**
|
||||
* GdkDragContext:content:
|
||||
* GdkDrag:content:
|
||||
*
|
||||
* The #GdkContentProvider or %NULL if the context is not a source-side
|
||||
* context.
|
||||
* The #GdkContentProvider.
|
||||
*/
|
||||
properties[PROP_CONTENT] =
|
||||
g_param_spec_object ("content",
|
||||
@ -342,7 +341,7 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDragContext:device:
|
||||
* GdkDrag:device:
|
||||
*
|
||||
* The #GdkDevice that is performing the drag.
|
||||
*/
|
||||
@ -357,9 +356,9 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDragContext:display:
|
||||
* GdkDrag:display:
|
||||
*
|
||||
* The #GdkDisplay that the drag context belongs to.
|
||||
* The #GdkDisplay that the drag belongs to.
|
||||
*/
|
||||
properties[PROP_DISPLAY] =
|
||||
g_param_spec_object ("display",
|
||||
@ -371,9 +370,9 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDragContext:formats:
|
||||
* GdkDrag:formats:
|
||||
*
|
||||
* The possible formats that the context can provide its data in.
|
||||
* The possible formats that the drag can provide its data in.
|
||||
*/
|
||||
properties[PROP_FORMATS] =
|
||||
g_param_spec_boxed ("formats",
|
||||
@ -386,65 +385,65 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDragContext::cancel:
|
||||
* @context: The object on which the signal is emitted
|
||||
* @reason: The reason the context was cancelled
|
||||
* GdkDrag::cancel:
|
||||
* @drag: The object on which the signal is emitted
|
||||
* @reason: The reason the drag was cancelled
|
||||
*
|
||||
* The drag and drop operation was cancelled.
|
||||
* The drag operation was cancelled.
|
||||
*/
|
||||
signals[CANCEL] =
|
||||
g_signal_new (g_intern_static_string ("cancel"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkDragContextClass, cancel),
|
||||
G_STRUCT_OFFSET (GdkDragClass, cancel),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__ENUM,
|
||||
G_TYPE_NONE, 1, GDK_TYPE_DRAG_CANCEL_REASON);
|
||||
|
||||
/**
|
||||
* GdkDragContext::drop-performed:
|
||||
* @context: The object on which the signal is emitted
|
||||
* GdkDrag::drop-performed:
|
||||
* @drag: The object on which the signal is emitted
|
||||
*
|
||||
* The drag and drop operation was performed on an accepting client.
|
||||
* The drag operation was performed on an accepting client.
|
||||
*/
|
||||
signals[DROP_PERFORMED] =
|
||||
g_signal_new (g_intern_static_string ("drop-performed"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkDragContextClass, drop_performed),
|
||||
G_STRUCT_OFFSET (GdkDragClass, drop_performed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GdkDragContext::dnd-finished:
|
||||
* @context: The object on which the signal is emitted
|
||||
* GdkDrag::dnd-finished:
|
||||
* @drag: The object on which the signal is emitted
|
||||
*
|
||||
* The drag and drop operation was finished, the drag destination
|
||||
* finished reading all data. The drag source can now free all
|
||||
* miscellaneous data.
|
||||
* The drag operation was finished, the destination
|
||||
* finished reading all data. The drag object can now
|
||||
* free all miscellaneous data.
|
||||
*/
|
||||
signals[DND_FINISHED] =
|
||||
g_signal_new (g_intern_static_string ("dnd-finished"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkDragContextClass, dnd_finished),
|
||||
G_STRUCT_OFFSET (GdkDragClass, dnd_finished),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GdkDragContext::action-changed:
|
||||
* @context: The object on which the signal is emitted
|
||||
* GdkDrag::action-changed:
|
||||
* @drag: The object on which the signal is emitted
|
||||
* @action: The action currently chosen
|
||||
*
|
||||
* A new action is being chosen for the drag and drop operation.
|
||||
* A new action is being chosen for the drag operation.
|
||||
*/
|
||||
signals[ACTION_CHANGED] =
|
||||
g_signal_new (g_intern_static_string ("action-changed"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkDragContextClass, action_changed),
|
||||
G_STRUCT_OFFSET (GdkDragClass, action_changed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__FLAGS,
|
||||
G_TYPE_NONE, 1, GDK_TYPE_DRAG_ACTION);
|
||||
@ -454,7 +453,7 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
|
||||
|
||||
/*
|
||||
* gdk_drag_abort:
|
||||
* @context: a #GdkDragContext
|
||||
* @drag: a #GdkDrag
|
||||
* @time_: the timestamp for this operation
|
||||
*
|
||||
* Aborts a drag without dropping.
|
||||
@ -462,17 +461,17 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
|
||||
* This function is called by the drag source.
|
||||
*/
|
||||
void
|
||||
gdk_drag_abort (GdkDragContext *context,
|
||||
guint32 time_)
|
||||
gdk_drag_abort (GdkDrag *drag,
|
||||
guint32 time_)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
|
||||
GDK_DRAG_CONTEXT_GET_CLASS (context)->drag_abort (context, time_);
|
||||
GDK_DRAG_GET_CLASS (drag)->drag_abort (drag, time_);
|
||||
}
|
||||
|
||||
/*
|
||||
* gdk_drag_drop:
|
||||
* @context: a #GdkDragContext
|
||||
* @drag: a #GdkDrag
|
||||
* @time_: the timestamp for this operation
|
||||
*
|
||||
* Drops on the current destination.
|
||||
@ -480,18 +479,18 @@ gdk_drag_abort (GdkDragContext *context,
|
||||
* This function is called by the drag source.
|
||||
*/
|
||||
void
|
||||
gdk_drag_drop (GdkDragContext *context,
|
||||
guint32 time_)
|
||||
gdk_drag_drop (GdkDrag *drag,
|
||||
guint32 time_)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
|
||||
GDK_DRAG_CONTEXT_GET_CLASS (context)->drag_drop (context, time_);
|
||||
GDK_DRAG_GET_CLASS (drag)->drag_drop (drag, time_);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_write_done (GObject *content,
|
||||
GAsyncResult *result,
|
||||
gpointer task)
|
||||
gdk_drag_write_done (GObject *content,
|
||||
GAsyncResult *result,
|
||||
gpointer task)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
@ -504,9 +503,9 @@ gdk_drag_context_write_done (GObject *content,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_write_serialize_done (GObject *content,
|
||||
GAsyncResult *result,
|
||||
gpointer task)
|
||||
gdk_drag_write_serialize_done (GObject *content,
|
||||
GAsyncResult *result,
|
||||
gpointer task)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
@ -519,39 +518,39 @@ gdk_drag_context_write_serialize_done (GObject *content,
|
||||
}
|
||||
|
||||
void
|
||||
gdk_drag_context_write_async (GdkDragContext *context,
|
||||
const char *mime_type,
|
||||
GOutputStream *stream,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
gdk_drag_write_async (GdkDrag *drag,
|
||||
const char *mime_type,
|
||||
GOutputStream *stream,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkContentFormats *formats, *mime_formats;
|
||||
GTask *task;
|
||||
GType gtype;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (context->content);
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
g_return_if_fail (drag->content);
|
||||
g_return_if_fail (mime_type != NULL);
|
||||
g_return_if_fail (mime_type == g_intern_string (mime_type));
|
||||
g_return_if_fail (G_IS_OUTPUT_STREAM (stream));
|
||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
task = g_task_new (context, cancellable, callback, user_data);
|
||||
task = g_task_new (drag, cancellable, callback, user_data);
|
||||
g_task_set_priority (task, io_priority);
|
||||
g_task_set_source_tag (task, gdk_drag_context_write_async);
|
||||
g_task_set_source_tag (task, gdk_drag_write_async);
|
||||
|
||||
formats = gdk_content_provider_ref_formats (context->content);
|
||||
formats = gdk_content_provider_ref_formats (drag->content);
|
||||
if (gdk_content_formats_contain_mime_type (formats, mime_type))
|
||||
{
|
||||
gdk_content_provider_write_mime_type_async (context->content,
|
||||
gdk_content_provider_write_mime_type_async (drag->content,
|
||||
mime_type,
|
||||
stream,
|
||||
io_priority,
|
||||
cancellable,
|
||||
gdk_drag_context_write_done,
|
||||
gdk_drag_write_done,
|
||||
task);
|
||||
gdk_content_formats_unref (formats);
|
||||
return;
|
||||
@ -568,14 +567,14 @@ gdk_drag_context_write_async (GdkDragContext *context,
|
||||
g_assert (gtype != G_TYPE_INVALID);
|
||||
|
||||
g_value_init (&value, gtype);
|
||||
if (gdk_content_provider_get_value (context->content, &value, &error))
|
||||
if (gdk_content_provider_get_value (drag->content, &value, &error))
|
||||
{
|
||||
gdk_content_serialize_async (stream,
|
||||
mime_type,
|
||||
&value,
|
||||
io_priority,
|
||||
cancellable,
|
||||
gdk_drag_context_write_serialize_done,
|
||||
gdk_drag_write_serialize_done,
|
||||
g_object_ref (task));
|
||||
}
|
||||
else
|
||||
@ -597,54 +596,54 @@ gdk_drag_context_write_async (GdkDragContext *context,
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_drag_context_write_finish (GdkDragContext *context,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
gdk_drag_write_finish (GdkDrag *drag,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (g_task_is_valid (result, context), FALSE);
|
||||
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_drag_context_write_async, FALSE);
|
||||
g_return_val_if_fail (g_task_is_valid (result, drag), FALSE);
|
||||
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_drag_write_async, FALSE);
|
||||
|
||||
return g_task_propagate_boolean (G_TASK (result), error);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_drag_context_set_actions (GdkDragContext *context,
|
||||
GdkDragAction actions,
|
||||
GdkDragAction suggested_action)
|
||||
gdk_drag_set_actions (GdkDrag *drag,
|
||||
GdkDragAction actions,
|
||||
GdkDragAction suggested_action)
|
||||
{
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
priv->actions = actions;
|
||||
priv->suggested_action = suggested_action;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_drag_surface:
|
||||
* @context: a #GdkDragContext
|
||||
* gdk_drag_get_drag_surface:
|
||||
* @drag: a #GdkDrag
|
||||
*
|
||||
* Returns the surface on which the drag icon should be rendered
|
||||
* during the drag operation. Note that the surface may not be
|
||||
* available until the drag operation has begun. GDK will move
|
||||
* the surface in accordance with the ongoing drag operation.
|
||||
* The surface is owned by @context and will be destroyed when
|
||||
* The surface is owned by @drag and will be destroyed when
|
||||
* the drag operation is over.
|
||||
*
|
||||
* Returns: (nullable) (transfer none): the drag surface, or %NULL
|
||||
*/
|
||||
GdkSurface *
|
||||
gdk_drag_context_get_drag_surface (GdkDragContext *context)
|
||||
gdk_drag_get_drag_surface (GdkDrag *drag)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
|
||||
|
||||
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->get_drag_surface)
|
||||
return GDK_DRAG_CONTEXT_GET_CLASS (context)->get_drag_surface (context);
|
||||
if (GDK_DRAG_GET_CLASS (drag)->get_drag_surface)
|
||||
return GDK_DRAG_GET_CLASS (drag)->get_drag_surface (drag);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_set_hotspot:
|
||||
* @context: a #GdkDragContext
|
||||
* gdk_drag_set_hotspot:
|
||||
* @drag: a #GdkDrag
|
||||
* @hot_x: x coordinate of the drag surface hotspot
|
||||
* @hot_y: y coordinate of the drag surface hotspot
|
||||
*
|
||||
@ -653,19 +652,19 @@ gdk_drag_context_get_drag_surface (GdkDragContext *context)
|
||||
* top left corner of the drag surface.
|
||||
*/
|
||||
void
|
||||
gdk_drag_context_set_hotspot (GdkDragContext *context,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
gdk_drag_set_hotspot (GdkDrag *drag,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
|
||||
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->set_hotspot)
|
||||
GDK_DRAG_CONTEXT_GET_CLASS (context)->set_hotspot (context, hot_x, hot_y);
|
||||
if (GDK_DRAG_GET_CLASS (drag)->set_hotspot)
|
||||
GDK_DRAG_GET_CLASS (drag)->set_hotspot (drag, hot_x, hot_y);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_drop_done:
|
||||
* @context: a #GdkDragContext
|
||||
* @drag: a #GdkDrag
|
||||
* @success: whether the drag was ultimatively successful
|
||||
*
|
||||
* Inform GDK if the drop ended successfully. Passing %FALSE
|
||||
@ -673,60 +672,60 @@ gdk_drag_context_set_hotspot (GdkDragContext *context,
|
||||
*
|
||||
* This function is called by the drag source, and should
|
||||
* be the last call before dropping the reference to the
|
||||
* @context.
|
||||
* @drag.
|
||||
*
|
||||
* The #GdkDragContext will only take the first gdk_drag_drop_done()
|
||||
* The #GdkDrag will only take the first gdk_drag_drop_done()
|
||||
* call as effective, if this function is called multiple times,
|
||||
* all subsequent calls will be ignored.
|
||||
*/
|
||||
void
|
||||
gdk_drag_drop_done (GdkDragContext *context,
|
||||
gboolean success)
|
||||
gdk_drag_drop_done (GdkDrag *drag,
|
||||
gboolean success)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
|
||||
if (context->drop_done)
|
||||
if (drag->drop_done)
|
||||
return;
|
||||
|
||||
context->drop_done = TRUE;
|
||||
drag->drop_done = TRUE;
|
||||
|
||||
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_done)
|
||||
GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_done (context, success);
|
||||
if (GDK_DRAG_GET_CLASS (drag)->drop_done)
|
||||
GDK_DRAG_GET_CLASS (drag)->drop_done (drag, success);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_drag_context_set_cursor (GdkDragContext *context,
|
||||
GdkCursor *cursor)
|
||||
gdk_drag_set_cursor (GdkDrag *drag,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
|
||||
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->set_cursor)
|
||||
GDK_DRAG_CONTEXT_GET_CLASS (context)->set_cursor (context, cursor);
|
||||
if (GDK_DRAG_GET_CLASS (drag)->set_cursor)
|
||||
GDK_DRAG_GET_CLASS (drag)->set_cursor (drag, cursor);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_drag_context_cancel (GdkDragContext *context,
|
||||
GdkDragCancelReason reason)
|
||||
gdk_drag_cancel (GdkDrag *drag,
|
||||
GdkDragCancelReason reason)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
|
||||
g_signal_emit (context, signals[CANCEL], 0, reason);
|
||||
g_signal_emit (drag, signals[CANCEL], 0, reason);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_drag_context_handle_source_event (GdkEvent *event)
|
||||
gdk_drag_handle_source_event (GdkEvent *event)
|
||||
{
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
GList *l;
|
||||
|
||||
for (l = contexts; l; l = l->next)
|
||||
for (l = drags; l; l = l->next)
|
||||
{
|
||||
context = l->data;
|
||||
drag = l->data;
|
||||
|
||||
if (!GDK_DRAG_CONTEXT_GET_CLASS (context)->handle_event)
|
||||
if (!GDK_DRAG_GET_CLASS (drag)->handle_event)
|
||||
continue;
|
||||
|
||||
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->handle_event (context, event))
|
||||
if (GDK_DRAG_GET_CLASS (drag)->handle_event (drag, event))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -734,8 +733,8 @@ gdk_drag_context_handle_source_event (GdkEvent *event)
|
||||
}
|
||||
|
||||
GdkCursor *
|
||||
gdk_drag_get_cursor (GdkDragContext *context,
|
||||
GdkDragAction action)
|
||||
gdk_drag_get_cursor (GdkDrag *drag,
|
||||
GdkDragAction action)
|
||||
{
|
||||
gint i;
|
||||
|
98
gdk/gdkdrag.h
Normal file
98
gdk/gdkdrag.h
Normal file
@ -0,0 +1,98 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_DND_H__
|
||||
#define __GDK_DND_H__
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdevice.h>
|
||||
#include <gdk/gdkevents.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_DRAG (gdk_drag_get_type ())
|
||||
#define GDK_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG, GdkDrag))
|
||||
#define GDK_IS_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG))
|
||||
|
||||
/**
|
||||
* GdkDragCancelReason:
|
||||
* @GDK_DRAG_CANCEL_NO_TARGET: There is no suitable drop target.
|
||||
* @GDK_DRAG_CANCEL_USER_CANCELLED: Drag cancelled by the user
|
||||
* @GDK_DRAG_CANCEL_ERROR: Unspecified error.
|
||||
*
|
||||
* Used in #GdkDrag to the reason of a cancelled DND operation.
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_DRAG_CANCEL_NO_TARGET,
|
||||
GDK_DRAG_CANCEL_USER_CANCELLED,
|
||||
GDK_DRAG_CANCEL_ERROR
|
||||
} GdkDragCancelReason;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_drag_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDisplay * gdk_drag_get_display (GdkDrag *drag);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDevice * gdk_drag_get_device (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkContentFormats *gdk_drag_get_formats (GdkDrag *drag);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drag_get_actions (GdkDrag *drag);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drag_get_suggested_action (GdkDrag *drag);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drag_get_selected_action (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_drag_action_is_unique (GdkDragAction action);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDrag * gdk_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_drag_drop_done (GdkDrag *drag,
|
||||
gboolean success);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface *gdk_drag_get_drag_surface (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_drag_set_hotspot (GdkDrag *drag,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DND_H__ */
|
105
gdk/gdkdragprivate.h
Normal file
105
gdk/gdkdragprivate.h
Normal file
@ -0,0 +1,105 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2010, Red Hat, Inc
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_DND_PRIVATE_H__
|
||||
#define __GDK_DND_PRIVATE_H__
|
||||
|
||||
#include "gdkdrag.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GDK_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG, GdkDragClass))
|
||||
#define GDK_IS_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG))
|
||||
#define GDK_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG, GdkDragClass))
|
||||
|
||||
typedef struct _GdkDragClass GdkDragClass;
|
||||
|
||||
|
||||
struct _GdkDragClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (*drag_abort) (GdkDrag *drag,
|
||||
guint32 time_);
|
||||
void (*drag_drop) (GdkDrag *drag,
|
||||
guint32 time_);
|
||||
GdkSurface* (*get_drag_surface) (GdkDrag *drag);
|
||||
void (*set_hotspot) (GdkDrag *drag,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
void (*drop_done) (GdkDrag *drag,
|
||||
gboolean success);
|
||||
|
||||
void (*set_cursor) (GdkDrag *drag,
|
||||
GdkCursor *cursor);
|
||||
void (*cancel) (GdkDrag *drag,
|
||||
GdkDragCancelReason reason);
|
||||
void (*drop_performed) (GdkDrag *drag,
|
||||
guint32 time);
|
||||
void (*dnd_finished) (GdkDrag *drag);
|
||||
|
||||
gboolean (*handle_event) (GdkDrag *drag,
|
||||
const GdkEvent *event);
|
||||
void (*action_changed) (GdkDrag *drag,
|
||||
GdkDragAction action);
|
||||
};
|
||||
|
||||
struct _GdkDrag {
|
||||
GObject parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
GdkSurface *source_surface;
|
||||
GdkSurface *drag_surface;
|
||||
|
||||
GdkContentProvider *content;
|
||||
GdkDragAction action;
|
||||
|
||||
guint drop_done : 1; /* Whether gdk_drag_drop_done() was performed */
|
||||
};
|
||||
|
||||
void gdk_drag_set_cursor (GdkDrag *drag,
|
||||
GdkCursor *cursor);
|
||||
void gdk_drag_set_actions (GdkDrag *drag,
|
||||
GdkDragAction actions,
|
||||
GdkDragAction suggested_action);
|
||||
|
||||
void gdk_drag_cancel (GdkDrag *drag,
|
||||
GdkDragCancelReason reason);
|
||||
gboolean gdk_drag_handle_source_event (GdkEvent *event);
|
||||
GdkCursor * gdk_drag_get_cursor (GdkDrag *drag,
|
||||
GdkDragAction action);
|
||||
|
||||
void gdk_drag_abort (GdkDrag *drag,
|
||||
guint32 time_);
|
||||
void gdk_drag_drop (GdkDrag *drag,
|
||||
guint32 time_);
|
||||
|
||||
void gdk_drag_write_async (GdkDrag *drag,
|
||||
const char *mime_type,
|
||||
GOutputStream *stream,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean gdk_drag_write_finish (GdkDrag *drag,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
@ -38,7 +38,7 @@ typedef struct _GdkDropPrivate GdkDropPrivate;
|
||||
|
||||
struct _GdkDropPrivate {
|
||||
GdkDevice *device;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GdkContentFormats *formats;
|
||||
GdkSurface *surface;
|
||||
GdkDragAction actions;
|
||||
@ -78,7 +78,7 @@ gdk_drop_read_local_write_done (GObject *drag,
|
||||
gpointer stream)
|
||||
{
|
||||
/* we don't care about the error, we just want to clean up */
|
||||
gdk_drag_context_write_finish (GDK_DRAG_CONTEXT (drag), result, NULL);
|
||||
gdk_drag_write_finish (GDK_DRAG (drag), result, NULL);
|
||||
|
||||
/* XXX: Do we need to close_async() here? */
|
||||
g_output_stream_close (stream, NULL, NULL);
|
||||
@ -122,7 +122,7 @@ gdk_drop_read_local_async (GdkDrop *self,
|
||||
|
||||
stream = gdk_pipe_io_stream_new ();
|
||||
output_stream = g_io_stream_get_output_stream (stream);
|
||||
gdk_drag_context_write_async (priv->drag,
|
||||
gdk_drag_write_async (priv->drag,
|
||||
mime_type,
|
||||
output_stream,
|
||||
io_priority,
|
||||
@ -321,7 +321,7 @@ gdk_drop_class_init (GdkDropClass *klass)
|
||||
g_param_spec_object ("drag",
|
||||
"Drag",
|
||||
"The drag that initiated this drop",
|
||||
GDK_TYPE_DRAG_CONTEXT,
|
||||
GDK_TYPE_DRAG,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
@ -492,7 +492,7 @@ gdk_drop_set_actions (GdkDrop *self,
|
||||
*
|
||||
* Returns: (transfer none) (nullable): the corresponding #GdkDrag
|
||||
**/
|
||||
GdkDragContext *
|
||||
GdkDrag *
|
||||
gdk_drop_get_drag (GdkDrop *self)
|
||||
{
|
||||
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
|
||||
|
@ -50,7 +50,7 @@ GdkContentFormats * gdk_drop_get_formats (GdkDrop
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drop_get_actions (GdkDrop *self);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragContext * gdk_drop_get_drag (GdkDrop *self);
|
||||
GdkDrag * gdk_drop_get_drag (GdkDrop *self);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_drop_status (GdkDrop *self,
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "gdkeventsprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdkdropprivate.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
@ -165,7 +165,7 @@ gdk_event_class_init (GdkEventClass *klass)
|
||||
void
|
||||
_gdk_event_emit (GdkEvent *event)
|
||||
{
|
||||
if (gdk_drag_context_handle_source_event (event))
|
||||
if (gdk_drag_handle_source_event (event))
|
||||
return;
|
||||
|
||||
if (_gdk_event_func)
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdnd.h>
|
||||
#include <gdk/gdkdrag.h>
|
||||
#include <gdk/gdkdevice.h>
|
||||
#include <gdk/gdkdevicetool.h>
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#define __GDK_EVENTS_PRIVATE_H__
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdnd.h>
|
||||
#include <gdk/gdkdrag.h>
|
||||
#include <gdk/gdkdevice.h>
|
||||
#include <gdk/gdkdevicetool.h>
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkdragprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -5140,10 +5140,10 @@ gdk_surface_register_dnd (GdkSurface *surface)
|
||||
*
|
||||
* This function is called by the drag source.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): a newly created #GdkDragContext or
|
||||
* Returns: (transfer full) (nullable): a newly created #GdkDrag or
|
||||
* %NULL on error.
|
||||
*/
|
||||
GdkDragContext *
|
||||
GdkDrag *
|
||||
gdk_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
|
@ -193,7 +193,7 @@ struct _GdkSurfaceImplClass
|
||||
gdouble opacity);
|
||||
void (* destroy_notify) (GdkSurface *surface);
|
||||
void (* register_dnd) (GdkSurface *surface);
|
||||
GdkDragContext * (*drag_begin) (GdkSurface *surface,
|
||||
GdkDrag * (*drag_begin) (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider*content,
|
||||
GdkDragAction actions,
|
||||
|
@ -123,7 +123,7 @@ typedef struct _GdkContentProvider GdkContentProvider;
|
||||
typedef struct _GdkCursor GdkCursor;
|
||||
typedef struct _GdkTexture GdkTexture;
|
||||
typedef struct _GdkDevice GdkDevice;
|
||||
typedef struct _GdkDragContext GdkDragContext;
|
||||
typedef struct _GdkDrag GdkDrag;
|
||||
typedef struct _GdkDrop GdkDrop;
|
||||
|
||||
typedef struct _GdkClipboard GdkClipboard;
|
||||
@ -571,7 +571,7 @@ typedef enum
|
||||
* useful if source and destination agree on what it means.
|
||||
* @GDK_ACTION_ASK: Ask the user what to do with the data.
|
||||
*
|
||||
* Used in #GdkDragContext to indicate what the destination
|
||||
* Used in #GdkDrag to indicate what the destination
|
||||
* should do with the dropped data.
|
||||
*/
|
||||
typedef enum
|
||||
|
@ -15,7 +15,7 @@ gdk_public_sources = files([
|
||||
'gdkdevicetool.c',
|
||||
'gdkdisplay.c',
|
||||
'gdkdisplaymanager.c',
|
||||
'gdkdnd.c',
|
||||
'gdkdrag.c',
|
||||
'gdkdrawcontext.c',
|
||||
'gdkdrop.c',
|
||||
'gdkevents.c',
|
||||
@ -65,7 +65,7 @@ gdk_public_headers = files([
|
||||
'gdkdevicetool.h',
|
||||
'gdkdisplay.h',
|
||||
'gdkdisplaymanager.h',
|
||||
'gdkdnd.h',
|
||||
'gdkdrag.h',
|
||||
'gdkdrawcontext.h',
|
||||
'gdkdrop.h',
|
||||
'gdkevents.h',
|
||||
|
@ -247,7 +247,7 @@ struct _GdkWaylandSeat
|
||||
GdkClipboard *clipboard;
|
||||
GdkClipboard *primary_clipboard;
|
||||
struct wl_data_device *data_device;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GdkDrop *drop;
|
||||
|
||||
/* Source/dest for non-local dnd */
|
||||
@ -5139,12 +5139,12 @@ gdk_wayland_seat_set_global_cursor (GdkSeat *seat,
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_seat_set_drag (GdkSeat *seat,
|
||||
GdkDragContext *context)
|
||||
gdk_wayland_seat_set_drag (GdkSeat *seat,
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
|
||||
|
||||
g_set_object (&wayland_seat->drag, context);
|
||||
g_set_object (&wayland_seat->drag, drag);
|
||||
}
|
||||
|
||||
struct wl_data_device *
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkdragprivate.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkproperty.h"
|
||||
@ -34,19 +34,19 @@
|
||||
#include <gio/gunixoutputstream.h>
|
||||
#include <string.h>
|
||||
|
||||
#define GDK_TYPE_WAYLAND_DRAG_CONTEXT (gdk_wayland_drag_context_get_type ())
|
||||
#define GDK_WAYLAND_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_DRAG_CONTEXT, GdkWaylandDragContext))
|
||||
#define GDK_WAYLAND_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_DRAG_CONTEXT, GdkWaylandDragContextClass))
|
||||
#define GDK_IS_WAYLAND_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_DRAG_CONTEXT))
|
||||
#define GDK_IS_WAYLAND_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_DRAG_CONTEXT))
|
||||
#define GDK_WAYLAND_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_DRAG_CONTEXT, GdkWaylandDragContextClass))
|
||||
#define GDK_TYPE_WAYLAND_DRAG (gdk_wayland_drag_get_type ())
|
||||
#define GDK_WAYLAND_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_DRAG, GdkWaylandDrag))
|
||||
#define GDK_WAYLAND_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_DRAG, GdkWaylandDragClass))
|
||||
#define GDK_IS_WAYLAND_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_DRAG))
|
||||
#define GDK_IS_WAYLAND_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_DRAG))
|
||||
#define GDK_WAYLAND_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_DRAG, GdkWaylandDragClass))
|
||||
|
||||
typedef struct _GdkWaylandDragContext GdkWaylandDragContext;
|
||||
typedef struct _GdkWaylandDragContextClass GdkWaylandDragContextClass;
|
||||
typedef struct _GdkWaylandDrag GdkWaylandDrag;
|
||||
typedef struct _GdkWaylandDragClass GdkWaylandDragClass;
|
||||
|
||||
struct _GdkWaylandDragContext
|
||||
struct _GdkWaylandDrag
|
||||
{
|
||||
GdkDragContext context;
|
||||
GdkDrag drag;
|
||||
GdkSurface *dnd_surface;
|
||||
struct wl_surface *dnd_wl_surface;
|
||||
struct wl_data_source *data_source;
|
||||
@ -57,34 +57,34 @@ struct _GdkWaylandDragContext
|
||||
gint hot_y;
|
||||
};
|
||||
|
||||
struct _GdkWaylandDragContextClass
|
||||
struct _GdkWaylandDragClass
|
||||
{
|
||||
GdkDragContextClass parent_class;
|
||||
GdkDragClass parent_class;
|
||||
};
|
||||
|
||||
static GList *contexts;
|
||||
static GList *drags;
|
||||
|
||||
GType gdk_wayland_drag_context_get_type (void);
|
||||
GType gdk_wayland_drag_get_type (void);
|
||||
|
||||
G_DEFINE_TYPE (GdkWaylandDragContext, gdk_wayland_drag_context, GDK_TYPE_DRAG_CONTEXT)
|
||||
G_DEFINE_TYPE (GdkWaylandDrag, gdk_wayland_drag, GDK_TYPE_DRAG)
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_finalize (GObject *object)
|
||||
gdk_wayland_drag_finalize (GObject *object)
|
||||
{
|
||||
GdkWaylandDragContext *wayland_context = GDK_WAYLAND_DRAG_CONTEXT (object);
|
||||
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
|
||||
GdkWaylandDrag *wayland_drag = GDK_WAYLAND_DRAG (object);
|
||||
GdkDrag *drag = GDK_DRAG (object);
|
||||
GdkSurface *dnd_surface;
|
||||
|
||||
contexts = g_list_remove (contexts, context);
|
||||
drags = g_list_remove (drags, drag);
|
||||
|
||||
gdk_drag_context_set_cursor (context, NULL);
|
||||
gdk_drag_set_cursor (drag, NULL);
|
||||
|
||||
g_clear_pointer (&wayland_context->data_source, (GDestroyNotify) wl_data_source_destroy);
|
||||
g_clear_pointer (&wayland_context->offer, (GDestroyNotify) wl_data_offer_destroy);
|
||||
g_clear_pointer (&wayland_drag->data_source, (GDestroyNotify) wl_data_source_destroy);
|
||||
g_clear_pointer (&wayland_drag->offer, (GDestroyNotify) wl_data_offer_destroy);
|
||||
|
||||
dnd_surface = wayland_context->dnd_surface;
|
||||
dnd_surface = wayland_drag->dnd_surface;
|
||||
|
||||
G_OBJECT_CLASS (gdk_wayland_drag_context_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (gdk_wayland_drag_parent_class)->finalize (object);
|
||||
|
||||
if (dnd_surface)
|
||||
gdk_surface_destroy (dnd_surface);
|
||||
@ -106,121 +106,121 @@ gdk_to_wl_actions (GdkDragAction action)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_drag_abort (GdkDragContext *context,
|
||||
guint32 time)
|
||||
gdk_wayland_drag_drag_abort (GdkDrag *drag,
|
||||
guint32 time)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_drag_drop (GdkDragContext *context,
|
||||
guint32 time)
|
||||
gdk_wayland_drag_drag_drop (GdkDrag *drag,
|
||||
guint32 time)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_init (GdkWaylandDragContext *context_wayland)
|
||||
gdk_wayland_drag_init (GdkWaylandDrag *drag_wayland)
|
||||
{
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
|
||||
context = GDK_DRAG_CONTEXT (context_wayland);
|
||||
contexts = g_list_prepend (contexts, context);
|
||||
drag = GDK_DRAG (drag_wayland);
|
||||
drags = g_list_prepend (drags, drag);
|
||||
|
||||
context->action = GDK_ACTION_COPY;
|
||||
drag->action = GDK_ACTION_COPY;
|
||||
}
|
||||
|
||||
static GdkSurface *
|
||||
gdk_wayland_drag_context_get_drag_surface (GdkDragContext *context)
|
||||
gdk_wayland_drag_get_drag_surface (GdkDrag *drag)
|
||||
{
|
||||
return GDK_WAYLAND_DRAG_CONTEXT (context)->dnd_surface;
|
||||
return GDK_WAYLAND_DRAG (drag)->dnd_surface;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_set_hotspot (GdkDragContext *context,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
gdk_wayland_drag_set_hotspot (GdkDrag *drag,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
{
|
||||
GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
|
||||
gint prev_hot_x = context_wayland->hot_x;
|
||||
gint prev_hot_y = context_wayland->hot_y;
|
||||
GdkWaylandDrag *drag_wayland = GDK_WAYLAND_DRAG (drag);
|
||||
gint prev_hot_x = drag_wayland->hot_x;
|
||||
gint prev_hot_y = drag_wayland->hot_y;
|
||||
const GdkRectangle damage_rect = { .width = 1, .height = 1 };
|
||||
|
||||
context_wayland->hot_x = hot_x;
|
||||
context_wayland->hot_y = hot_y;
|
||||
drag_wayland->hot_x = hot_x;
|
||||
drag_wayland->hot_y = hot_y;
|
||||
|
||||
if (prev_hot_x == hot_x && prev_hot_y == hot_y)
|
||||
return;
|
||||
|
||||
_gdk_wayland_surface_offset_next_wl_buffer (context_wayland->dnd_surface,
|
||||
_gdk_wayland_surface_offset_next_wl_buffer (drag_wayland->dnd_surface,
|
||||
-hot_x, -hot_y);
|
||||
gdk_surface_invalidate_rect (context_wayland->dnd_surface, &damage_rect);
|
||||
gdk_surface_invalidate_rect (drag_wayland->dnd_surface, &damage_rect);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_set_cursor (GdkDragContext *context,
|
||||
GdkCursor *cursor)
|
||||
gdk_wayland_drag_set_cursor (GdkDrag *drag,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
GdkDevice *device = gdk_drag_context_get_device (context);
|
||||
GdkDevice *device = gdk_drag_get_device (drag);
|
||||
|
||||
gdk_wayland_seat_set_global_cursor (gdk_device_get_seat (device), cursor);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_action_changed (GdkDragContext *context,
|
||||
GdkDragAction action)
|
||||
gdk_wayland_drag_action_changed (GdkDrag *drag,
|
||||
GdkDragAction action)
|
||||
{
|
||||
GdkCursor *cursor;
|
||||
|
||||
cursor = gdk_drag_get_cursor (context, action);
|
||||
gdk_drag_context_set_cursor (context, cursor);
|
||||
cursor = gdk_drag_get_cursor (drag, action);
|
||||
gdk_drag_set_cursor (drag, cursor);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_drop_performed (GdkDragContext *context,
|
||||
guint32 time_)
|
||||
gdk_wayland_drag_drop_performed (GdkDrag *drag,
|
||||
guint32 time_)
|
||||
{
|
||||
gdk_drag_context_set_cursor (context, NULL);
|
||||
gdk_drag_set_cursor (drag, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_cancel (GdkDragContext *context,
|
||||
GdkDragCancelReason reason)
|
||||
gdk_wayland_drag_cancel (GdkDrag *drag,
|
||||
GdkDragCancelReason reason)
|
||||
{
|
||||
gdk_drag_context_set_cursor (context, NULL);
|
||||
gdk_drag_set_cursor (drag, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_drop_done (GdkDragContext *context,
|
||||
gboolean success)
|
||||
gdk_wayland_drag_drop_done (GdkDrag *drag,
|
||||
gboolean success)
|
||||
{
|
||||
GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
|
||||
GdkDevice *device = gdk_drag_context_get_device (context);
|
||||
GdkWaylandDrag *drag_wayland = GDK_WAYLAND_DRAG (drag);
|
||||
GdkDevice *device = gdk_drag_get_device (drag);
|
||||
|
||||
gdk_wayland_seat_set_drag (gdk_device_get_seat (device), context);
|
||||
gdk_wayland_seat_set_drag (gdk_device_get_seat (device), drag);
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (context_wayland->dnd_surface)
|
||||
gdk_surface_hide (context_wayland->dnd_surface);
|
||||
if (drag_wayland->dnd_surface)
|
||||
gdk_surface_hide (drag_wayland->dnd_surface);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
|
||||
gdk_wayland_drag_class_init (GdkWaylandDragClass *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_wayland_drag_context_finalize;
|
||||
object_class->finalize = gdk_wayland_drag_finalize;
|
||||
|
||||
context_class->drag_abort = gdk_wayland_drag_context_drag_abort;
|
||||
context_class->drag_drop = gdk_wayland_drag_context_drag_drop;
|
||||
context_class->get_drag_surface = gdk_wayland_drag_context_get_drag_surface;
|
||||
context_class->set_hotspot = gdk_wayland_drag_context_set_hotspot;
|
||||
context_class->drop_done = gdk_wayland_drag_context_drop_done;
|
||||
context_class->set_cursor = gdk_wayland_drag_context_set_cursor;
|
||||
context_class->action_changed = gdk_wayland_drag_context_action_changed;
|
||||
context_class->drop_performed = gdk_wayland_drag_context_drop_performed;
|
||||
context_class->cancel = gdk_wayland_drag_context_cancel;
|
||||
drag_class->drag_abort = gdk_wayland_drag_drag_abort;
|
||||
drag_class->drag_drop = gdk_wayland_drag_drag_drop;
|
||||
drag_class->get_drag_surface = gdk_wayland_drag_get_drag_surface;
|
||||
drag_class->set_hotspot = gdk_wayland_drag_set_hotspot;
|
||||
drag_class->drop_done = gdk_wayland_drag_drop_done;
|
||||
drag_class->set_cursor = gdk_wayland_drag_set_cursor;
|
||||
drag_class->action_changed = gdk_wayland_drag_action_changed;
|
||||
drag_class->drop_performed = gdk_wayland_drag_drop_performed;
|
||||
drag_class->cancel = gdk_wayland_drag_cancel;
|
||||
}
|
||||
|
||||
void
|
||||
@ -266,15 +266,15 @@ data_source_target (void *data,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_write_done (GObject *context,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
gdk_wayland_drag_write_done (GObject *drag,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!gdk_drag_context_write_finish (GDK_DRAG_CONTEXT (context), result, &error))
|
||||
if (!gdk_drag_write_finish (GDK_DRAG (drag), result, &error))
|
||||
{
|
||||
GDK_DISPLAY_NOTE (gdk_drag_context_get_display (GDK_DRAG_CONTEXT (context)), DND, g_message ("%p: failed to write stream: %s", context, error->message));
|
||||
GDK_DISPLAY_NOTE (gdk_drag_get_display (GDK_DRAG (drag)), DND, g_message ("%p: failed to write stream: %s", drag, error->message));
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
@ -285,23 +285,23 @@ data_source_send (void *data,
|
||||
const char *mime_type,
|
||||
int32_t fd)
|
||||
{
|
||||
GdkDragContext *context = data;
|
||||
GdkDrag *drag = data;
|
||||
GOutputStream *stream;
|
||||
|
||||
GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), DND, g_message ("%p: data source send request for %s on fd %d\n",
|
||||
GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), DND, g_message ("%p: data source send request for %s on fd %d\n",
|
||||
source, mime_type, fd));
|
||||
|
||||
//mime_type = gdk_intern_mime_type (mime_type);
|
||||
mime_type = g_intern_string (mime_type);
|
||||
stream = g_unix_output_stream_new (fd, TRUE);
|
||||
|
||||
gdk_drag_context_write_async (context,
|
||||
mime_type,
|
||||
stream,
|
||||
G_PRIORITY_DEFAULT,
|
||||
NULL,
|
||||
gdk_wayland_drag_context_write_done,
|
||||
context);
|
||||
gdk_drag_write_async (drag,
|
||||
mime_type,
|
||||
stream,
|
||||
G_PRIORITY_DEFAULT,
|
||||
NULL,
|
||||
gdk_wayland_drag_write_done,
|
||||
drag);
|
||||
g_object_unref (stream);
|
||||
}
|
||||
|
||||
@ -309,30 +309,30 @@ static void
|
||||
data_source_cancelled (void *data,
|
||||
struct wl_data_source *source)
|
||||
{
|
||||
GdkDragContext *context = data;
|
||||
GdkDrag *drag = data;
|
||||
|
||||
GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), EVENTS,
|
||||
GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), EVENTS,
|
||||
g_message ("data source cancelled, source = %p", source));
|
||||
|
||||
gdk_drag_context_cancel (context, GDK_DRAG_CANCEL_ERROR);
|
||||
gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR);
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_dnd_drop_performed (void *data,
|
||||
struct wl_data_source *source)
|
||||
{
|
||||
GdkDragContext *context = data;
|
||||
GdkDrag *drag = data;
|
||||
|
||||
g_signal_emit_by_name (context, "drop-performed");
|
||||
g_signal_emit_by_name (drag, "drop-performed");
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_dnd_finished (void *data,
|
||||
struct wl_data_source *source)
|
||||
{
|
||||
GdkDragContext *context = data;
|
||||
GdkDrag *drag = data;
|
||||
|
||||
g_signal_emit_by_name (context, "dnd-finished");
|
||||
g_signal_emit_by_name (drag, "dnd-finished");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -340,14 +340,14 @@ data_source_action (void *data,
|
||||
struct wl_data_source *source,
|
||||
uint32_t action)
|
||||
{
|
||||
GdkDragContext *context = data;
|
||||
GdkDrag *drag = data;
|
||||
|
||||
GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), EVENTS,
|
||||
GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), EVENTS,
|
||||
g_message ("data source action, source = %p action=%x",
|
||||
source, action));
|
||||
|
||||
context->action = _wl_to_gdk_actions (action);
|
||||
g_signal_emit_by_name (context, "action-changed", context->action);
|
||||
drag->action = _wl_to_gdk_actions (action);
|
||||
g_signal_emit_by_name (drag, "action-changed", drag->action);
|
||||
}
|
||||
|
||||
static const struct wl_data_source_listener data_source_listener = {
|
||||
@ -360,27 +360,27 @@ static const struct wl_data_source_listener data_source_listener = {
|
||||
};
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_create_data_source (GdkDragContext *context)
|
||||
gdk_wayland_drag_create_data_source (GdkDrag *drag)
|
||||
{
|
||||
GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
|
||||
GdkDisplay *display = gdk_drag_context_get_display (context);
|
||||
GdkWaylandDrag *drag_wayland = GDK_WAYLAND_DRAG (drag);
|
||||
GdkDisplay *display = gdk_drag_get_display (drag);
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
const char *const *mimetypes;
|
||||
gsize i, n_mimetypes;
|
||||
|
||||
context_wayland->data_source = wl_data_device_manager_create_data_source (display_wayland->data_device_manager);
|
||||
wl_data_source_add_listener (context_wayland->data_source,
|
||||
drag_wayland->data_source = wl_data_device_manager_create_data_source (display_wayland->data_device_manager);
|
||||
wl_data_source_add_listener (drag_wayland->data_source,
|
||||
&data_source_listener,
|
||||
context);
|
||||
drag);
|
||||
|
||||
mimetypes = gdk_content_formats_get_mime_types (gdk_drag_context_get_formats (context), &n_mimetypes);
|
||||
mimetypes = gdk_content_formats_get_mime_types (gdk_drag_get_formats (drag), &n_mimetypes);
|
||||
for (i = 0; i < n_mimetypes; i++)
|
||||
{
|
||||
wl_data_source_offer (context_wayland->data_source, mimetypes[i]);
|
||||
wl_data_source_offer (drag_wayland->data_source, mimetypes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
GdkDragContext *
|
||||
GdkDrag *
|
||||
_gdk_wayland_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
@ -388,53 +388,53 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface,
|
||||
gint dx,
|
||||
gint dy)
|
||||
{
|
||||
GdkWaylandDragContext *context_wayland;
|
||||
GdkDragContext *context;
|
||||
GdkWaylandDrag *drag_wayland;
|
||||
GdkDrag *drag;
|
||||
GdkSeat *seat;
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
|
||||
display_wayland = GDK_WAYLAND_DISPLAY (gdk_device_get_display (device));
|
||||
seat = gdk_device_get_seat (device);
|
||||
|
||||
context_wayland = g_object_new (GDK_TYPE_WAYLAND_DRAG_CONTEXT,
|
||||
"device", device,
|
||||
"content", content,
|
||||
NULL);
|
||||
context = GDK_DRAG_CONTEXT (context_wayland);
|
||||
context->source_surface = g_object_ref (surface);
|
||||
drag_wayland = g_object_new (GDK_TYPE_WAYLAND_DRAG,
|
||||
"device", device,
|
||||
"content", content,
|
||||
NULL);
|
||||
drag = GDK_DRAG (drag_wayland);
|
||||
drag->source_surface = g_object_ref (surface);
|
||||
|
||||
context_wayland->dnd_surface = create_dnd_surface (gdk_surface_get_display (surface));
|
||||
context_wayland->dnd_wl_surface = gdk_wayland_surface_get_wl_surface (context_wayland->dnd_surface);
|
||||
drag_wayland->dnd_surface = create_dnd_surface (gdk_surface_get_display (surface));
|
||||
drag_wayland->dnd_wl_surface = gdk_wayland_surface_get_wl_surface (drag_wayland->dnd_surface);
|
||||
|
||||
gdk_wayland_drag_context_create_data_source (context);
|
||||
gdk_wayland_drag_create_data_source (drag);
|
||||
|
||||
if (display_wayland->data_device_manager_version >=
|
||||
WL_DATA_SOURCE_SET_ACTIONS_SINCE_VERSION)
|
||||
{
|
||||
wl_data_source_set_actions (context_wayland->data_source,
|
||||
wl_data_source_set_actions (drag_wayland->data_source,
|
||||
gdk_to_wl_actions (actions));
|
||||
}
|
||||
|
||||
gdk_wayland_seat_set_drag (seat, context);
|
||||
gdk_wayland_seat_set_drag (seat, drag);
|
||||
|
||||
wl_data_device_start_drag (gdk_wayland_device_get_data_device (device),
|
||||
context_wayland->data_source,
|
||||
drag_wayland->data_source,
|
||||
gdk_wayland_surface_get_wl_surface (surface),
|
||||
context_wayland->dnd_wl_surface,
|
||||
drag_wayland->dnd_wl_surface,
|
||||
_gdk_wayland_display_get_serial (display_wayland));
|
||||
|
||||
gdk_seat_ungrab (seat);
|
||||
|
||||
return context;
|
||||
return drag;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_wayland_drag_context_set_source_surface (GdkDragContext *context,
|
||||
GdkSurface *surface)
|
||||
_gdk_wayland_drag_set_source_surface (GdkDrag *drag,
|
||||
GdkSurface *surface)
|
||||
{
|
||||
if (context->source_surface)
|
||||
g_object_unref (context->source_surface);
|
||||
if (drag->source_surface)
|
||||
g_object_unref (drag->source_surface);
|
||||
|
||||
context->source_surface = surface ? g_object_ref (surface) : NULL;
|
||||
drag->source_surface = surface ? g_object_ref (surface) : NULL;
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ gdk_wayland_drop_init (GdkWaylandDrop *drop)
|
||||
|
||||
GdkDrop *
|
||||
gdk_wayland_drop_new (GdkDevice *device,
|
||||
GdkDragContext *drag,
|
||||
GdkDrag *drag,
|
||||
GdkContentFormats *formats,
|
||||
GdkSurface *surface,
|
||||
struct wl_data_offer *offer,
|
||||
|
@ -95,7 +95,7 @@ void gdk_wayland_surface_attach_image (GdkSurface
|
||||
const cairo_region_t *damage);
|
||||
|
||||
void _gdk_wayland_surface_register_dnd (GdkSurface *surface);
|
||||
GdkDragContext *_gdk_wayland_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDrag *_gdk_wayland_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
@ -105,7 +105,7 @@ void _gdk_wayland_surface_offset_next_wl_buffer (GdkSurface *surface,
|
||||
int x,
|
||||
int y);
|
||||
GdkDrop * gdk_wayland_drop_new (GdkDevice *device,
|
||||
GdkDragContext *drag,
|
||||
GdkDrag *drag,
|
||||
GdkContentFormats *formats,
|
||||
GdkSurface *surface,
|
||||
struct wl_data_offer *offer,
|
||||
@ -115,13 +115,13 @@ void gdk_wayland_drop_set_source_actions (GdkDrop
|
||||
void gdk_wayland_drop_set_action (GdkDrop *drop,
|
||||
uint32_t action);
|
||||
|
||||
void _gdk_wayland_drag_context_set_source_surface (GdkDragContext *context,
|
||||
GdkSurface *surface);
|
||||
void _gdk_wayland_drag_set_source_surface (GdkDrag *drag,
|
||||
GdkSurface *surface);
|
||||
|
||||
void _gdk_wayland_display_create_surface_impl (GdkDisplay *display,
|
||||
GdkSurface *surface,
|
||||
GdkSurface *real_parent,
|
||||
GdkSurfaceAttr *attributes);
|
||||
void _gdk_wayland_display_create_surface_impl (GdkDisplay *display,
|
||||
GdkSurface *surface,
|
||||
GdkSurface *real_parent,
|
||||
GdkSurfaceAttr *attributes);
|
||||
|
||||
gint _gdk_wayland_display_text_property_to_utf8_list (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
@ -147,7 +147,7 @@ struct wl_data_device * gdk_wayland_device_get_data_device (GdkDevice *gdk_devic
|
||||
void gdk_wayland_device_set_selection (GdkDevice *gdk_device,
|
||||
struct wl_data_source *source);
|
||||
|
||||
GdkDragContext * gdk_wayland_device_get_drop_context (GdkDevice *gdk_device);
|
||||
GdkDrag* gdk_wayland_device_get_drop_context (GdkDevice *gdk_device);
|
||||
|
||||
void gdk_wayland_device_unset_touch_grab (GdkDevice *device,
|
||||
GdkEventSequence *sequence);
|
||||
@ -193,7 +193,7 @@ struct gtk_surface1 * gdk_wayland_surface_get_gtk_surface (GdkSurface *surface);
|
||||
void gdk_wayland_seat_set_global_cursor (GdkSeat *seat,
|
||||
GdkCursor *cursor);
|
||||
void gdk_wayland_seat_set_drag (GdkSeat *seat,
|
||||
GdkDragContext *drag);
|
||||
GdkDrag *drag);
|
||||
|
||||
struct wl_output *gdk_wayland_surface_get_wl_output (GdkSurface *surface);
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "gdkprivate-wayland.h"
|
||||
#include "gdkdisplay-wayland.h"
|
||||
#include "gdkcontentformatsprivate.h"
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkproperty.h"
|
||||
|
||||
#include <string.h>
|
||||
|
@ -280,7 +280,7 @@ Otherwise it's similar to how the clipboard works. Only the DnD server
|
||||
#include "gdkclipboard-win32.h"
|
||||
#include "gdkclipdrop-win32.h"
|
||||
#include "gdkhdataoutputstream-win32.h"
|
||||
#include "gdk/gdkdndprivate.h"
|
||||
#include "gdk/gdkdragprivate.h"
|
||||
#include "gdkwin32dnd.h"
|
||||
#include "gdkwin32dnd-private.h"
|
||||
#include "gdkwin32.h"
|
||||
|
@ -130,7 +130,7 @@
|
||||
* From that point forward the context gets any events emitted
|
||||
* by GDK, and can prevent these events from going anywhere else.
|
||||
* 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).
|
||||
*
|
||||
* That function catches the following events:
|
||||
@ -195,14 +195,14 @@
|
||||
/* For C-style COM wrapper macros */
|
||||
#define COBJMACROS
|
||||
|
||||
#include "gdkdnd.h"
|
||||
#include "gdkdrag.h"
|
||||
#include "gdkproperty.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkprivate-win32.h"
|
||||
#include "gdkwin32.h"
|
||||
#include "gdkwin32dnd.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdk/gdkdndprivate.h"
|
||||
#include "gdk/gdkdragprivate.h"
|
||||
#include "gdkwin32dnd-private.h"
|
||||
#include "gdkdisplay-win32.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
@ -226,12 +226,12 @@ typedef struct
|
||||
IDropSource ids;
|
||||
IDropSourceNotify idsn;
|
||||
gint ref_count;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
|
||||
/* 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
|
||||
* the context every time.
|
||||
@ -249,7 +249,7 @@ typedef struct
|
||||
typedef struct {
|
||||
IDataObject ido;
|
||||
int ref_count;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GArray *formats;
|
||||
} data_object;
|
||||
|
||||
@ -342,8 +342,8 @@ struct _GdkWin32DnDThreadUpdateDragState
|
||||
{
|
||||
GdkWin32DnDThreadQueueItem base;
|
||||
|
||||
gpointer opaque_ddd;
|
||||
GdkWin32DragContextUtilityData produced_util_data;
|
||||
gpointer opaque_ddd;
|
||||
GdkWin32DragUtilityData produced_util_data;
|
||||
};
|
||||
|
||||
typedef struct _GdkWin32DnDThread GdkWin32DnDThread;
|
||||
@ -485,10 +485,10 @@ process_dnd_queue (gboolean timed,
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_local_drag_context_drop_response (GdkDragContext *drag,
|
||||
GdkDragAction action)
|
||||
_gdk_win32_local_drag_drop_response (GdkDrag *drag,
|
||||
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));
|
||||
|
||||
g_signal_emit_by_name (drag, "dnd-finished");
|
||||
@ -500,8 +500,8 @@ do_drag_drop_response (gpointer user_data)
|
||||
{
|
||||
GdkWin32DnDThreadDoDragDrop *ddd = (GdkWin32DnDThreadDoDragDrop *) user_data;
|
||||
HRESULT hr = ddd->received_result;
|
||||
GdkDragContext *drag = GDK_DRAG_CONTEXT (ddd->base.opaque_context);
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkDrag *drag = GDK_DRAG (ddd->base.opaque_context);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
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;
|
||||
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;
|
||||
gboolean is_hdata;
|
||||
@ -593,7 +593,7 @@ get_data_response (gpointer user_data)
|
||||
{
|
||||
GdkWin32DnDThreadGetData *getdata = (GdkWin32DnDThreadGetData *) user_data;
|
||||
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);
|
||||
|
||||
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)
|
||||
{
|
||||
getdata->stream = GDK_WIN32_HDATA_OUTPUT_STREAM (stream);
|
||||
gdk_drag_context_write_async (drag,
|
||||
gdk_drag_write_async (drag,
|
||||
getdata->pair.contentformat,
|
||||
stream,
|
||||
G_PRIORITY_DEFAULT,
|
||||
@ -721,16 +721,16 @@ typedef enum {
|
||||
|
||||
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
|
||||
move_drag_surface (GdkDragContext *drag,
|
||||
guint x_root,
|
||||
guint y_root)
|
||||
move_drag_surface (GdkDrag *drag,
|
||||
guint x_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 ||
|
||||
_win32_main_thread == g_thread_self ());
|
||||
@ -742,7 +742,7 @@ move_drag_surface (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_init (GdkWin32DragContext *drag)
|
||||
gdk_win32_drag_init (GdkWin32Drag *drag)
|
||||
{
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
_win32_main_thread == g_thread_self ());
|
||||
@ -750,32 +750,32 @@ gdk_win32_drag_context_init (GdkWin32DragContext *drag)
|
||||
drag->handle_events = TRUE;
|
||||
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
|
||||
gdk_win32_drag_context_finalize (GObject *object)
|
||||
gdk_win32_drag_finalize (GObject *object)
|
||||
{
|
||||
GdkDragContext *drag;
|
||||
GdkWin32DragContext *drag_win32;
|
||||
GdkDrag *drag;
|
||||
GdkWin32Drag *drag_win32;
|
||||
GdkSurface *drag_surface;
|
||||
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
_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_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
drag = GDK_DRAG (object);
|
||||
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);
|
||||
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)
|
||||
gdk_surface_destroy (drag_surface);
|
||||
@ -783,30 +783,30 @@ gdk_win32_drag_context_finalize (GObject *object)
|
||||
|
||||
/* Drag Contexts */
|
||||
|
||||
static GdkDragContext *
|
||||
gdk_drag_context_new (GdkDisplay *display,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
GdkDevice *device,
|
||||
GdkDragProtocol protocol)
|
||||
static GdkDrag *
|
||||
gdk_drag_new (GdkDisplay *display,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
GdkDevice *device,
|
||||
GdkDragProtocol protocol)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32;
|
||||
GdkWin32Drag *drag_win32;
|
||||
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
|
||||
drag_win32 = g_object_new (GDK_TYPE_WIN32_DRAG_CONTEXT,
|
||||
"device", device,
|
||||
"content", content,
|
||||
NULL);
|
||||
drag_win32 = g_object_new (GDK_TYPE_WIN32_DRAG,
|
||||
"device", device,
|
||||
"content", content,
|
||||
NULL);
|
||||
|
||||
drag = GDK_DRAG_CONTEXT (drag_win32);
|
||||
drag = GDK_DRAG (drag_win32);
|
||||
|
||||
if (win32_display->has_fixed_scale)
|
||||
drag_win32->scale = win32_display->surface_scale;
|
||||
else
|
||||
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;
|
||||
|
||||
return drag;
|
||||
@ -828,15 +828,15 @@ gdk_drag_context_new (GdkDisplay *display,
|
||||
|
||||
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
|
||||
* Does not give a reference.
|
||||
*/
|
||||
GdkDragContext *
|
||||
GdkDrag *
|
||||
_gdk_win32_find_drag_for_dest_window (HWND dest_window)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
GdkWin32DragContext *drag_win32;
|
||||
GdkWin32Drag *drag_win32;
|
||||
GdkWin32DnDThreadDoDragDrop *ddd;
|
||||
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))
|
||||
if (ddd->src_context->dest_window_handle == dest_window)
|
||||
return GDK_DRAG_CONTEXT (drag_win32);
|
||||
return GDK_DRAG (drag_win32);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -888,7 +888,7 @@ static gboolean
|
||||
notify_dnd_enter (gpointer 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;
|
||||
|
||||
@ -901,7 +901,7 @@ static gboolean
|
||||
notify_dnd_leave (gpointer 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)
|
||||
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
|
||||
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);
|
||||
|
||||
@ -1066,21 +1066,21 @@ idropsource_querycontinuedrag (LPDROPSOURCE This,
|
||||
}
|
||||
|
||||
static void
|
||||
maybe_emit_action_changed (GdkWin32DragContext *drag_win32,
|
||||
maybe_emit_action_changed (GdkWin32Drag *drag_win32,
|
||||
GdkDragAction actions)
|
||||
{
|
||||
if (actions != drag_win32->current_action)
|
||||
{
|
||||
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
|
||||
_gdk_win32_local_drag_give_feedback (GdkDragContext *drag,
|
||||
_gdk_win32_local_drag_give_feedback (GdkDrag *drag,
|
||||
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)
|
||||
drag_win32->drag_status = GDK_DRAG_STATUS_DRAG;
|
||||
@ -1101,8 +1101,8 @@ give_feedback (gpointer user_data)
|
||||
|
||||
if (ddd)
|
||||
{
|
||||
GdkDragContext *drag = GDK_DRAG_CONTEXT (feedback->base.opaque_context);
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkDrag *drag = GDK_DRAG (feedback->base.opaque_context);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_dnd_handle_drag_status: 0x%p\n",
|
||||
drag));
|
||||
@ -1587,13 +1587,13 @@ static IEnumFORMATETCVtbl ief_vtbl = {
|
||||
};
|
||||
|
||||
static source_drag_context *
|
||||
source_context_new (GdkDragContext *drag,
|
||||
source_context_new (GdkDrag *drag,
|
||||
GdkContentFormats *formats)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32;
|
||||
GdkWin32Drag *drag_win32;
|
||||
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->drag = g_object_ref (drag);
|
||||
@ -1611,7 +1611,7 @@ source_context_new (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
static data_object *
|
||||
data_object_new (GdkDragContext *drag)
|
||||
data_object_new (GdkDrag *drag)
|
||||
{
|
||||
data_object *result;
|
||||
const char * const *mime_types;
|
||||
@ -1624,7 +1624,7 @@ data_object_new (GdkDragContext *drag)
|
||||
result->drag = drag;
|
||||
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++)
|
||||
{
|
||||
@ -1701,7 +1701,7 @@ create_drag_surface (GdkDisplay *display)
|
||||
return surface;
|
||||
}
|
||||
|
||||
GdkDragContext *
|
||||
GdkDrag *
|
||||
_gdk_win32_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
@ -1709,19 +1709,19 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
|
||||
gint dx,
|
||||
gint dy)
|
||||
{
|
||||
GdkDragContext *drag;
|
||||
GdkWin32DragContext *drag_win32;
|
||||
GdkDrag *drag;
|
||||
GdkWin32Drag *drag_win32;
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
int x_root, y_root;
|
||||
|
||||
g_return_val_if_fail (surface != NULL, NULL);
|
||||
|
||||
drag = gdk_drag_context_new (gdk_surface_get_display (surface),
|
||||
content,
|
||||
actions,
|
||||
device,
|
||||
use_ole2_dnd ? GDK_DRAG_PROTO_OLE2 : GDK_DRAG_PROTO_LOCAL);
|
||||
drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
drag = gdk_drag_new (gdk_surface_get_display (surface),
|
||||
content,
|
||||
actions,
|
||||
device,
|
||||
use_ole2_dnd ? GDK_DRAG_PROTO_OLE2 : GDK_DRAG_PROTO_LOCAL);
|
||||
drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
g_set_object (&drag->source_surface, surface);
|
||||
|
||||
@ -1752,8 +1752,7 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
|
||||
source_drag_context *source_ctx;
|
||||
data_object *data_obj;
|
||||
|
||||
source_ctx = source_context_new (drag,
|
||||
gdk_drag_context_get_formats (drag));
|
||||
source_ctx = source_context_new (drag, gdk_drag_get_formats (drag));
|
||||
data_obj = data_object_new (drag);
|
||||
|
||||
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.
|
||||
*/
|
||||
static HWND
|
||||
gdk_win32_drag_context_find_window (GdkDragContext *drag,
|
||||
GdkSurface *drag_surface,
|
||||
gint x_root,
|
||||
gint y_root)
|
||||
gdk_win32_drag_find_window (GdkDrag *drag,
|
||||
GdkSurface *drag_surface,
|
||||
gint x_root,
|
||||
gint y_root)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
find_window_enum_arg a;
|
||||
HWND result;
|
||||
|
||||
@ -1848,14 +1847,14 @@ gdk_win32_drag_context_find_window (GdkDragContext *drag,
|
||||
a.result = INVALID_HANDLE_VALUE;
|
||||
|
||||
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),
|
||||
a.x, a.y));
|
||||
|
||||
EnumWindows (find_window_enum_proc, (LPARAM) &a);
|
||||
|
||||
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),
|
||||
x_root, y_root,
|
||||
a.result));
|
||||
@ -1900,7 +1899,7 @@ _gdk_win32_get_drop_for_dest_window (HWND dest_window)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_win32_local_drag_motion (GdkDragContext *drag,
|
||||
gdk_win32_local_drag_motion (GdkDrag *drag,
|
||||
HWND dest_window,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
@ -1908,7 +1907,7 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
|
||||
DWORD key_state,
|
||||
guint32 time_)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32;
|
||||
GdkWin32Drag *drag_win32;
|
||||
GdkDrop *drop;
|
||||
GdkDragAction actions;
|
||||
|
||||
@ -1917,11 +1916,11 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
|
||||
|
||||
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);
|
||||
|
||||
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"
|
||||
" 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),
|
||||
dest_window, drag_win32->dest_window, drop, drag,
|
||||
_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)));
|
||||
|
||||
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 &&
|
||||
_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;
|
||||
|
||||
_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",
|
||||
(drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG) ? "TRUE" : "FALSE",
|
||||
drag,
|
||||
_gdk_win32_drag_action_to_string (gdk_drag_context_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_actions (drag)),
|
||||
_gdk_win32_drag_action_to_string (gdk_drag_get_suggested_action (drag)),
|
||||
_gdk_win32_drag_action_to_string (drag->action)));
|
||||
return (drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG);
|
||||
}
|
||||
|
||||
static void
|
||||
send_source_state_update (GdkWin32Clipdrop *clipdrop,
|
||||
GdkWin32DragContext *context_win32,
|
||||
GdkWin32Drag *drag_win32,
|
||||
gpointer *ddd)
|
||||
{
|
||||
GdkWin32DnDThreadUpdateDragState *status = g_new0 (GdkWin32DnDThreadUpdateDragState, 1);
|
||||
status->base.item_type = GDK_WIN32_DND_THREAD_QUEUE_ITEM_UPDATE_DRAG_STATE;
|
||||
status->opaque_ddd = ddd;
|
||||
status->produced_util_data = context_win32->util_data;
|
||||
status->produced_util_data = drag_win32->util_data;
|
||||
increment_dnd_queue_counter ();
|
||||
g_async_queue_push (clipdrop->dnd_queue, status);
|
||||
API_CALL (PostThreadMessage, (clipdrop->dnd_thread_id, thread_wakeup_message, 0, 0));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_drag_drop (GdkDragContext *drag,
|
||||
guint32 time_)
|
||||
gdk_win32_drag_drop (GdkDrag *drag,
|
||||
guint32 time_)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
@ -2006,7 +2005,7 @@ gdk_win32_drag_context_drag_drop (GdkDragContext *drag,
|
||||
|
||||
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)
|
||||
{
|
||||
@ -2016,10 +2015,10 @@ gdk_win32_drag_context_drag_drop (GdkDragContext *drag,
|
||||
{
|
||||
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);
|
||||
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)
|
||||
@ -2034,10 +2033,10 @@ gdk_win32_drag_context_drag_drop (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_drag_abort (GdkDragContext *drag,
|
||||
guint32 time_)
|
||||
gdk_win32_drag_abort (GdkDrag *drag,
|
||||
guint32 time_)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
@ -2045,7 +2044,7 @@ gdk_win32_drag_context_drag_abort (GdkDragContext *drag,
|
||||
|
||||
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)
|
||||
{
|
||||
@ -2059,12 +2058,12 @@ gdk_win32_drag_context_drag_abort (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_set_cursor (GdkDragContext *drag,
|
||||
GdkCursor *cursor)
|
||||
gdk_win32_drag_set_cursor (GdkDrag *drag,
|
||||
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))
|
||||
return;
|
||||
@ -2092,7 +2091,7 @@ ease_out_cubic (double t)
|
||||
|
||||
typedef struct _GdkDragAnim GdkDragAnim;
|
||||
struct _GdkDragAnim {
|
||||
GdkWin32DragContext *drag;
|
||||
GdkWin32Drag *drag;
|
||||
GdkFrameClock *frame_clock;
|
||||
gint64 start_time;
|
||||
};
|
||||
@ -2108,7 +2107,7 @@ static gboolean
|
||||
gdk_drag_anim_timeout (gpointer data)
|
||||
{
|
||||
GdkDragAnim *anim = data;
|
||||
GdkWin32DragContext *drag = anim->drag;
|
||||
GdkWin32Drag *drag = anim->drag;
|
||||
GdkFrameClock *frame_clock = anim->frame_clock;
|
||||
gint64 current_time;
|
||||
double f;
|
||||
@ -2136,10 +2135,10 @@ gdk_drag_anim_timeout (gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_drop_done (GdkDragContext *drag,
|
||||
gboolean success)
|
||||
gdk_win32_drag_drop_done (GdkDrag *drag,
|
||||
gboolean success)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
GdkDragAnim *anim;
|
||||
/*
|
||||
cairo_surface_t *win_surface;
|
||||
@ -2148,7 +2147,7 @@ gdk_win32_drag_context_drop_done (GdkDragContext *drag,
|
||||
*/
|
||||
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,
|
||||
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->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->start_x, drag_win32->start_y));
|
||||
|
||||
@ -2218,9 +2217,9 @@ gdk_win32_drag_context_drop_done (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
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;
|
||||
GdkSeat *seat;
|
||||
GdkCursor *cursor;
|
||||
@ -2232,11 +2231,11 @@ drag_context_grab (GdkDragContext *drag)
|
||||
if (!drag_win32->grab_surface)
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
if (gdk_seat_grab (seat, drag_win32->grab_surface,
|
||||
@ -2252,9 +2251,9 @@ drag_context_grab (GdkDragContext *drag)
|
||||
}
|
||||
|
||||
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",
|
||||
drag,
|
||||
@ -2271,10 +2270,10 @@ drag_context_ungrab (GdkDragContext *drag)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_cancel (GdkDragContext *drag,
|
||||
GdkDragCancelReason reason)
|
||||
gdk_win32_drag_cancel (GdkDrag *drag,
|
||||
GdkDragCancelReason reason)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
const gchar *reason_str = NULL;
|
||||
switch (reason)
|
||||
@ -2293,7 +2292,7 @@ gdk_win32_drag_context_cancel (GdkDragContext *drag,
|
||||
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,
|
||||
reason_str));
|
||||
|
||||
@ -2305,20 +2304,20 @@ gdk_win32_drag_context_cancel (GdkDragContext *drag,
|
||||
drop = NULL;
|
||||
}
|
||||
|
||||
gdk_drag_context_set_cursor (drag, NULL);
|
||||
gdk_drag_set_cursor (drag, NULL);
|
||||
drag_context_ungrab (drag);
|
||||
gdk_drag_drop_done (drag, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_drop_performed (GdkDragContext *drag,
|
||||
guint32 time_)
|
||||
gdk_win32_drag_drop_performed (GdkDrag *drag,
|
||||
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,
|
||||
time_));
|
||||
gdk_drag_drop (drag, time_);
|
||||
gdk_drag_context_set_cursor (drag, NULL);
|
||||
gdk_drag_set_cursor (drag, NULL);
|
||||
drag_context_ungrab (drag);
|
||||
}
|
||||
|
||||
@ -2326,33 +2325,33 @@ gdk_win32_drag_context_drop_performed (GdkDragContext *drag,
|
||||
#define SMALL_STEP 1
|
||||
|
||||
static void
|
||||
gdk_local_drag_update (GdkDragContext *drag,
|
||||
gdouble x_root,
|
||||
gdouble y_root,
|
||||
DWORD grfKeyState,
|
||||
guint32 evtime)
|
||||
gdk_local_drag_update (GdkDrag *drag,
|
||||
gdouble x_root,
|
||||
gdouble y_root,
|
||||
DWORD grfKeyState,
|
||||
guint32 evtime)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
HWND dest_window;
|
||||
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
_win32_main_thread == g_thread_self ());
|
||||
|
||||
dest_window = gdk_win32_drag_context_find_window (drag,
|
||||
drag_win32->drag_surface,
|
||||
x_root, y_root);
|
||||
dest_window = gdk_win32_drag_find_window (drag,
|
||||
drag_win32->drag_surface,
|
||||
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);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_dnd_handle_motion_event (GdkDragContext *drag,
|
||||
gdk_dnd_handle_motion_event (GdkDrag *drag,
|
||||
const GdkEventMotion *event)
|
||||
{
|
||||
GdkModifierType state;
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
DWORD key_state;
|
||||
|
||||
if (!gdk_event_get_state ((GdkEvent *) event, &state))
|
||||
@ -2391,10 +2390,10 @@ gdk_dnd_handle_motion_event (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_dnd_handle_key_event (GdkDragContext *drag,
|
||||
gdk_dnd_handle_key_event (GdkDrag *drag,
|
||||
const GdkEventKey *event)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
GdkModifierType state;
|
||||
GdkDevice *pointer;
|
||||
gint dx, dy;
|
||||
@ -2413,7 +2412,7 @@ gdk_dnd_handle_key_event (GdkDragContext *drag,
|
||||
switch (event->keyval)
|
||||
{
|
||||
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;
|
||||
|
||||
case GDK_KEY_space:
|
||||
@ -2421,13 +2420,13 @@ gdk_dnd_handle_key_event (GdkDragContext *drag,
|
||||
case GDK_KEY_ISO_Enter:
|
||||
case GDK_KEY_KP_Enter:
|
||||
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))
|
||||
{
|
||||
g_signal_emit_by_name (drag, "drop-performed");
|
||||
}
|
||||
else
|
||||
gdk_drag_context_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
|
||||
gdk_drag_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
|
||||
|
||||
return TRUE;
|
||||
|
||||
@ -2477,10 +2476,10 @@ gdk_dnd_handle_key_event (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_dnd_handle_grab_broken_event (GdkDragContext *drag,
|
||||
gdk_dnd_handle_grab_broken_event (GdkDrag *drag,
|
||||
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",
|
||||
drag));
|
||||
@ -2495,15 +2494,15 @@ gdk_dnd_handle_grab_broken_event (GdkDragContext *drag,
|
||||
return FALSE;
|
||||
|
||||
if (gdk_event_get_device ((GdkEvent *) event) !=
|
||||
gdk_drag_context_get_device (drag))
|
||||
gdk_drag_get_device (drag))
|
||||
return FALSE;
|
||||
|
||||
gdk_drag_context_cancel (drag, GDK_DRAG_CANCEL_ERROR);
|
||||
gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_dnd_handle_button_event (GdkDragContext *drag,
|
||||
gdk_dnd_handle_button_event (GdkDrag *drag,
|
||||
const GdkEventButton *event)
|
||||
{
|
||||
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;
|
||||
#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");
|
||||
}
|
||||
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 */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_win32_drag_context_handle_event (GdkDragContext *drag,
|
||||
const GdkEvent *event)
|
||||
gdk_win32_drag_handle_event (GdkDrag *drag,
|
||||
const GdkEvent *event)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
if (!drag_win32->grab_seat)
|
||||
return FALSE;
|
||||
@ -2560,29 +2559,29 @@ gdk_win32_drag_context_handle_event (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
void
|
||||
gdk_win32_drag_context_action_changed (GdkDragContext *drag,
|
||||
GdkDragAction action)
|
||||
gdk_win32_drag_action_changed (GdkDrag *drag,
|
||||
GdkDragAction action)
|
||||
{
|
||||
GdkCursor *cursor;
|
||||
|
||||
cursor = gdk_drag_get_cursor (drag, action);
|
||||
gdk_drag_context_set_cursor (drag, cursor);
|
||||
gdk_drag_set_cursor (drag, cursor);
|
||||
}
|
||||
|
||||
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
|
||||
gdk_win32_drag_context_set_hotspot (GdkDragContext *drag,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
gdk_win32_drag_set_hotspot (GdkDrag *drag,
|
||||
gint hot_x,
|
||||
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,
|
||||
hot_x, hot_y));
|
||||
|
||||
@ -2597,23 +2596,22 @@ gdk_win32_drag_context_set_hotspot (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_class_init (GdkWin32DragContextClass *klass)
|
||||
gdk_win32_drag_class_init (GdkWin32DragClass *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;
|
||||
context_class->drag_drop = gdk_win32_drag_context_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->drag_abort = gdk_win32_drag_abort;
|
||||
drag_class->drag_drop = gdk_win32_drag_drop;
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#include "gdkdropprivate.h"
|
||||
|
||||
#include "gdkdnd.h"
|
||||
#include "gdkdrag.h"
|
||||
#include "gdkproperty.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkprivate-win32.h"
|
||||
@ -172,7 +172,7 @@ gdk_win32_drop_finalize (GObject *object)
|
||||
static GdkDrop *
|
||||
gdk_drop_new (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkDragContext *drag,
|
||||
GdkDrag *drag,
|
||||
GdkContentFormats *formats,
|
||||
GdkSurface *surface,
|
||||
GdkDragProtocol protocol)
|
||||
@ -453,7 +453,7 @@ set_source_actions_helper (GdkDrop *drop,
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_local_drop_target_dragenter (GdkDragContext *drag,
|
||||
_gdk_win32_local_drop_target_dragenter (GdkDrag *drag,
|
||||
GdkSurface *dest_surface,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
@ -478,7 +478,7 @@ _gdk_win32_local_drop_target_dragenter (GdkDragContext *drag,
|
||||
drop = gdk_drop_new (display,
|
||||
gdk_seat_get_pointer (gdk_display_get_default_seat (display)),
|
||||
drag,
|
||||
gdk_content_formats_ref (gdk_drag_context_get_formats (drag)),
|
||||
gdk_content_formats_ref (gdk_drag_get_formats (drag)),
|
||||
dest_surface,
|
||||
GDK_DRAG_PROTO_LOCAL);
|
||||
drop_win32 = GDK_WIN32_DROP (drop);
|
||||
@ -518,7 +518,7 @@ idroptarget_dragenter (LPDROPTARGET This,
|
||||
GdkDisplay *display;
|
||||
gint pt_x;
|
||||
gint pt_y;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GdkDragAction source_actions;
|
||||
GdkDragAction dest_actions;
|
||||
|
||||
@ -531,7 +531,7 @@ idroptarget_dragenter (LPDROPTARGET This,
|
||||
|
||||
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.
|
||||
*/
|
||||
drag = NULL;
|
||||
@ -593,7 +593,7 @@ _gdk_win32_local_drop_target_will_emit_motion (GdkDrop *drop,
|
||||
|
||||
void
|
||||
_gdk_win32_local_drop_target_dragover (GdkDrop *drop,
|
||||
GdkDragContext *drag,
|
||||
GdkDrag *drag,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
DWORD grfKeyState,
|
||||
@ -710,7 +710,7 @@ idroptarget_dragleave (LPDROPTARGET This)
|
||||
|
||||
void
|
||||
_gdk_win32_local_drop_target_drop (GdkDrop *drop,
|
||||
GdkDragContext *drag,
|
||||
GdkDrag *drag,
|
||||
guint32 time_,
|
||||
GdkDragAction *actions)
|
||||
{
|
||||
@ -1065,7 +1065,7 @@ gdk_win32_drop_status (GdkDrop *drop,
|
||||
GdkDragAction actions)
|
||||
{
|
||||
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
|
||||
g_return_if_fail (drop != NULL);
|
||||
|
||||
@ -1090,7 +1090,7 @@ static void
|
||||
gdk_win32_drop_finish (GdkDrop *drop,
|
||||
GdkDragAction action)
|
||||
{
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
|
||||
|
||||
g_return_if_fail (drop != NULL);
|
||||
@ -1107,7 +1107,7 @@ gdk_win32_drop_finish (GdkDrop *drop,
|
||||
drag = gdk_drop_get_drag (drop);
|
||||
|
||||
if (drag != NULL)
|
||||
_gdk_win32_local_drag_context_drop_response (drag, action);
|
||||
_gdk_win32_local_drag_drop_response (drag, action);
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
||||
#include "gdkwin32dnd-private.h"
|
||||
#include "gdkdisplay-win32.h"
|
||||
//#include "gdkselection-win32.h"
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkdragprivate.h"
|
||||
|
||||
#include <windowsx.h>
|
||||
|
||||
@ -873,7 +873,7 @@ _gdk_win32_print_event (const GdkEvent *event)
|
||||
if (event->dnd.drop != NULL)
|
||||
g_print ("ctx:%p: %s",
|
||||
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;
|
||||
case GDK_SCROLL:
|
||||
g_print ("(%.4g,%.4g) (%.4g,%.4g) %s ",
|
||||
|
@ -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_unregister_dnd (GdkSurface *window);
|
||||
|
||||
GdkDragContext *_gdk_win32_surface_drag_begin (GdkSurface *window,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint x_root,
|
||||
gint y_root);
|
||||
GdkDrag *_gdk_win32_surface_drag_begin (GdkSurface *window,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint x_root,
|
||||
gint y_root);
|
||||
|
||||
/* Stray GdkWin32Screen members */
|
||||
gboolean _gdk_win32_get_setting (const gchar *name, GValue *value);
|
||||
|
@ -26,12 +26,12 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GdkWin32DragContextUtilityData GdkWin32DragContextUtilityData;
|
||||
typedef struct _GdkWin32DragUtilityData GdkWin32DragUtilityData;
|
||||
|
||||
/* This structure is deliberately designed to be
|
||||
* copyable with memcpy(), i.e. no pointers inside.
|
||||
*/
|
||||
struct _GdkWin32DragContextUtilityData
|
||||
struct _GdkWin32DragUtilityData
|
||||
{
|
||||
gint last_x; /* Coordinates from last event, in GDK space */
|
||||
gint last_y;
|
||||
@ -39,15 +39,15 @@ struct _GdkWin32DragContextUtilityData
|
||||
GdkWin32DndState state;
|
||||
};
|
||||
|
||||
struct _GdkWin32DragContext
|
||||
struct _GdkWin32Drag
|
||||
{
|
||||
GdkDragContext drag;
|
||||
GdkDrag drag;
|
||||
|
||||
/* The drag protocol being used */
|
||||
GdkDragProtocol protocol;
|
||||
|
||||
/* The surface used for grabs.
|
||||
* Usually the same as GdkDragContext->source_surface
|
||||
* Usually the same as GdkDrag->source_surface
|
||||
*/
|
||||
GdkSurface *grab_surface;
|
||||
|
||||
@ -71,7 +71,7 @@ struct _GdkWin32DragContext
|
||||
*/
|
||||
GdkDragAction current_action;
|
||||
|
||||
GdkWin32DragContextUtilityData util_data;
|
||||
GdkWin32DragUtilityData util_data;
|
||||
|
||||
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) */
|
||||
@ -84,23 +84,23 @@ struct _GdkWin32DragContext
|
||||
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);
|
||||
|
||||
GdkDragContext *_gdk_win32_find_drag_for_dest_window (HWND dest_window);
|
||||
GdkDrop *_gdk_win32_get_drop_for_dest_surface (GdkSurface *dest);
|
||||
GdkDrag *_gdk_win32_find_drag_for_dest_window (HWND dest_window);
|
||||
GdkDrop *_gdk_win32_get_drop_for_dest_surface (GdkSurface *dest);
|
||||
|
||||
gboolean _gdk_win32_local_drop_target_will_emit_motion (GdkDrop *drop,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
DWORD grfKeyState);
|
||||
|
||||
void _gdk_win32_local_drop_target_dragenter (GdkDragContext *drag,
|
||||
void _gdk_win32_local_drop_target_dragenter (GdkDrag *drag,
|
||||
GdkSurface *dest_surface,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
@ -108,22 +108,22 @@ void _gdk_win32_local_drop_target_dragenter (GdkDragContext *drag,
|
||||
guint32 time_,
|
||||
GdkDragAction *actions);
|
||||
void _gdk_win32_local_drop_target_dragover (GdkDrop *drop,
|
||||
GdkDragContext *drag,
|
||||
GdkDrag *drag,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
DWORD grfKeyState,
|
||||
guint32 time_,
|
||||
GdkDragAction *actions);
|
||||
void _gdk_win32_local_drop_target_dragleave (GdkDrop *drop,
|
||||
guint32 time_);
|
||||
void _gdk_win32_local_drop_target_dragleave (GdkDrop *drop,
|
||||
guint32 time_);
|
||||
void _gdk_win32_local_drop_target_drop (GdkDrop *drop,
|
||||
GdkDragContext *drag,
|
||||
GdkDrag *drag,
|
||||
guint32 time_,
|
||||
GdkDragAction *actions);
|
||||
|
||||
void _gdk_win32_local_drag_give_feedback (GdkDragContext *drag,
|
||||
void _gdk_win32_local_drag_give_feedback (GdkDrag *drag,
|
||||
GdkDragAction actions);
|
||||
void _gdk_win32_local_drag_context_drop_response (GdkDragContext *drag,
|
||||
void _gdk_win32_local_drag_drop_response (GdkDrag *drag,
|
||||
GdkDragAction action);
|
||||
|
||||
|
||||
|
@ -26,23 +26,23 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_WIN32_DRAG_CONTEXT (gdk_win32_drag_context_get_type ())
|
||||
#define GDK_WIN32_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WIN32_DRAG_CONTEXT, GdkWin32DragContext))
|
||||
#define GDK_WIN32_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_DRAG_CONTEXT, GdkWin32DragContextClass))
|
||||
#define GDK_IS_WIN32_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WIN32_DRAG_CONTEXT))
|
||||
#define GDK_IS_WIN32_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_DRAG_CONTEXT))
|
||||
#define GDK_WIN32_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_DRAG_CONTEXT, GdkWin32DragContextClass))
|
||||
#define GDK_TYPE_WIN32_DRAG (gdk_win32_drag_get_type ())
|
||||
#define GDK_WIN32_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WIN32_DRAG, GdkWin32Drag))
|
||||
#define GDK_WIN32_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_DRAG, GdkWin32DragClass))
|
||||
#define GDK_IS_WIN32_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WIN32_DRAG))
|
||||
#define GDK_IS_WIN32_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_DRAG))
|
||||
#define GDK_WIN32_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_DRAG, GdkWin32DragClass))
|
||||
|
||||
#ifdef GDK_COMPILATION
|
||||
typedef struct _GdkWin32DragContext GdkWin32DragContext;
|
||||
typedef struct _GdkWin32Drag GdkWin32Drag;
|
||||
#else
|
||||
typedef GdkDragContext GdkWin32DragContext;
|
||||
typedef GdkDrag GdkWin32Drag;
|
||||
#endif
|
||||
typedef struct _GdkWin32DragContextClass GdkWin32DragContextClass;
|
||||
typedef struct _GdkWin32DragClass GdkWin32DragClass;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_win32_drag_context_get_type (void);
|
||||
GType gdk_win32_drag_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_WIN32_DRAG_CONTEXT_H__ */
|
||||
#endif /* __GDK_WIN32_DRAG_H__ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -32,7 +32,7 @@
|
||||
#include "gdkclipboard-x11.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkproperty.h"
|
||||
@ -336,7 +336,7 @@ gdk_x11_drop_read_actions (GdkDrop *drop)
|
||||
{
|
||||
GdkX11Drop *drop_x11 = GDK_X11_DROP (drop);
|
||||
GdkDisplay *display = gdk_drop_get_display (drop);
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GdkDragAction actions = GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_ASK;
|
||||
Atom type;
|
||||
int format;
|
||||
@ -398,7 +398,7 @@ gdk_x11_drop_read_actions (GdkDrop *drop)
|
||||
}
|
||||
else
|
||||
{
|
||||
actions = gdk_drag_context_get_actions (drag);
|
||||
actions = gdk_drag_get_actions (drag);
|
||||
drop_x11->xdnd_have_actions = TRUE;
|
||||
}
|
||||
|
||||
@ -468,7 +468,7 @@ xdnd_enter_filter (GdkSurface *surface,
|
||||
GdkX11Display *display_x11;
|
||||
GdkDrop *drop;
|
||||
GdkX11Drop *drop_x11;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GdkSeat *seat;
|
||||
gint i;
|
||||
Atom type;
|
||||
@ -548,7 +548,7 @@ xdnd_enter_filter (GdkSurface *surface,
|
||||
print_target_list (content_formats);
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
drag = gdk_x11_drag_context_find (display, source_window, GDK_SURFACE_XID (surface));
|
||||
drag = gdk_x11_drag_find (display, source_window, GDK_SURFACE_XID (surface));
|
||||
|
||||
drop_x11 = g_object_new (GDK_TYPE_X11_DROP,
|
||||
"device", gdk_seat_get_pointer (seat),
|
||||
@ -768,7 +768,7 @@ gdk_x11_drop_status (GdkDrop *drop,
|
||||
|
||||
if (gdk_drop_get_drag (drop))
|
||||
{
|
||||
gdk_x11_drag_context_handle_status (display, &xev);
|
||||
gdk_x11_drag_handle_status (display, &xev);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -821,7 +821,7 @@ gdk_x11_drop_finish (GdkDrop *drop,
|
||||
|
||||
if (gdk_drop_get_drag (drop))
|
||||
{
|
||||
gdk_x11_drag_context_handle_status (display, &xev);
|
||||
gdk_x11_drag_handle_status (display, &xev);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -849,7 +849,7 @@ gdk_x11_drop_class_init (GdkX11DropClass *klass)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_drop_init (GdkX11Drop *context)
|
||||
gdk_x11_drop_init (GdkX11Drop *drag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -196,16 +196,16 @@ Atom _gdk_x11_get_xatom_for_display_printf (GdkDisplay *display,
|
||||
const gchar *format,
|
||||
...) G_GNUC_PRINTF (2, 3);
|
||||
|
||||
GdkDragContext *gdk_x11_drag_context_find (GdkDisplay *display,
|
||||
Window source_xid,
|
||||
Window dest_xid);
|
||||
void gdk_x11_drag_context_handle_status (GdkDisplay *display,
|
||||
const XEvent *xevent);
|
||||
void gdk_x11_drag_context_handle_finished (GdkDisplay *display,
|
||||
const XEvent *xevent);
|
||||
void gdk_x11_drop_read_actions (GdkDrop *drop);
|
||||
gboolean gdk_x11_drop_filter (GdkSurface *surface,
|
||||
const XEvent *xevent);
|
||||
GdkDrag *gdk_x11_drag_find (GdkDisplay *display,
|
||||
Window source_xid,
|
||||
Window dest_xid);
|
||||
void gdk_x11_drag_handle_status (GdkDisplay *display,
|
||||
const XEvent *xevent);
|
||||
void gdk_x11_drag_handle_finished (GdkDisplay *display,
|
||||
const XEvent *xevent);
|
||||
void gdk_x11_drop_read_actions (GdkDrop *drop);
|
||||
gboolean gdk_x11_drop_filter (GdkSurface *surface,
|
||||
const XEvent *xevent);
|
||||
|
||||
typedef struct _GdkSurfaceCache GdkSurfaceCache;
|
||||
|
||||
@ -225,7 +225,7 @@ void _gdk_x11_cursor_display_finalize (GdkDisplay *display);
|
||||
|
||||
void _gdk_x11_surface_register_dnd (GdkSurface *window);
|
||||
|
||||
GdkDragContext * _gdk_x11_surface_drag_begin (GdkSurface *window,
|
||||
GdkDrag * _gdk_x11_surface_drag_begin (GdkSurface *window,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
|
@ -27,7 +27,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DeviceManagerCore, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DeviceManagerXI2, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DeviceXI2, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Display, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DragContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Drag, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11GLContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Keymap, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Screen, g_object_unref)
|
||||
|
@ -26,23 +26,23 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_X11_DRAG_CONTEXT (gdk_x11_drag_context_get_type ())
|
||||
#define GDK_X11_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_X11_DRAG_CONTEXT, GdkX11DragContext))
|
||||
#define GDK_X11_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_X11_DRAG_CONTEXT, GdkX11DragContextClass))
|
||||
#define GDK_IS_X11_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_X11_DRAG_CONTEXT))
|
||||
#define GDK_IS_X11_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_X11_DRAG_CONTEXT))
|
||||
#define GDK_X11_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_X11_DRAG_CONTEXT, GdkX11DragContextClass))
|
||||
#define GDK_TYPE_X11_DRAG (gdk_x11_drag_get_type ())
|
||||
#define GDK_X11_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_X11_DRAG, GdkX11Drag))
|
||||
#define GDK_X11_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_X11_DRAG, GdkX11DragClass))
|
||||
#define GDK_IS_X11_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_X11_DRAG))
|
||||
#define GDK_IS_X11_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_X11_DRAG))
|
||||
#define GDK_X11_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_X11_DRAG, GdkX11DragClass))
|
||||
|
||||
#ifdef GDK_COMPILATION
|
||||
typedef struct _GdkX11DragContext GdkX11DragContext;
|
||||
typedef struct _GdkX11Drag GdkX11Drag;
|
||||
#else
|
||||
typedef GdkDragContext GdkX11DragContext;
|
||||
typedef GdkDrag GdkX11Drag;
|
||||
#endif
|
||||
typedef struct _GdkX11DragContextClass GdkX11DragContextClass;
|
||||
typedef struct _GdkX11DragClass GdkX11DragClass;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_x11_drag_context_get_type (void);
|
||||
GType gdk_x11_drag_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_X11_DRAG_CONTEXT_H__ */
|
||||
#endif /* __GDK_X11_DRAG_H__ */
|
||||
|
@ -308,7 +308,7 @@ static gboolean gtk_calendar_query_tooltip (GtkWidget *widget,
|
||||
GtkTooltip *tooltip);
|
||||
|
||||
static void gtk_calendar_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data);
|
||||
static void gtk_calendar_drag_data_received (GtkWidget *widget,
|
||||
GdkDrop *drop,
|
||||
@ -2660,7 +2660,7 @@ gtk_calendar_drag_update (GtkGestureDrag *gesture,
|
||||
GtkWidget *widget = data;
|
||||
GtkCalendarPrivate *priv = GTK_CALENDAR (widget)->priv;
|
||||
gdouble start_x, start_y;
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
GdkContentFormats *targets;
|
||||
|
||||
if (!priv->in_drag)
|
||||
@ -2675,15 +2675,15 @@ gtk_calendar_drag_update (GtkGestureDrag *gesture,
|
||||
|
||||
targets = gdk_content_formats_new (NULL, 0);
|
||||
targets = gtk_content_formats_add_text_targets (targets);
|
||||
context = gtk_drag_begin_with_coordinates (widget,
|
||||
gtk_gesture_get_device (GTK_GESTURE (gesture)),
|
||||
targets, GDK_ACTION_COPY,
|
||||
start_x, start_y);
|
||||
drag = gtk_drag_begin_with_coordinates (widget,
|
||||
gtk_gesture_get_device (GTK_GESTURE (gesture)),
|
||||
targets, GDK_ACTION_COPY,
|
||||
start_x, start_y);
|
||||
|
||||
priv->in_drag = 0;
|
||||
gdk_content_formats_unref (targets);
|
||||
|
||||
gtk_drag_set_icon_default (context);
|
||||
gtk_drag_set_icon_default (drag);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2900,7 +2900,7 @@ gtk_calendar_grab_notify (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_calendar_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
||||
|
@ -110,10 +110,10 @@ static void gtk_color_button_clicked (GtkButton *button,
|
||||
|
||||
/* source side drag signals */
|
||||
static void gtk_color_button_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data);
|
||||
static void gtk_color_button_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
GtkColorButton *button);
|
||||
|
||||
@ -312,7 +312,7 @@ gtk_color_button_drag_data_received (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
set_color_icon (GdkDragContext *context,
|
||||
set_color_icon (GdkDrag *drag,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
GtkSnapshot *snapshot;
|
||||
@ -324,24 +324,24 @@ set_color_icon (GdkDragContext *context,
|
||||
&GRAPHENE_RECT_INIT(0, 0, 48, 32));
|
||||
paintable = gtk_snapshot_free_to_paintable (snapshot, NULL);
|
||||
|
||||
gtk_drag_set_icon_paintable (context, paintable, 0, 0);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, 0, 0);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_color_button_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkColorButton *button = data;
|
||||
GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
|
||||
|
||||
set_color_icon (context, &priv->rgba);
|
||||
set_color_icon (drag, &priv->rgba);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_color_button_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
GtkColorButton *button)
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ swatch_snapshot (GtkWidget *widget,
|
||||
|
||||
|
||||
static void
|
||||
drag_set_color_icon (GdkDragContext *context,
|
||||
drag_set_color_icon (GdkDrag *drag,
|
||||
const GdkRGBA *color)
|
||||
{
|
||||
GtkSnapshot *snapshot;
|
||||
@ -169,24 +169,24 @@ drag_set_color_icon (GdkDragContext *context,
|
||||
&GRAPHENE_RECT_INIT(0, 0, 48, 32));
|
||||
paintable = gtk_snapshot_free_to_paintable (snapshot, NULL);
|
||||
|
||||
gtk_drag_set_icon_paintable (context, paintable, 4, 4);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, 4, 4);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
|
||||
static void
|
||||
swatch_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
|
||||
GdkRGBA color;
|
||||
|
||||
gtk_color_swatch_get_rgba (swatch, &color);
|
||||
drag_set_color_icon (context, &color);
|
||||
drag_set_color_icon (drag, &color);
|
||||
}
|
||||
|
||||
static void
|
||||
swatch_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
|
||||
|
203
gtk/gtkdnd.c
203
gtk/gtkdnd.c
@ -67,7 +67,7 @@ struct _GtkDragSourceInfo
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkContentFormats *target_list; /* Targets for drag data */
|
||||
GdkDragContext *context; /* drag context */
|
||||
GdkDrag *drag; /* drag context */
|
||||
GtkWidget *icon_window; /* Window for drag */
|
||||
GtkWidget *icon_widget; /* Widget for drag */
|
||||
|
||||
@ -115,9 +115,9 @@ static void gtk_drag_dest_set_widget (GtkDragDestInfo *info,
|
||||
|
||||
static GtkDragDestInfo * gtk_drag_get_dest_info (GdkDrop *drop,
|
||||
gboolean create);
|
||||
static GtkDragSourceInfo *gtk_drag_get_source_info (GdkDragContext *context,
|
||||
static GtkDragSourceInfo *gtk_drag_get_source_info (GdkDrag *drag,
|
||||
gboolean create);
|
||||
static void gtk_drag_clear_source_info (GdkDragContext *context);
|
||||
static void gtk_drag_clear_source_info (GdkDrag *drag);
|
||||
|
||||
static void gtk_drag_drop (GtkDragSourceInfo *info);
|
||||
static void gtk_drag_drop_finished (GtkDragSourceInfo *info,
|
||||
@ -128,20 +128,20 @@ static void gtk_drag_cancel_internal (GtkDragSourceInfo *info,
|
||||
static void gtk_drag_remove_icon (GtkDragSourceInfo *info);
|
||||
static void gtk_drag_source_info_destroy (GtkDragSourceInfo *info);
|
||||
|
||||
static void gtk_drag_context_drop_performed_cb (GdkDragContext *context,
|
||||
GtkDragSourceInfo *info);
|
||||
static void gtk_drag_context_cancel_cb (GdkDragContext *context,
|
||||
GdkDragCancelReason reason,
|
||||
GtkDragSourceInfo *info);
|
||||
static void gtk_drag_context_dnd_finished_cb (GdkDragContext *context,
|
||||
GtkDragSourceInfo *info);
|
||||
static void gtk_drag_drop_performed_cb (GdkDrag *drag,
|
||||
GtkDragSourceInfo *info);
|
||||
static void gtk_drag_cancel_cb (GdkDrag *drag,
|
||||
GdkDragCancelReason reason,
|
||||
GtkDragSourceInfo *info);
|
||||
static void gtk_drag_dnd_finished_cb (GdkDrag *drag,
|
||||
GtkDragSourceInfo *info);
|
||||
|
||||
static gboolean gtk_drag_abort_timeout (gpointer data);
|
||||
|
||||
static void set_icon_helper (GdkDragContext *context,
|
||||
GtkImageDefinition*def,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
static void set_icon_helper (GdkDrag *drag,
|
||||
GtkImageDefinition *def,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
|
||||
|
||||
/********************
|
||||
@ -304,7 +304,7 @@ gtk_drag_get_data (GtkWidget *widget,
|
||||
|
||||
/**
|
||||
* gtk_drag_get_source_widget:
|
||||
* @context: a (destination side) drag context
|
||||
* @drag: a drag context
|
||||
*
|
||||
* Determines the source widget for a drag.
|
||||
*
|
||||
@ -313,13 +313,13 @@ gtk_drag_get_data (GtkWidget *widget,
|
||||
* Otherwise, %NULL.
|
||||
*/
|
||||
GtkWidget *
|
||||
gtk_drag_get_source_widget (GdkDragContext *context)
|
||||
gtk_drag_get_source_widget (GdkDrag *drag)
|
||||
{
|
||||
GtkDragSourceInfo *info;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
|
||||
|
||||
info = gtk_drag_get_source_info (context, FALSE);
|
||||
info = gtk_drag_get_source_info (drag, FALSE);
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
|
||||
@ -594,28 +594,28 @@ gtk_drag_get_dest_info (GdkDrop *drop,
|
||||
static GQuark dest_info_quark = 0;
|
||||
|
||||
static GtkDragSourceInfo *
|
||||
gtk_drag_get_source_info (GdkDragContext *context,
|
||||
gboolean create)
|
||||
gtk_drag_get_source_info (GdkDrag *drag,
|
||||
gboolean create)
|
||||
{
|
||||
GtkDragSourceInfo *info;
|
||||
if (!dest_info_quark)
|
||||
dest_info_quark = g_quark_from_static_string ("gtk-source-info");
|
||||
|
||||
info = g_object_get_qdata (G_OBJECT (context), dest_info_quark);
|
||||
info = g_object_get_qdata (G_OBJECT (drag), dest_info_quark);
|
||||
if (!info && create)
|
||||
{
|
||||
info = g_new0 (GtkDragSourceInfo, 1);
|
||||
info->context = context;
|
||||
g_object_set_qdata (G_OBJECT (context), dest_info_quark, info);
|
||||
info->drag = drag;
|
||||
g_object_set_qdata (G_OBJECT (drag), dest_info_quark, info);
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_drag_clear_source_info (GdkDragContext *context)
|
||||
gtk_drag_clear_source_info (GdkDrag *drag)
|
||||
{
|
||||
g_object_set_qdata (G_OBJECT (context), dest_info_quark, NULL);
|
||||
g_object_set_qdata (G_OBJECT (drag), dest_info_quark, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -743,7 +743,7 @@ struct _GtkDragContent
|
||||
GdkContentProvider parent;
|
||||
|
||||
GtkWidget *widget;
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
GdkContentFormats *formats;
|
||||
guint32 time;
|
||||
};
|
||||
@ -809,7 +809,7 @@ gtk_drag_content_write_mime_type_async (GdkContentProvider *provider,
|
||||
sdata.display = gtk_widget_get_display (content->widget);
|
||||
|
||||
g_signal_emit_by_name (content->widget, "drag-data-get",
|
||||
content->context,
|
||||
content->drag,
|
||||
&sdata);
|
||||
|
||||
if (sdata.length == -1)
|
||||
@ -873,7 +873,7 @@ gtk_drag_content_init (GtkDragContent *content)
|
||||
/* Like gtk_drag_begin(), but also takes a GtkImageDefinition
|
||||
* so that we can set the icon from the source site information
|
||||
*/
|
||||
GdkDragContext *
|
||||
GdkDrag *
|
||||
gtk_drag_begin_internal (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GtkImageDefinition *icon,
|
||||
@ -884,7 +884,7 @@ gtk_drag_begin_internal (GtkWidget *widget,
|
||||
{
|
||||
GtkDragSourceInfo *info;
|
||||
GtkWidget *toplevel;
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
int dx, dy;
|
||||
GtkDragContent *content;
|
||||
|
||||
@ -905,17 +905,17 @@ gtk_drag_begin_internal (GtkWidget *widget,
|
||||
content->widget = g_object_ref (widget);
|
||||
content->formats = gdk_content_formats_ref (target_list);
|
||||
|
||||
context = gdk_drag_begin (gtk_widget_get_surface (toplevel), device, GDK_CONTENT_PROVIDER (content), actions, dx, dy);
|
||||
if (context == NULL)
|
||||
drag = gdk_drag_begin (gtk_widget_get_surface (toplevel), device, GDK_CONTENT_PROVIDER (content), actions, dx, dy);
|
||||
if (drag == NULL)
|
||||
{
|
||||
g_object_unref (content);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content->context = context;
|
||||
content->drag = drag;
|
||||
g_object_unref (content);
|
||||
|
||||
info = gtk_drag_get_source_info (context, TRUE);
|
||||
info = gtk_drag_get_source_info (drag, TRUE);
|
||||
|
||||
g_object_set_data (G_OBJECT (widget), I_("gtk-info"), info);
|
||||
|
||||
@ -930,7 +930,7 @@ gtk_drag_begin_internal (GtkWidget *widget,
|
||||
|
||||
gtk_widget_reset_controllers (widget);
|
||||
|
||||
g_signal_emit_by_name (widget, "drag-begin", info->context);
|
||||
g_signal_emit_by_name (widget, "drag-begin", info->drag);
|
||||
|
||||
/* Ensure that we have an icon before we start the drag; the
|
||||
* application may have set one in ::drag_begin, or it may
|
||||
@ -940,24 +940,24 @@ gtk_drag_begin_internal (GtkWidget *widget,
|
||||
{
|
||||
if (icon)
|
||||
{
|
||||
set_icon_helper (info->context, icon, 0, 0);
|
||||
set_icon_helper (info->drag, icon, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = gtk_image_definition_new_icon_name ("text-x-generic");
|
||||
set_icon_helper (info->context, icon, 0, 0);
|
||||
set_icon_helper (info->drag, icon, 0, 0);
|
||||
gtk_image_definition_unref (icon);
|
||||
}
|
||||
}
|
||||
|
||||
g_signal_connect (context, "drop-performed",
|
||||
G_CALLBACK (gtk_drag_context_drop_performed_cb), info);
|
||||
g_signal_connect (context, "dnd-finished",
|
||||
G_CALLBACK (gtk_drag_context_dnd_finished_cb), info);
|
||||
g_signal_connect (context, "cancel",
|
||||
G_CALLBACK (gtk_drag_context_cancel_cb), info);
|
||||
g_signal_connect (drag, "drop-performed",
|
||||
G_CALLBACK (gtk_drag_drop_performed_cb), info);
|
||||
g_signal_connect (drag, "dnd-finished",
|
||||
G_CALLBACK (gtk_drag_dnd_finished_cb), info);
|
||||
g_signal_connect (drag, "cancel",
|
||||
G_CALLBACK (gtk_drag_cancel_cb), info);
|
||||
|
||||
return info->context;
|
||||
return info->drag;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -979,7 +979,7 @@ gtk_drag_begin_internal (GtkWidget *widget,
|
||||
*
|
||||
* Returns: (transfer none): the context for this drag
|
||||
*/
|
||||
GdkDragContext *
|
||||
GdkDrag *
|
||||
gtk_drag_begin_with_coordinates (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GdkContentFormats *targets,
|
||||
@ -1016,7 +1016,7 @@ icon_widget_destroyed (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_drag_set_icon_widget_internal (GdkDragContext *context,
|
||||
gtk_drag_set_icon_widget_internal (GdkDrag *drag,
|
||||
GtkWidget *widget,
|
||||
gint hot_x,
|
||||
gint hot_y,
|
||||
@ -1026,7 +1026,7 @@ gtk_drag_set_icon_widget_internal (GdkDragContext *context,
|
||||
|
||||
g_return_if_fail (!GTK_IS_WINDOW (widget));
|
||||
|
||||
info = gtk_drag_get_source_info (context, FALSE);
|
||||
info = gtk_drag_get_source_info (drag, FALSE);
|
||||
if (info == NULL)
|
||||
{
|
||||
if (destroy_on_release)
|
||||
@ -1047,13 +1047,13 @@ gtk_drag_set_icon_widget_internal (GdkDragContext *context,
|
||||
|
||||
g_signal_connect (widget, "destroy", G_CALLBACK (icon_widget_destroyed), info);
|
||||
|
||||
gdk_drag_context_set_hotspot (context, hot_x, hot_y);
|
||||
gdk_drag_set_hotspot (drag, hot_x, hot_y);
|
||||
|
||||
if (!info->icon_window)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
|
||||
display = gdk_drag_context_get_display (context);
|
||||
display = gdk_drag_get_display (drag);
|
||||
|
||||
info->icon_window = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
gtk_window_set_type_hint (GTK_WINDOW (info->icon_window), GDK_SURFACE_TYPE_HINT_DND);
|
||||
@ -1062,7 +1062,7 @@ gtk_drag_set_icon_widget_internal (GdkDragContext *context,
|
||||
gtk_style_context_remove_class (gtk_widget_get_style_context (info->icon_window), "background");
|
||||
|
||||
gtk_window_set_hardcoded_surface (GTK_WINDOW (info->icon_window),
|
||||
gdk_drag_context_get_drag_surface (context));
|
||||
gdk_drag_get_drag_surface (drag));
|
||||
gtk_widget_show (info->icon_window);
|
||||
}
|
||||
|
||||
@ -1073,8 +1073,7 @@ gtk_drag_set_icon_widget_internal (GdkDragContext *context,
|
||||
|
||||
/**
|
||||
* gtk_drag_set_icon_widget:
|
||||
* @context: the context for a drag. (This must be called
|
||||
with a context for the source side of a drag)
|
||||
* @drag: the context for a drag
|
||||
* @widget: a widget to use as an icon
|
||||
* @hot_x: the X offset within @widget of the hotspot
|
||||
* @hot_y: the Y offset within @widget of the hotspot
|
||||
@ -1085,19 +1084,19 @@ gtk_drag_set_icon_widget_internal (GdkDragContext *context,
|
||||
* signal and destroy it yourself.
|
||||
*/
|
||||
void
|
||||
gtk_drag_set_icon_widget (GdkDragContext *context,
|
||||
gtk_drag_set_icon_widget (GdkDrag *drag,
|
||||
GtkWidget *widget,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
gtk_drag_set_icon_widget_internal (context, widget, hot_x, hot_y, FALSE);
|
||||
gtk_drag_set_icon_widget_internal (drag, widget, hot_x, hot_y, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
set_icon_helper (GdkDragContext *context,
|
||||
set_icon_helper (GdkDrag *drag,
|
||||
GtkImageDefinition *def,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
@ -1107,25 +1106,24 @@ set_icon_helper (GdkDragContext *context,
|
||||
widget = gtk_image_new ();
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "drag-icon");
|
||||
gtk_image_set_from_definition (GTK_IMAGE (widget), def);
|
||||
gtk_drag_set_icon_widget_internal (context, widget, hot_x, hot_y, TRUE);
|
||||
gtk_drag_set_icon_widget_internal (drag, widget, hot_x, hot_y, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_drag_set_icon_definition (GdkDragContext *context,
|
||||
gtk_drag_set_icon_definition (GdkDrag *drag,
|
||||
GtkImageDefinition *def,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
g_return_if_fail (def != NULL);
|
||||
|
||||
set_icon_helper (context, def, hot_x, hot_y);
|
||||
set_icon_helper (drag, def, hot_x, hot_y);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_drag_set_icon_paintable:
|
||||
* @context: the context for a drag (This must be called
|
||||
* with a context for the source side of a drag)
|
||||
* @drag: the context for a drag
|
||||
* @paintable: the #GdkPaintable to use as icon
|
||||
* @hot_x: the X offset of the hotspot within the icon
|
||||
* @hot_y: the Y offset of the hotspot within the icon
|
||||
@ -1139,26 +1137,25 @@ gtk_drag_set_icon_definition (GdkDragContext *context,
|
||||
* mouse cursor.
|
||||
*/
|
||||
void
|
||||
gtk_drag_set_icon_paintable (GdkDragContext *context,
|
||||
gtk_drag_set_icon_paintable (GdkDrag *drag,
|
||||
GdkPaintable *paintable,
|
||||
int hot_x,
|
||||
int hot_y)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
g_return_if_fail (GDK_IS_PAINTABLE (paintable));
|
||||
|
||||
widget = gtk_picture_new_for_paintable (paintable);
|
||||
gtk_picture_set_can_shrink (GTK_PICTURE (widget), FALSE);
|
||||
|
||||
gtk_drag_set_icon_widget_internal (context, widget, hot_x, hot_y, TRUE);
|
||||
gtk_drag_set_icon_widget_internal (drag, widget, hot_x, hot_y, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_drag_set_icon_name:
|
||||
* @context: the context for a drag (This must be called
|
||||
* with a context for the source side of a drag)
|
||||
* @drag: the context for a drag
|
||||
* @icon_name: name of icon to use
|
||||
* @hot_x: the X offset of the hotspot within the icon
|
||||
* @hot_y: the Y offset of the hotspot within the icon
|
||||
@ -1170,26 +1167,25 @@ gtk_drag_set_icon_paintable (GdkDragContext *context,
|
||||
* @hot_x and @hot_y have to be used with care.
|
||||
*/
|
||||
void
|
||||
gtk_drag_set_icon_name (GdkDragContext *context,
|
||||
gtk_drag_set_icon_name (GdkDrag *drag,
|
||||
const gchar *icon_name,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
{
|
||||
GtkImageDefinition *def;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
g_return_if_fail (icon_name != NULL && icon_name[0] != '\0');
|
||||
|
||||
def = gtk_image_definition_new_icon_name (icon_name);
|
||||
set_icon_helper (context, def, hot_x, hot_y);
|
||||
set_icon_helper (drag, def, hot_x, hot_y);
|
||||
|
||||
gtk_image_definition_unref (def);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_drag_set_icon_gicon:
|
||||
* @context: the context for a drag (This must be called
|
||||
* with a context for the source side of a drag)
|
||||
* @drag: the context for a drag
|
||||
* @icon: a #GIcon
|
||||
* @hot_x: the X offset of the hotspot within the icon
|
||||
* @hot_y: the Y offset of the hotspot within the icon
|
||||
@ -1199,36 +1195,35 @@ gtk_drag_set_icon_name (GdkDragContext *context,
|
||||
* for more details about using icons in drag and drop.
|
||||
*/
|
||||
void
|
||||
gtk_drag_set_icon_gicon (GdkDragContext *context,
|
||||
gtk_drag_set_icon_gicon (GdkDrag *drag,
|
||||
GIcon *icon,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
{
|
||||
GtkImageDefinition *def;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
g_return_if_fail (icon != NULL);
|
||||
|
||||
def = gtk_image_definition_new_gicon (icon);
|
||||
set_icon_helper (context, def, hot_x, hot_y);
|
||||
set_icon_helper (drag, def, hot_x, hot_y);
|
||||
|
||||
gtk_image_definition_unref (def);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_drag_set_icon_default:
|
||||
* @context: the context for a drag (This must be called
|
||||
* with a context for the source side of a drag)
|
||||
* @drag: the context for a drag
|
||||
*
|
||||
* Sets the icon for a particular drag to the default
|
||||
* icon.
|
||||
*/
|
||||
void
|
||||
gtk_drag_set_icon_default (GdkDragContext *context)
|
||||
gtk_drag_set_icon_default (GdkDrag *drag)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
|
||||
gtk_drag_set_icon_name (context, "text-x-generic", -2, -2);
|
||||
gtk_drag_set_icon_name (drag, "text-x-generic", -2, -2);
|
||||
}
|
||||
|
||||
/* Clean up from the drag, and display snapback, if necessary. */
|
||||
@ -1242,9 +1237,9 @@ gtk_drag_drop_finished (GtkDragSourceInfo *info,
|
||||
|
||||
if (!success)
|
||||
g_signal_emit_by_name (info->widget, "drag-failed",
|
||||
info->context, result, &success);
|
||||
info->drag, result, &success);
|
||||
|
||||
gdk_drag_drop_done (info->context, success);
|
||||
gdk_drag_drop_done (info->drag, success);
|
||||
gtk_drag_source_info_destroy (info);
|
||||
}
|
||||
|
||||
@ -1296,17 +1291,11 @@ gtk_drag_source_info_free (GtkDragSourceInfo *info)
|
||||
static void
|
||||
gtk_drag_source_info_destroy (GtkDragSourceInfo *info)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (info->context,
|
||||
gtk_drag_context_drop_performed_cb,
|
||||
info);
|
||||
g_signal_handlers_disconnect_by_func (info->context,
|
||||
gtk_drag_context_dnd_finished_cb,
|
||||
info);
|
||||
g_signal_handlers_disconnect_by_func (info->context,
|
||||
gtk_drag_context_cancel_cb,
|
||||
info);
|
||||
g_signal_handlers_disconnect_by_func (info->drag, gtk_drag_drop_performed_cb, info);
|
||||
g_signal_handlers_disconnect_by_func (info->drag, gtk_drag_dnd_finished_cb, info);
|
||||
g_signal_handlers_disconnect_by_func (info->drag, gtk_drag_cancel_cb, info);
|
||||
|
||||
g_signal_emit_by_name (info->widget, "drag-end", info->context);
|
||||
g_signal_emit_by_name (info->widget, "drag-end", info->drag);
|
||||
|
||||
g_object_set_data (G_OBJECT (info->widget), I_("gtk-info"), NULL);
|
||||
|
||||
@ -1318,10 +1307,10 @@ gtk_drag_source_info_destroy (GtkDragSourceInfo *info)
|
||||
g_source_remove (info->drop_timeout);
|
||||
|
||||
/* keep the icon_window alive until the (possible) drag cancel animation is done */
|
||||
g_object_set_data_full (G_OBJECT (info->context), "former-gtk-source-info", info, (GDestroyNotify)gtk_drag_source_info_free);
|
||||
g_object_set_data_full (G_OBJECT (info->drag), "former-gtk-source-info", info, (GDestroyNotify)gtk_drag_source_info_free);
|
||||
|
||||
gtk_drag_clear_source_info (info->context);
|
||||
g_object_unref (info->context);
|
||||
gtk_drag_clear_source_info (info->drag);
|
||||
g_object_unref (info->drag);
|
||||
}
|
||||
|
||||
/* Called on cancellation of a drag, either by the user
|
||||
@ -1335,16 +1324,16 @@ gtk_drag_cancel_internal (GtkDragSourceInfo *info,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_drag_context_drop_performed_cb (GdkDragContext *context,
|
||||
GtkDragSourceInfo *info)
|
||||
gtk_drag_drop_performed_cb (GdkDrag *drag,
|
||||
GtkDragSourceInfo *info)
|
||||
{
|
||||
gtk_drag_drop (info);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_drag_context_cancel_cb (GdkDragContext *context,
|
||||
GdkDragCancelReason reason,
|
||||
GtkDragSourceInfo *info)
|
||||
gtk_drag_cancel_cb (GdkDrag *drag,
|
||||
GdkDragCancelReason reason,
|
||||
GtkDragSourceInfo *info)
|
||||
{
|
||||
GtkDragResult result;
|
||||
|
||||
@ -1365,14 +1354,14 @@ gtk_drag_context_cancel_cb (GdkDragContext *context,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_drag_context_dnd_finished_cb (GdkDragContext *context,
|
||||
GtkDragSourceInfo *info)
|
||||
gtk_drag_dnd_finished_cb (GdkDrag *drag,
|
||||
GtkDragSourceInfo *info)
|
||||
{
|
||||
if (gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE)
|
||||
if (gdk_drag_get_selected_action (drag) == GDK_ACTION_MOVE)
|
||||
{
|
||||
g_signal_emit_by_name (info->widget,
|
||||
"drag-data-delete",
|
||||
context);
|
||||
drag);
|
||||
}
|
||||
|
||||
gtk_drag_source_info_destroy (info);
|
||||
@ -1422,7 +1411,7 @@ gtk_drag_check_threshold (GtkWidget *widget,
|
||||
|
||||
/**
|
||||
* gtk_drag_cancel:
|
||||
* @context: a #GdkDragContext, as e.g. returned by gtk_drag_begin_with_coordinates()
|
||||
* @drag: a drag context, as e.g. returned by gtk_drag_begin_with_coordinates()
|
||||
*
|
||||
* Cancels an ongoing drag operation on the source side.
|
||||
*
|
||||
@ -1438,13 +1427,13 @@ gtk_drag_check_threshold (GtkWidget *widget,
|
||||
* #GtkWidget::drag-failed is set to @GTK_DRAG_RESULT_ERROR.
|
||||
*/
|
||||
void
|
||||
gtk_drag_cancel (GdkDragContext *context)
|
||||
gtk_drag_cancel (GdkDrag *drag)
|
||||
{
|
||||
GtkDragSourceInfo *info;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
|
||||
info = gtk_drag_get_source_info (context, FALSE);
|
||||
info = gtk_drag_get_source_info (drag, FALSE);
|
||||
if (info != NULL)
|
||||
gtk_drag_cancel_internal (info, GTK_DRAG_RESULT_ERROR);
|
||||
}
|
||||
|
26
gtk/gtkdnd.h
26
gtk/gtkdnd.h
@ -45,7 +45,7 @@ void gtk_drag_get_data (GtkWidget *widget,
|
||||
GdkAtom target);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget *gtk_drag_get_source_widget (GdkDragContext *context);
|
||||
GtkWidget *gtk_drag_get_source_widget (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_highlight (GtkWidget *widget);
|
||||
@ -55,39 +55,39 @@ void gtk_drag_unhighlight (GtkWidget *widget);
|
||||
/* Source side */
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragContext *gtk_drag_begin_with_coordinates (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GdkContentFormats *targets,
|
||||
GdkDragAction actions,
|
||||
gint x,
|
||||
gint y);
|
||||
GdkDrag *gtk_drag_begin_with_coordinates (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GdkContentFormats *targets,
|
||||
GdkDragAction actions,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_cancel (GdkDragContext *context);
|
||||
void gtk_drag_cancel (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_set_icon_widget (GdkDragContext *context,
|
||||
void gtk_drag_set_icon_widget (GdkDrag *drag,
|
||||
GtkWidget *widget,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_set_icon_paintable (GdkDragContext *context,
|
||||
void gtk_drag_set_icon_paintable (GdkDrag *drag,
|
||||
GdkPaintable *paintable,
|
||||
int hot_x,
|
||||
int hot_y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_set_icon_name (GdkDragContext *context,
|
||||
void gtk_drag_set_icon_name (GdkDrag *drag,
|
||||
const gchar *icon_name,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_set_icon_gicon (GdkDragContext *context,
|
||||
void gtk_drag_set_icon_gicon (GdkDrag *drag,
|
||||
GIcon *icon,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_set_icon_default (GdkDragContext *context);
|
||||
void gtk_drag_set_icon_default (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_drag_check_threshold (GtkWidget *widget,
|
||||
|
@ -40,14 +40,14 @@ struct _GtkDragDestSite
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GdkDragContext * gtk_drag_begin_internal (GtkWidget *widget,
|
||||
GdkDrag * gtk_drag_begin_internal (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GtkImageDefinition *icon,
|
||||
GdkContentFormats *target_list,
|
||||
GdkDragAction actions,
|
||||
int x,
|
||||
int y);
|
||||
void gtk_drag_set_icon_definition (GdkDragContext *context,
|
||||
void gtk_drag_set_icon_definition (GdkDrag *drag,
|
||||
GtkImageDefinition *def,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
|
@ -125,7 +125,7 @@ gtk_drag_dest_set_internal (GtkWidget *widget,
|
||||
* |[<!-- language="C" -->
|
||||
* static void
|
||||
* drag_motion (GtkWidget *widget,
|
||||
* GdkDragContext *context,
|
||||
* GdkDrag *drag,
|
||||
* gint x,
|
||||
* gint y,
|
||||
* guint time)
|
||||
|
@ -445,14 +445,14 @@ static void gtk_entry_drag_data_received (GtkWidget *widget,
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data);
|
||||
static void gtk_entry_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data);
|
||||
static void gtk_entry_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_entry_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_entry_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
|
||||
|
||||
/* GtkEditable method implementations
|
||||
@ -8478,7 +8478,7 @@ gtk_entry_selection_bubble_popup_set (GtkEntry *entry)
|
||||
|
||||
static void
|
||||
gtk_entry_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
@ -8493,7 +8493,7 @@ gtk_entry_drag_begin (GtkWidget *widget,
|
||||
{
|
||||
if (icon_info->in_drag)
|
||||
{
|
||||
gtk_drag_set_icon_definition (context,
|
||||
gtk_drag_set_icon_definition (drag,
|
||||
gtk_image_get_definition (GTK_IMAGE (icon_info->widget)),
|
||||
-2, -2);
|
||||
return;
|
||||
@ -8511,7 +8511,7 @@ gtk_entry_drag_begin (GtkWidget *widget,
|
||||
paintable = gtk_text_util_create_drag_icon (widget, text, -1);
|
||||
gtk_entry_get_pixel_ranges (entry, &ranges, &n_ranges);
|
||||
|
||||
gtk_drag_set_icon_paintable (context,
|
||||
gtk_drag_set_icon_paintable (drag,
|
||||
paintable,
|
||||
priv->drag_start_x - ranges[0],
|
||||
priv->drag_start_y);
|
||||
@ -8524,7 +8524,7 @@ gtk_entry_drag_begin (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_entry_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
@ -8632,7 +8632,7 @@ gtk_entry_get_action (GtkEntry *entry,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (entry);
|
||||
GdkDragContext *drag = gdk_drop_get_drag (drop);
|
||||
GdkDrag *drag = gdk_drop_get_drag (drop);
|
||||
GtkWidget *source_widget = gtk_drag_get_source_widget (drag);
|
||||
GdkDragAction actions;
|
||||
|
||||
@ -8700,7 +8700,7 @@ gtk_entry_drag_data_received (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_entry_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
@ -8734,7 +8734,7 @@ gtk_entry_drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_entry_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
|
@ -277,14 +277,14 @@ static void update_pixbuf_cell (GtkIco
|
||||
|
||||
/* Source side drag signals */
|
||||
static void gtk_icon_view_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_icon_view_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_icon_view_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data);
|
||||
static void gtk_icon_view_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
|
||||
/* Target side drag signals */
|
||||
static void gtk_icon_view_drag_leave (GtkWidget *widget,
|
||||
@ -5702,27 +5702,27 @@ unset_reorderable (GtkIconView *icon_view)
|
||||
}
|
||||
|
||||
static void
|
||||
set_source_row (GdkDragContext *context,
|
||||
set_source_row (GdkDrag *drag,
|
||||
GtkTreeModel *model,
|
||||
GtkTreePath *source_row)
|
||||
{
|
||||
if (source_row)
|
||||
g_object_set_data_full (G_OBJECT (context),
|
||||
g_object_set_data_full (G_OBJECT (drag),
|
||||
I_("gtk-icon-view-source-row"),
|
||||
gtk_tree_row_reference_new (model, source_row),
|
||||
(GDestroyNotify) gtk_tree_row_reference_free);
|
||||
else
|
||||
g_object_set_data_full (G_OBJECT (context),
|
||||
g_object_set_data_full (G_OBJECT (drag),
|
||||
I_("gtk-icon-view-source-row"),
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static GtkTreePath*
|
||||
get_source_row (GdkDragContext *context)
|
||||
get_source_row (GdkDrag *drag)
|
||||
{
|
||||
GtkTreeRowReference *ref;
|
||||
|
||||
ref = g_object_get_data (G_OBJECT (context), "gtk-icon-view-source-row");
|
||||
ref = g_object_get_data (G_OBJECT (drag), "gtk-icon-view-source-row");
|
||||
|
||||
if (ref)
|
||||
return gtk_tree_row_reference_get_path (ref);
|
||||
@ -6020,7 +6020,7 @@ gtk_icon_view_maybe_begin_drag (GtkIconView *icon_view,
|
||||
GdkDevice *device)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (icon_view);
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
GtkTreePath *path = NULL;
|
||||
GtkTreeModel *model;
|
||||
gboolean retval = FALSE;
|
||||
@ -6064,14 +6064,14 @@ gtk_icon_view_maybe_begin_drag (GtkIconView *icon_view,
|
||||
|
||||
retval = TRUE;
|
||||
|
||||
context = gtk_drag_begin_with_coordinates (widget,
|
||||
device,
|
||||
gtk_drag_source_get_target_list (widget),
|
||||
icon_view->priv->source_actions,
|
||||
icon_view->priv->press_start_x,
|
||||
icon_view->priv->press_start_y);
|
||||
drag = gtk_drag_begin_with_coordinates (widget,
|
||||
device,
|
||||
gtk_drag_source_get_target_list (widget),
|
||||
icon_view->priv->source_actions,
|
||||
icon_view->priv->press_start_x,
|
||||
icon_view->priv->press_start_y);
|
||||
|
||||
set_source_row (context, model, path);
|
||||
set_source_row (drag, model, path);
|
||||
|
||||
out:
|
||||
if (path)
|
||||
@ -6083,7 +6083,7 @@ gtk_icon_view_maybe_begin_drag (GtkIconView *icon_view,
|
||||
/* Source side drag signals */
|
||||
static void
|
||||
gtk_icon_view_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkIconView *icon_view;
|
||||
GtkIconViewItem *item;
|
||||
@ -6112,21 +6112,21 @@ gtk_icon_view_drag_begin (GtkWidget *widget,
|
||||
icon = gtk_icon_view_create_drag_icon (icon_view, path);
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
gtk_drag_set_icon_paintable (context, icon, x, y);
|
||||
gtk_drag_set_icon_paintable (drag, icon, x, y);
|
||||
|
||||
g_object_unref (icon);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkIconView *icon_view;
|
||||
@ -6142,7 +6142,7 @@ gtk_icon_view_drag_data_get (GtkWidget *widget,
|
||||
if (!icon_view->priv->source_set)
|
||||
return;
|
||||
|
||||
source_row = get_source_row (context);
|
||||
source_row = get_source_row (drag);
|
||||
|
||||
if (source_row == NULL)
|
||||
return;
|
||||
@ -6170,7 +6170,7 @@ gtk_icon_view_drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_icon_view_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkIconView *icon_view;
|
||||
@ -6185,7 +6185,7 @@ gtk_icon_view_drag_data_delete (GtkWidget *widget,
|
||||
if (!icon_view->priv->source_set)
|
||||
return;
|
||||
|
||||
source_row = get_source_row (context);
|
||||
source_row = get_source_row (drag);
|
||||
|
||||
if (source_row == NULL)
|
||||
return;
|
||||
@ -6195,7 +6195,7 @@ gtk_icon_view_drag_data_delete (GtkWidget *widget,
|
||||
|
||||
gtk_tree_path_free (source_row);
|
||||
|
||||
set_source_row (context, NULL, NULL);
|
||||
set_source_row (drag, NULL, NULL);
|
||||
}
|
||||
|
||||
/* Target side drag signals */
|
||||
@ -6333,7 +6333,7 @@ static GdkDragAction
|
||||
gtk_icon_view_get_action (GtkWidget *treeview,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
GdkDragContext *drag = gdk_drop_get_drag (drop);
|
||||
GdkDrag *drag = gdk_drop_get_drag (drop);
|
||||
GtkWidget *source_widget = gtk_drag_get_source_widget (drag);
|
||||
GdkDragAction actions;
|
||||
|
||||
|
@ -476,7 +476,7 @@ static gboolean gtk_label_mnemonic_activate (GtkWidget *widget,
|
||||
static void gtk_label_setup_mnemonic (GtkLabel *label,
|
||||
guint last_key);
|
||||
static void gtk_label_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data);
|
||||
|
||||
static void gtk_label_buildable_interface_init (GtkBuildableIface *iface);
|
||||
@ -4576,7 +4576,7 @@ connect_mnemonics_visible_notify (GtkLabel *label)
|
||||
|
||||
static void
|
||||
drag_begin_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL (widget);
|
||||
@ -4612,12 +4612,12 @@ drag_begin_cb (GtkWidget *widget,
|
||||
|
||||
if (paintable)
|
||||
{
|
||||
gtk_drag_set_icon_paintable (context, paintable, 0, 0);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, 0, 0);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_drag_set_icon_default (context);
|
||||
gtk_drag_set_icon_default (drag);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5169,7 +5169,7 @@ gtk_label_set_selection_text (GtkLabel *label,
|
||||
|
||||
static void
|
||||
gtk_label_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
gtk_label_set_selection_text (GTK_LABEL (widget), selection_data);
|
||||
|
@ -107,7 +107,7 @@ static void gtk_link_button_set_property (GObject *object,
|
||||
static void gtk_link_button_clicked (GtkButton *button);
|
||||
static gboolean gtk_link_button_popup_menu (GtkWidget *widget);
|
||||
static void gtk_link_button_drag_data_get_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection,
|
||||
gpointer user_data);
|
||||
static gboolean gtk_link_button_query_tooltip_cb (GtkWidget *widget,
|
||||
@ -433,7 +433,7 @@ gtk_link_button_popup_menu (GtkWidget *widget)
|
||||
|
||||
static void
|
||||
gtk_link_button_drag_data_get_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
@ -383,11 +383,11 @@ static gboolean gtk_notebook_focus (GtkWidget *widget,
|
||||
|
||||
/*** Drag and drop Methods ***/
|
||||
static void gtk_notebook_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_notebook_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static gboolean gtk_notebook_drag_failed (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkDragResult result);
|
||||
static gboolean gtk_notebook_drag_motion (GtkWidget *widget,
|
||||
GdkDrop *drop,
|
||||
@ -400,7 +400,7 @@ static gboolean gtk_notebook_drag_drop (GtkWidget *widget,
|
||||
gint x,
|
||||
gint y);
|
||||
static void gtk_notebook_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *data);
|
||||
static void gtk_notebook_drag_data_received (GtkWidget *widget,
|
||||
GdkDrop *drop,
|
||||
@ -2864,7 +2864,7 @@ update_arrow_nodes (GtkNotebook *notebook)
|
||||
|
||||
static void
|
||||
gtk_notebook_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
||||
GtkNotebookPrivate *priv = notebook->priv;
|
||||
@ -2895,14 +2895,14 @@ gtk_notebook_drag_begin (GtkWidget *widget,
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->dnd_child), "background");
|
||||
|
||||
gtk_drag_set_icon_widget (context, tab_label, -2, -2);
|
||||
g_object_set_data (G_OBJECT (priv->dnd_child), "drag-context", context);
|
||||
gtk_drag_set_icon_widget (drag, tab_label, -2, -2);
|
||||
g_object_set_data (G_OBJECT (priv->dnd_child), "drag-context", drag);
|
||||
g_object_unref (tab_label);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_notebook_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
||||
GtkNotebookPrivate *priv = notebook->priv;
|
||||
@ -2914,7 +2914,7 @@ gtk_notebook_drag_end (GtkWidget *widget,
|
||||
GtkNotebook *dest_notebook = NULL;
|
||||
gint x, y;
|
||||
|
||||
gdk_device_get_position (gdk_drag_context_get_device (context), &x, &y);
|
||||
gdk_device_get_position (gdk_drag_get_device (drag), &x, &y);
|
||||
g_signal_emit (notebook, notebook_signals[CREATE_WINDOW], 0,
|
||||
priv->detached_tab->child, x, y, &dest_notebook);
|
||||
|
||||
@ -2950,7 +2950,7 @@ gtk_notebook_create_window (GtkNotebook *notebook,
|
||||
|
||||
static gboolean
|
||||
gtk_notebook_drag_failed (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkDragResult result)
|
||||
{
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
||||
@ -2963,7 +2963,7 @@ gtk_notebook_drag_failed (GtkWidget *widget,
|
||||
GtkNotebook *dest_notebook = NULL;
|
||||
gint x, y;
|
||||
|
||||
gdk_device_get_position (gdk_drag_context_get_device (context), &x, &y);
|
||||
gdk_device_get_position (gdk_drag_get_device (drag), &x, &y);
|
||||
|
||||
g_signal_emit (notebook, notebook_signals[CREATE_WINDOW], 0,
|
||||
priv->detached_tab->child, x, y, &dest_notebook);
|
||||
@ -3200,7 +3200,7 @@ do_detach_tab (GtkNotebook *from,
|
||||
|
||||
static void
|
||||
gtk_notebook_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *data)
|
||||
{
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
||||
@ -3230,7 +3230,7 @@ gtk_notebook_drag_data_received (GtkWidget *widget,
|
||||
GtkSelectionData *data)
|
||||
{
|
||||
GtkNotebook *notebook;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GtkWidget *source_widget;
|
||||
GtkWidget **child;
|
||||
|
||||
@ -4162,10 +4162,10 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
|
||||
|
||||
if (priv->operation == DRAG_OPERATION_DETACH && !priv->remove_in_detach)
|
||||
{
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
|
||||
context = (GdkDragContext *)g_object_get_data (G_OBJECT (priv->dnd_child), "drag-context");
|
||||
gtk_drag_cancel (context);
|
||||
drag = (GdkDrag *)g_object_get_data (G_OBJECT (priv->dnd_child), "drag-context");
|
||||
gtk_drag_cancel (drag);
|
||||
}
|
||||
}
|
||||
if (priv->switch_tab == list)
|
||||
@ -7038,7 +7038,7 @@ gtk_notebook_get_tab_detachable (GtkNotebook *notebook,
|
||||
* |[<!-- language="C" -->
|
||||
* static void
|
||||
* on_drag_data_received (GtkWidget *widget,
|
||||
* GdkDragContext *context,
|
||||
* GdkDrag *drag,
|
||||
* GtkSelectionData *data,
|
||||
* guint time,
|
||||
* gpointer user_data)
|
||||
@ -7046,7 +7046,7 @@ gtk_notebook_get_tab_detachable (GtkNotebook *notebook,
|
||||
* GtkWidget *notebook;
|
||||
* GtkWidget **child;
|
||||
*
|
||||
* notebook = gtk_drag_get_source_widget (context);
|
||||
* notebook = gtk_drag_get_source_widget (drag);
|
||||
* child = (void*) gtk_selection_data_get_data (data);
|
||||
*
|
||||
* // process_widget (*child);
|
||||
|
@ -1283,7 +1283,7 @@ find_button_type (GtkPathBar *path_bar,
|
||||
|
||||
static void
|
||||
button_drag_data_get_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
{
|
||||
|
@ -203,7 +203,7 @@ struct _GtkPlacesSidebarClass {
|
||||
const gchar *primary,
|
||||
const gchar *secondary);
|
||||
GdkDragAction (* drag_action_requested) (GtkPlacesSidebar *sidebar,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GFile *dest_file,
|
||||
GList *source_file_list);
|
||||
GdkDragAction (* drag_action_ask) (GtkPlacesSidebar *sidebar,
|
||||
@ -1722,7 +1722,7 @@ stop_drop_feedback (GtkPlacesSidebar *sidebar)
|
||||
|
||||
static void
|
||||
drag_begin_callback (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkPlacesSidebar *sidebar = GTK_PLACES_SIDEBAR (user_data);
|
||||
@ -1738,7 +1738,7 @@ drag_begin_callback (GtkWidget *widget,
|
||||
|
||||
gtk_widget_set_opacity (drag_widget, 0.8);
|
||||
|
||||
gtk_drag_set_icon_widget (context,
|
||||
gtk_drag_set_icon_widget (drag,
|
||||
drag_widget,
|
||||
sidebar->drag_row_x,
|
||||
sidebar->drag_row_y);
|
||||
@ -1951,7 +1951,7 @@ drop_files_as_bookmarks (GtkPlacesSidebar *sidebar,
|
||||
|
||||
static void
|
||||
drag_data_get_callback (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *data,
|
||||
gpointer user_data)
|
||||
{
|
||||
@ -2085,7 +2085,7 @@ out:
|
||||
|
||||
static void
|
||||
drag_end_callback (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer user_data)
|
||||
{
|
||||
stop_drop_feedback (GTK_PLACES_SIDEBAR (user_data));
|
||||
|
@ -417,14 +417,14 @@ static GtkTextBuffer* gtk_text_view_create_buffer (GtkTextView *text_view);
|
||||
|
||||
/* Source side drag signals */
|
||||
static void gtk_text_view_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_text_view_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_text_view_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data);
|
||||
static void gtk_text_view_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
|
||||
/* Target side drag signals */
|
||||
static void gtk_text_view_drag_leave (GtkWidget *widget,
|
||||
@ -7585,7 +7585,7 @@ gtk_text_view_im_context_filter_keypress (GtkTextView *text_view,
|
||||
|
||||
static void
|
||||
drag_begin_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
|
||||
@ -7601,12 +7601,12 @@ drag_begin_cb (GtkWidget *widget,
|
||||
|
||||
if (paintable)
|
||||
{
|
||||
gtk_drag_set_icon_paintable (context, paintable, 0, 0);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, 0, 0);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_drag_set_icon_default (context);
|
||||
gtk_drag_set_icon_default (drag);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7632,14 +7632,14 @@ gtk_text_view_start_selection_dnd (GtkTextView *text_view,
|
||||
|
||||
static void
|
||||
gtk_text_view_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkTextView *text_view;
|
||||
|
||||
@ -7649,7 +7649,7 @@ gtk_text_view_drag_end (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_text_view_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
|
||||
@ -7685,7 +7685,7 @@ gtk_text_view_drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_text_view_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
gtk_text_buffer_delete_selection (GTK_TEXT_VIEW (widget)->priv->buffer,
|
||||
TRUE, GTK_TEXT_VIEW (widget)->priv->editable);
|
||||
@ -7861,7 +7861,7 @@ static GdkDragAction
|
||||
gtk_text_view_get_action (GtkWidget *textview,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
GdkDragContext *drag = gdk_drop_get_drag (drop);
|
||||
GdkDrag *drag = gdk_drop_get_drag (drop);
|
||||
GtkWidget *source_widget = gtk_drag_get_source_widget (drag);
|
||||
GdkDragAction actions;
|
||||
|
||||
|
@ -618,14 +618,14 @@ static void gtk_tree_view_forall (GtkContainer *container,
|
||||
|
||||
/* Source side drag signals */
|
||||
static void gtk_tree_view_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_tree_view_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_tree_view_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data);
|
||||
static void gtk_tree_view_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
|
||||
/* Target side drag signals */
|
||||
static void gtk_tree_view_drag_leave (GtkWidget *widget,
|
||||
@ -6817,21 +6817,21 @@ _gtk_tree_view_column_autosize (GtkTreeView *tree_view,
|
||||
/* Drag-and-drop */
|
||||
|
||||
static void
|
||||
set_source_row (GdkDragContext *context,
|
||||
set_source_row (GdkDrag *drag,
|
||||
GtkTreeModel *model,
|
||||
GtkTreePath *source_row)
|
||||
{
|
||||
g_object_set_data_full (G_OBJECT (context),
|
||||
g_object_set_data_full (G_OBJECT (drag),
|
||||
I_("gtk-tree-view-source-row"),
|
||||
source_row ? gtk_tree_row_reference_new (model, source_row) : NULL,
|
||||
(GDestroyNotify) (source_row ? gtk_tree_row_reference_free : NULL));
|
||||
}
|
||||
|
||||
static GtkTreePath*
|
||||
get_source_row (GdkDragContext *context)
|
||||
get_source_row (GdkDrag *drag)
|
||||
{
|
||||
GtkTreeRowReference *ref =
|
||||
g_object_get_data (G_OBJECT (context), "gtk-tree-view-source-row");
|
||||
g_object_get_data (G_OBJECT (drag), "gtk-tree-view-source-row");
|
||||
|
||||
if (ref)
|
||||
return gtk_tree_row_reference_get_path (ref);
|
||||
@ -7304,7 +7304,7 @@ gtk_tree_view_maybe_begin_dragging_row (GtkTreeView *tree_view)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (tree_view);
|
||||
gdouble start_x, start_y, offset_x, offset_y;
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
TreeViewDragInfo *di;
|
||||
GtkTreePath *path = NULL;
|
||||
gint button;
|
||||
@ -7361,13 +7361,13 @@ gtk_tree_view_maybe_begin_dragging_row (GtkTreeView *tree_view)
|
||||
gtk_gesture_set_state (GTK_GESTURE (tree_view->priv->drag_gesture),
|
||||
GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
|
||||
context = gtk_drag_begin_with_coordinates (widget,
|
||||
gtk_gesture_get_device (GTK_GESTURE (tree_view->priv->drag_gesture)),
|
||||
gtk_drag_source_get_target_list (widget),
|
||||
di->source_actions,
|
||||
start_x, start_y);
|
||||
drag = gtk_drag_begin_with_coordinates (widget,
|
||||
gtk_gesture_get_device (GTK_GESTURE (tree_view->priv->drag_gesture)),
|
||||
gtk_drag_source_get_target_list (widget),
|
||||
di->source_actions,
|
||||
start_x, start_y);
|
||||
|
||||
set_source_row (context, model, path);
|
||||
set_source_row (drag, model, path);
|
||||
|
||||
out:
|
||||
if (path)
|
||||
@ -7379,7 +7379,7 @@ gtk_tree_view_maybe_begin_dragging_row (GtkTreeView *tree_view)
|
||||
|
||||
static void
|
||||
gtk_tree_view_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkTreeView *tree_view;
|
||||
GtkTreePath *path = NULL;
|
||||
@ -7412,10 +7412,9 @@ gtk_tree_view_drag_begin (GtkWidget *widget,
|
||||
if (!path)
|
||||
return;
|
||||
|
||||
row_pix = gtk_tree_view_create_row_drag_icon (tree_view,
|
||||
path);
|
||||
row_pix = gtk_tree_view_create_row_drag_icon (tree_view, path);
|
||||
|
||||
gtk_drag_set_icon_paintable (context, row_pix, tree_view->priv->press_start_x + 1, 1);
|
||||
gtk_drag_set_icon_paintable (drag, row_pix, tree_view->priv->press_start_x + 1, 1);
|
||||
|
||||
g_object_unref (row_pix);
|
||||
gtk_tree_path_free (path);
|
||||
@ -7423,7 +7422,7 @@ gtk_tree_view_drag_begin (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_tree_view_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
|
||||
|
||||
@ -7434,7 +7433,7 @@ gtk_tree_view_drag_end (GtkWidget *widget,
|
||||
/* Default signal implementations for the drag signals */
|
||||
static void
|
||||
gtk_tree_view_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkTreeView *tree_view;
|
||||
@ -7454,7 +7453,7 @@ gtk_tree_view_drag_data_get (GtkWidget *widget,
|
||||
if (di == NULL)
|
||||
return;
|
||||
|
||||
source_row = get_source_row (context);
|
||||
source_row = get_source_row (drag);
|
||||
|
||||
if (source_row == NULL)
|
||||
return;
|
||||
@ -7485,7 +7484,7 @@ gtk_tree_view_drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_tree_view_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
TreeViewDragInfo *di;
|
||||
GtkTreeModel *model;
|
||||
@ -7503,17 +7502,16 @@ gtk_tree_view_drag_data_delete (GtkWidget *widget,
|
||||
if (di == NULL)
|
||||
return;
|
||||
|
||||
source_row = get_source_row (context);
|
||||
source_row = get_source_row (drag);
|
||||
|
||||
if (source_row == NULL)
|
||||
return;
|
||||
|
||||
gtk_tree_drag_source_drag_data_delete (GTK_TREE_DRAG_SOURCE (model),
|
||||
source_row);
|
||||
gtk_tree_drag_source_drag_data_delete (GTK_TREE_DRAG_SOURCE (model), source_row);
|
||||
|
||||
gtk_tree_path_free (source_row);
|
||||
|
||||
set_source_row (context, NULL, NULL);
|
||||
set_source_row (drag, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -7670,7 +7668,7 @@ static GdkDragAction
|
||||
gtk_tree_view_get_action (GtkWidget *treeview,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
GdkDragContext *drag = gdk_drop_get_drag (drop);
|
||||
GdkDrag *drag = gdk_drop_get_drag (drop);
|
||||
GtkWidget *source_widget = gtk_drag_get_source_widget (drag);
|
||||
GdkDragAction actions;
|
||||
|
||||
|
@ -1743,7 +1743,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
/**
|
||||
* GtkWidget::drag-begin:
|
||||
* @widget: the object which received the signal
|
||||
* @context: the drag context
|
||||
* @context: the drag context
|
||||
*
|
||||
* The ::drag-begin signal is emitted on the drag source when a drag is
|
||||
* started. A typical reason to connect to this signal is to set up a
|
||||
@ -1761,7 +1761,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
GDK_TYPE_DRAG_CONTEXT);
|
||||
GDK_TYPE_DRAG);
|
||||
|
||||
/**
|
||||
* GtkWidget::drag-end:
|
||||
@ -1780,7 +1780,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
GDK_TYPE_DRAG_CONTEXT);
|
||||
GDK_TYPE_DRAG);
|
||||
|
||||
/**
|
||||
* GtkWidget::drag-data-delete:
|
||||
@ -1800,7 +1800,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
GDK_TYPE_DRAG_CONTEXT);
|
||||
GDK_TYPE_DRAG);
|
||||
|
||||
/**
|
||||
* GtkWidget::drag-failed:
|
||||
@ -1824,7 +1824,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
_gtk_boolean_handled_accumulator, NULL,
|
||||
_gtk_marshal_BOOLEAN__OBJECT_ENUM,
|
||||
G_TYPE_BOOLEAN, 2,
|
||||
GDK_TYPE_DRAG_CONTEXT,
|
||||
GDK_TYPE_DRAG,
|
||||
GTK_TYPE_DRAG_RESULT);
|
||||
|
||||
/**
|
||||
@ -1982,7 +1982,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__OBJECT_BOXED,
|
||||
G_TYPE_NONE, 2,
|
||||
GDK_TYPE_DRAG_CONTEXT,
|
||||
GDK_TYPE_DRAG,
|
||||
GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||
|
||||
/**
|
||||
|
@ -293,15 +293,15 @@ struct _GtkWidgetClass
|
||||
GdkEvent *event);
|
||||
|
||||
/* Source side drag signals */
|
||||
void (* drag_begin) (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
void (* drag_begin) (GtkWidget *widget,
|
||||
GdkDrag *drag);
|
||||
void (* drag_end) (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
void (* drag_data_get) (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data);
|
||||
void (* drag_data_delete) (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
|
||||
/* Target side drag signals */
|
||||
void (* drag_leave) (GtkWidget *widget,
|
||||
@ -318,7 +318,7 @@ struct _GtkWidgetClass
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data);
|
||||
gboolean (* drag_failed) (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkDragResult result);
|
||||
|
||||
/* Signals used only for keybindings */
|
||||
|
@ -314,7 +314,7 @@ target_drag_motion (GtkWidget *widget,
|
||||
gint y)
|
||||
{
|
||||
GtkWidget *source_widget;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
char *s;
|
||||
|
||||
if (!have_drag)
|
||||
@ -418,7 +418,7 @@ label_drag_data_received (GtkWidget *widget,
|
||||
|
||||
void
|
||||
source_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
{
|
||||
@ -565,7 +565,7 @@ popsite_leave (GtkWidget *widget,
|
||||
|
||||
void
|
||||
source_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
g_print ("Delete the data!\n");
|
||||
|
@ -39,7 +39,7 @@ enum {
|
||||
|
||||
static void
|
||||
image_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
@ -65,7 +65,7 @@ image_drag_begin (GtkWidget *widget,
|
||||
hot_y = size;
|
||||
break;
|
||||
}
|
||||
gtk_drag_set_icon_paintable (context, paintable, hot_x, hot_y);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, hot_x, hot_y);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
|
||||
@ -80,7 +80,9 @@ drag_widget_destroyed (GtkWidget *image, gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
window_drag_end (GtkWidget *widget, GdkDragContext *context, gpointer data)
|
||||
window_drag_end (GtkWidget *widget,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *window = data;
|
||||
|
||||
@ -90,7 +92,7 @@ window_drag_end (GtkWidget *widget, GdkDragContext *context, gpointer data)
|
||||
|
||||
static void
|
||||
window_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
@ -114,7 +116,7 @@ window_drag_begin (GtkWidget *widget,
|
||||
else
|
||||
g_print ("reusing drag widget\n");
|
||||
|
||||
gtk_drag_set_icon_widget (context, image, 0, 0);
|
||||
gtk_drag_set_icon_widget (drag, image, 0, 0);
|
||||
|
||||
if (hotspot == CENTER)
|
||||
g_signal_connect (widget, "drag-end", G_CALLBACK (window_drag_end), image);
|
||||
@ -153,7 +155,7 @@ update_dest_target_list (GtkWidget *image)
|
||||
|
||||
void
|
||||
image_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
{
|
||||
@ -264,7 +266,7 @@ make_image2 (const gchar *icon_name, int hotspot)
|
||||
|
||||
static void
|
||||
spinner_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *spinner;
|
||||
@ -274,25 +276,25 @@ spinner_drag_begin (GtkWidget *widget,
|
||||
"visible", TRUE,
|
||||
"active", TRUE,
|
||||
NULL);
|
||||
gtk_drag_set_icon_widget (context, spinner, 0, 0);
|
||||
g_object_set_data (G_OBJECT (context), "spinner", spinner);
|
||||
gtk_drag_set_icon_widget (drag, spinner, 0, 0);
|
||||
g_object_set_data (G_OBJECT (drag), "spinner", spinner);
|
||||
}
|
||||
|
||||
static void
|
||||
spinner_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *spinner;
|
||||
|
||||
g_print ("GtkWidget::drag-end\n");
|
||||
spinner = g_object_get_data (G_OBJECT (context), "spinner");
|
||||
spinner = g_object_get_data (G_OBJECT (drag), "spinner");
|
||||
gtk_widget_destroy (spinner);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
spinner_drag_failed (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkDragResult result,
|
||||
gpointer data)
|
||||
{
|
||||
@ -309,7 +311,7 @@ spinner_drag_failed (GtkWidget *widget,
|
||||
|
||||
void
|
||||
spinner_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
{
|
||||
|
@ -10,19 +10,19 @@ clear_pressed (GtkEntry *entry, gint icon, gpointer data)
|
||||
|
||||
static void
|
||||
drag_begin_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint pos;
|
||||
|
||||
pos = gtk_entry_get_current_icon_drag_source (GTK_ENTRY (widget));
|
||||
if (pos != -1)
|
||||
gtk_drag_set_icon_name (context, "dialog-information", 2, 2);
|
||||
gtk_drag_set_icon_name (drag, "dialog-information", 2, 2);
|
||||
}
|
||||
|
||||
static void
|
||||
drag_data_get_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *data,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
@ -20,19 +20,19 @@
|
||||
|
||||
static void
|
||||
drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *image = GTK_WIDGET (data);
|
||||
GdkPaintable *paintable;
|
||||
|
||||
paintable = gtk_image_get_paintable (GTK_IMAGE (image));
|
||||
gtk_drag_set_icon_paintable (context, paintable, -2, -2);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, -2, -2);
|
||||
}
|
||||
|
||||
void
|
||||
drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
{
|
||||
@ -46,7 +46,7 @@ drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
guint32 time,
|
||||
|
@ -6,7 +6,7 @@ static const char *entries[] = {
|
||||
|
||||
static void
|
||||
drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *row;
|
||||
@ -19,7 +19,7 @@ drag_begin (GtkWidget *widget,
|
||||
|
||||
paintable = gtk_widget_paintable_new (row);
|
||||
gtk_widget_translate_coordinates (widget, row, 0, 0, &x, &y);
|
||||
gtk_drag_set_icon_paintable (context, paintable, -x, -y);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, -x, -y);
|
||||
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
@ -27,7 +27,7 @@ drag_begin (GtkWidget *widget,
|
||||
|
||||
void
|
||||
drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ on_page_reordered (GtkNotebook *notebook, GtkWidget *child, guint page_num, gpoi
|
||||
|
||||
static void
|
||||
on_notebook_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
guint page_num;
|
||||
@ -101,7 +101,7 @@ on_notebook_drag_begin (GtkWidget *widget,
|
||||
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (widget));
|
||||
|
||||
if (page_num > 2)
|
||||
gtk_drag_set_icon_name (context,
|
||||
gtk_drag_set_icon_name (drag,
|
||||
(page_num % 2) ? "help-browser" : "process-stop",
|
||||
0, 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user