|
|
|
@ -36,15 +36,13 @@ typedef struct _GtkDragAnim GtkDragAnim;
|
|
|
|
|
typedef struct _GtkDragFindData GtkDragFindData;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
typedef enum {
|
|
|
|
|
GTK_DRAG_STATUS_DRAG,
|
|
|
|
|
GTK_DRAG_STATUS_WAIT,
|
|
|
|
|
GTK_DRAG_STATUS_DROP
|
|
|
|
|
} GtkDragStatus;
|
|
|
|
|
|
|
|
|
|
struct _GtkDragSourceSite
|
|
|
|
|
{
|
|
|
|
|
struct _GtkDragSourceSite {
|
|
|
|
|
GdkModifierType start_button_mask;
|
|
|
|
|
GtkTargetList *target_list; /* Targets for drag data */
|
|
|
|
|
GdkDragAction actions; /* Possible actions */
|
|
|
|
@ -57,8 +55,7 @@ struct _GtkDragSourceSite
|
|
|
|
|
gint x, y;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct _GtkDragSourceInfo
|
|
|
|
|
{
|
|
|
|
|
struct _GtkDragSourceInfo {
|
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
GtkTargetList *target_list; /* Targets for drag data */
|
|
|
|
|
GdkDragAction possible_actions; /* Actions allowed by source */
|
|
|
|
@ -82,8 +79,7 @@ struct _GtkDragSourceInfo
|
|
|
|
|
guint drop_timeout; /* Timeout for aborting drop */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct _GtkDragDestSite
|
|
|
|
|
{
|
|
|
|
|
struct _GtkDragDestSite {
|
|
|
|
|
GtkDestDefaults flags;
|
|
|
|
|
GtkTargetList *target_list;
|
|
|
|
|
GdkDragAction actions;
|
|
|
|
@ -94,8 +90,7 @@ struct _GtkDragDestSite
|
|
|
|
|
gboolean have_drag : 1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct _GtkDragDestInfo
|
|
|
|
|
{
|
|
|
|
|
struct _GtkDragDestInfo {
|
|
|
|
|
GtkWidget *widget; /* Widget in which drag is in */
|
|
|
|
|
GdkDragContext *context; /* Drag context */
|
|
|
|
|
GtkDragSourceInfo *proxy_source; /* Set if this is a proxy drag */
|
|
|
|
@ -116,15 +111,13 @@ struct _GtkDragDestInfo
|
|
|
|
|
#define ANIM_MIN_STEPS 5
|
|
|
|
|
#define ANIM_MAX_STEPS 10
|
|
|
|
|
|
|
|
|
|
struct _GtkDragAnim
|
|
|
|
|
{
|
|
|
|
|
struct _GtkDragAnim {
|
|
|
|
|
GtkDragSourceInfo *info;
|
|
|
|
|
gint step;
|
|
|
|
|
gint n_steps;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct _GtkDragFindData
|
|
|
|
|
{
|
|
|
|
|
struct _GtkDragFindData {
|
|
|
|
|
gint x;
|
|
|
|
|
gint y;
|
|
|
|
|
GdkDragContext *context;
|
|
|
|
@ -138,8 +131,7 @@ struct _GtkDragFindData
|
|
|
|
|
|
|
|
|
|
/* Enumeration for some targets we handle internally */
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
enum {
|
|
|
|
|
TARGET_MOTIF_SUCCESS = 0x40000000,
|
|
|
|
|
TARGET_MOTIF_FAILURE,
|
|
|
|
|
TARGET_DELETE
|
|
|
|
@ -159,8 +151,8 @@ static void gtk_drag_get_event_actions (GdkEvent *event,
|
|
|
|
|
GdkDragAction actions,
|
|
|
|
|
GdkDragAction *suggested_action,
|
|
|
|
|
GdkDragAction *possible_actions);
|
|
|
|
|
static GdkCursor* gtk_drag_get_cursor (GdkDragAction action);
|
|
|
|
|
static GtkWidget* gtk_drag_get_ipc_widget (void);
|
|
|
|
|
static GdkCursor * gtk_drag_get_cursor (GdkDragAction action);
|
|
|
|
|
static GtkWidget *gtk_drag_get_ipc_widget (void);
|
|
|
|
|
static void gtk_drag_release_ipc_widget (GtkWidget *widget);
|
|
|
|
|
|
|
|
|
|
static void gtk_drag_highlight_paint (GtkWidget *widget);
|
|
|
|
@ -234,70 +226,70 @@ static gint gtk_drag_abort_timeout (gpointer data);
|
|
|
|
|
|
|
|
|
|
#define action_ask_width 16
|
|
|
|
|
#define action_ask_height 16
|
|
|
|
|
static const gchar action_ask_bits[] = {
|
|
|
|
|
static const char action_ask_bits[] = {
|
|
|
|
|
0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x1f, 0x06, 0xc0, 0x76, 0xf8, 0xb6, 0xf7,
|
|
|
|
|
0xd6, 0xec, 0x66, 0xdb, 0x66, 0xdb, 0x96, 0xec, 0x76, 0xf7, 0x76, 0xfb,
|
|
|
|
|
0xf6, 0xfc, 0x72, 0xfb, 0x7a, 0xfb, 0xf8, 0xfc, };
|
|
|
|
|
|
|
|
|
|
#define action_ask_mask_width 16
|
|
|
|
|
#define action_ask_mask_height 16
|
|
|
|
|
static const gchar action_ask_mask_bits[] = {
|
|
|
|
|
static const char action_ask_mask_bits[] = {
|
|
|
|
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x8f, 0x07, 0xcf, 0x0f,
|
|
|
|
|
0xef, 0x1f, 0xff, 0x3c, 0xff, 0x3c, 0x6f, 0x1f, 0x8f, 0x0f, 0x8f, 0x07,
|
|
|
|
|
0x0f, 0x03, 0x8f, 0x07, 0x87, 0x07, 0x07, 0x03, };
|
|
|
|
|
|
|
|
|
|
#define action_copy_width 16
|
|
|
|
|
#define action_copy_height 16
|
|
|
|
|
static const gchar action_copy_bits[] = {
|
|
|
|
|
static const char action_copy_bits[] = {
|
|
|
|
|
0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x1f, 0x06, 0xc0, 0x76, 0xfb, 0x76, 0xfb,
|
|
|
|
|
0x76, 0xfb, 0x06, 0x83, 0xf6, 0xbf, 0xf6, 0xbf, 0x06, 0x83, 0x76, 0xfb,
|
|
|
|
|
0x76, 0xfb, 0x72, 0xfb, 0x7a, 0xf8, 0xf8, 0xff, };
|
|
|
|
|
|
|
|
|
|
#define action_copy_mask_width 16
|
|
|
|
|
#define action_copy_mask_height 16
|
|
|
|
|
static const gchar action_copy_mask_bits[] = {
|
|
|
|
|
static const char action_copy_mask_bits[] = {
|
|
|
|
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x8f, 0x07, 0x8f, 0x07,
|
|
|
|
|
0x8f, 0x07, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x8f, 0x07,
|
|
|
|
|
0x8f, 0x07, 0x8f, 0x07, 0x87, 0x07, 0x07, 0x00, };
|
|
|
|
|
|
|
|
|
|
#define action_move_width 16
|
|
|
|
|
#define action_move_height 16
|
|
|
|
|
static const gchar action_move_bits[] = {
|
|
|
|
|
static const char action_move_bits[] = {
|
|
|
|
|
0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x1f, 0x06, 0xc0, 0x96, 0xff, 0x26, 0xff,
|
|
|
|
|
0xc6, 0xf8, 0xd6, 0xe3, 0x96, 0x8f, 0xb6, 0xbf, 0x36, 0xc3, 0x76, 0xfb,
|
|
|
|
|
0x76, 0xfa, 0xf2, 0xfa, 0xfa, 0xf8, 0xf8, 0xff, };
|
|
|
|
|
|
|
|
|
|
#define action_move_mask_width 16
|
|
|
|
|
#define action_move_mask_height 16
|
|
|
|
|
static const gchar action_move_mask_bits[] = {
|
|
|
|
|
static const char action_move_mask_bits[] = {
|
|
|
|
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x6f, 0x00, 0xff, 0x00,
|
|
|
|
|
0xff, 0x07, 0xef, 0x1f, 0xef, 0x7f, 0xcf, 0x7f, 0xcf, 0x3f, 0x8f, 0x07,
|
|
|
|
|
0x8f, 0x07, 0x0f, 0x07, 0x07, 0x07, 0x07, 0x00, };
|
|
|
|
|
|
|
|
|
|
#define action_link_width 16
|
|
|
|
|
#define action_link_height 16
|
|
|
|
|
static const gchar action_link_bits[] = {
|
|
|
|
|
static const char action_link_bits[] = {
|
|
|
|
|
0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x1f, 0x06, 0xc0, 0x36, 0xf8, 0xd6, 0xf7,
|
|
|
|
|
0x66, 0xec, 0xa6, 0xe8, 0x26, 0xdf, 0xe6, 0xbd, 0xd6, 0xa7, 0xb6, 0xa8,
|
|
|
|
|
0xb6, 0xb1, 0x72, 0xdf, 0xfa, 0xe0, 0xf8, 0xff, };
|
|
|
|
|
|
|
|
|
|
#define action_link_mask_width 16
|
|
|
|
|
#define action_link_mask_height 16
|
|
|
|
|
static const gchar action_link_mask_bits[] = {
|
|
|
|
|
static const char action_link_mask_bits[] = {
|
|
|
|
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xcf, 0x07, 0xef, 0x0f,
|
|
|
|
|
0xff, 0x1f, 0x7f, 0x1f, 0xff, 0x3f, 0xff, 0x7f, 0xef, 0x7f, 0xcf, 0x77,
|
|
|
|
|
0xcf, 0x7f, 0x8f, 0x3f, 0x07, 0x1f, 0x07, 0x00, };
|
|
|
|
|
|
|
|
|
|
#define action_none_width 16
|
|
|
|
|
#define action_none_height 16
|
|
|
|
|
static const gchar action_none_bits[] = {
|
|
|
|
|
static const char action_none_bits[] = {
|
|
|
|
|
0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x1f, 0x06, 0xc0, 0xf6, 0xff, 0xf6, 0xff,
|
|
|
|
|
0xf6, 0xff, 0xf6, 0xff, 0xf6, 0xff, 0xf6, 0xff, 0xf6, 0xff, 0xf6, 0xff,
|
|
|
|
|
0xf6, 0xff, 0xf2, 0xff, 0xfa, 0xff, 0xf8, 0xff, };
|
|
|
|
|
|
|
|
|
|
#define action_none_mask_width 16
|
|
|
|
|
#define action_none_mask_height 16
|
|
|
|
|
static const gchar action_none_mask_bits[] = {
|
|
|
|
|
static const char action_none_mask_bits[] = {
|
|
|
|
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x0f, 0x00, 0x0f, 0x00,
|
|
|
|
|
0x0f, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0x0f, 0x00,
|
|
|
|
|
0x0f, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x07, 0x00, };
|
|
|
|
@ -305,11 +297,10 @@ static const gchar action_none_mask_bits[] = {
|
|
|
|
|
#define CURSOR_WIDTH 16
|
|
|
|
|
#define CURSOR_HEIGHT 16
|
|
|
|
|
|
|
|
|
|
static struct
|
|
|
|
|
{
|
|
|
|
|
static struct {
|
|
|
|
|
GdkDragAction action;
|
|
|
|
|
const gchar *bits;
|
|
|
|
|
const gchar *mask;
|
|
|
|
|
const char *bits;
|
|
|
|
|
const char *mask;
|
|
|
|
|
GdkCursor *cursor;
|
|
|
|
|
} drag_cursors[] = {
|
|
|
|
|
{ GDK_ACTION_DEFAULT, 0 },
|
|
|
|
@ -320,47 +311,46 @@ static struct
|
|
|
|
|
{ 0 , action_none_bits, action_none_mask_bits, NULL },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const gint n_drag_cursors = sizeof (drag_cursors) / sizeof (drag_cursors[0]);
|
|
|
|
|
static const gint n_drag_cursors = sizeof(drag_cursors) / sizeof(drag_cursors[0]);
|
|
|
|
|
|
|
|
|
|
/* XPM */
|
|
|
|
|
static const gchar *drag_default_xpm[] = {
|
|
|
|
|
"32 32 3 1",
|
|
|
|
|
" c None",
|
|
|
|
|
". c #000000",
|
|
|
|
|
"+ c #FFFFFF",
|
|
|
|
|
" ",
|
|
|
|
|
" ",
|
|
|
|
|
" .. ",
|
|
|
|
|
" ..+. ",
|
|
|
|
|
" ..++.. ",
|
|
|
|
|
" ...++++. ",
|
|
|
|
|
" ...++++++.. ",
|
|
|
|
|
" ...+++++++++. ",
|
|
|
|
|
" ...+++++++++++.. ",
|
|
|
|
|
" ..+.++++++++++++.. ",
|
|
|
|
|
" .++.++++++++++++.. ",
|
|
|
|
|
" .+++.++++++++++++.. ",
|
|
|
|
|
" .++++.++++++++++++. ",
|
|
|
|
|
" .+++.+++++++++++++.. ",
|
|
|
|
|
" .++.+++++++++++++++.. ",
|
|
|
|
|
" .+.+++++++++++++++++.. ",
|
|
|
|
|
" ..+++++++++++++++++++.. ",
|
|
|
|
|
" ..++++++++++++++++++++. ",
|
|
|
|
|
" .++++++++++++++++++++.. ",
|
|
|
|
|
" ..+++++++++++++++++.. ",
|
|
|
|
|
" .++++++++++++++++.. ",
|
|
|
|
|
" ..+++++++++++++... ",
|
|
|
|
|
" .++++++++++++.. ",
|
|
|
|
|
" ..+++++++++.. ",
|
|
|
|
|
" .++++++++.. ",
|
|
|
|
|
" ..++++++.. ",
|
|
|
|
|
" .+++++.. ",
|
|
|
|
|
" .++.. ",
|
|
|
|
|
" ... ",
|
|
|
|
|
" .. ",
|
|
|
|
|
" ",
|
|
|
|
|
" ",
|
|
|
|
|
};
|
|
|
|
|
static const char * drag_default_xpm[] = {
|
|
|
|
|
"32 32 3 1",
|
|
|
|
|
" c None",
|
|
|
|
|
". c #000000",
|
|
|
|
|
"+ c #FFFFFF",
|
|
|
|
|
" ",
|
|
|
|
|
" ",
|
|
|
|
|
" .. ",
|
|
|
|
|
" ..+. ",
|
|
|
|
|
" ..++.. ",
|
|
|
|
|
" ...++++. ",
|
|
|
|
|
" ...++++++.. ",
|
|
|
|
|
" ...+++++++++. ",
|
|
|
|
|
" ...+++++++++++.. ",
|
|
|
|
|
" ..+.++++++++++++.. ",
|
|
|
|
|
" .++.++++++++++++.. ",
|
|
|
|
|
" .+++.++++++++++++.. ",
|
|
|
|
|
" .++++.++++++++++++. ",
|
|
|
|
|
" .+++.+++++++++++++.. ",
|
|
|
|
|
" .++.+++++++++++++++.. ",
|
|
|
|
|
" .+.+++++++++++++++++.. ",
|
|
|
|
|
" ..+++++++++++++++++++.. ",
|
|
|
|
|
" ..++++++++++++++++++++. ",
|
|
|
|
|
" .++++++++++++++++++++.. ",
|
|
|
|
|
" ..+++++++++++++++++.. ",
|
|
|
|
|
" .++++++++++++++++.. ",
|
|
|
|
|
" ..+++++++++++++... ",
|
|
|
|
|
" .++++++++++++.. ",
|
|
|
|
|
" ..+++++++++.. ",
|
|
|
|
|
" .++++++++.. ",
|
|
|
|
|
" ..++++++.. ",
|
|
|
|
|
" .+++++.. ",
|
|
|
|
|
" .++.. ",
|
|
|
|
|
" ... ",
|
|
|
|
|
" .. ",
|
|
|
|
|
" ",
|
|
|
|
|
" "};
|
|
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
|
* Utility functions *
|
|
|
|
@ -375,35 +365,34 @@ static const gchar *drag_default_xpm[] = {
|
|
|
|
|
* results:
|
|
|
|
|
*************************************************************/
|
|
|
|
|
|
|
|
|
|
static GtkWidget*
|
|
|
|
|
gtk_drag_get_ipc_widget (void)
|
|
|
|
|
static GtkWidget *
|
|
|
|
|
gtk_drag_get_ipc_widget(void)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *result;
|
|
|
|
|
|
|
|
|
|
if (drag_widgets)
|
|
|
|
|
{
|
|
|
|
|
GSList *tmp = drag_widgets;
|
|
|
|
|
|
|
|
|
|
result = drag_widgets->data;
|
|
|
|
|
drag_widgets = drag_widgets->next;
|
|
|
|
|
g_slist_free_1 (tmp);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = gtk_invisible_new ();
|
|
|
|
|
result = gtk_invisible_new();
|
|
|
|
|
gtk_widget_show (result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
|
/*************************************************************
|
|
|
|
|
* gtk_drag_release_ipc_widget:
|
|
|
|
|
* Releases widget retrieved with gtk_drag_get_ipc_widget ()
|
|
|
|
|
* Releases widget retrieved with gtk_drag_get_ipc_widget()
|
|
|
|
|
* arguments:
|
|
|
|
|
* widget: the widget to release.
|
|
|
|
|
* results:
|
|
|
|
|
****************************************************************/
|
|
|
|
|
*************************************************************/
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_drag_release_ipc_widget (GtkWidget *widget)
|
|
|
|
@ -440,15 +429,15 @@ gtk_drag_get_event_actions (GdkEvent *event,
|
|
|
|
|
case GDK_KEY_RELEASE:
|
|
|
|
|
state = event->key.state;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
|
state = event->crossing.state;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((button == 2 || button == 3) && (actions & GDK_ACTION_ASK))
|
|
|
|
|
if (((button == 2) || (button == 3)) && (actions & GDK_ACTION_ASK))
|
|
|
|
|
{
|
|
|
|
|
*suggested_action = GDK_ACTION_ASK;
|
|
|
|
|
*possible_actions = actions;
|
|
|
|
@ -500,7 +489,7 @@ gtk_drag_get_event_actions (GdkEvent *event,
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GdkCursor*
|
|
|
|
|
static GdkCursor *
|
|
|
|
|
gtk_drag_get_cursor (GdkDragAction action)
|
|
|
|
|
{
|
|
|
|
|
gint i;
|
|
|
|
@ -560,7 +549,7 @@ gtk_drag_get_data (GtkWidget *widget,
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
|
g_return_if_fail (context != NULL);
|
|
|
|
|
|
|
|
|
|
selection_widget = gtk_drag_get_ipc_widget ();
|
|
|
|
|
selection_widget = gtk_drag_get_ipc_widget();
|
|
|
|
|
|
|
|
|
|
gdk_drag_context_ref (context);
|
|
|
|
|
gtk_widget_ref (widget);
|
|
|
|
@ -571,7 +560,7 @@ gtk_drag_get_data (GtkWidget *widget,
|
|
|
|
|
gtk_object_set_data (GTK_OBJECT (selection_widget), "drag-context", context);
|
|
|
|
|
|
|
|
|
|
gtk_selection_convert (selection_widget,
|
|
|
|
|
gdk_drag_get_selection (context),
|
|
|
|
|
gdk_drag_get_selection(context),
|
|
|
|
|
target,
|
|
|
|
|
time);
|
|
|
|
|
}
|
|
|
|
@ -588,7 +577,7 @@ gtk_drag_get_data (GtkWidget *widget,
|
|
|
|
|
* a different application.
|
|
|
|
|
*************************************************************/
|
|
|
|
|
|
|
|
|
|
GtkWidget*
|
|
|
|
|
GtkWidget *
|
|
|
|
|
gtk_drag_get_source_widget (GdkDragContext *context)
|
|
|
|
|
{
|
|
|
|
|
GSList *tmp_list;
|
|
|
|
@ -601,7 +590,6 @@ gtk_drag_get_source_widget (GdkDragContext *context)
|
|
|
|
|
if (ipc_widget->window == context->source_window)
|
|
|
|
|
{
|
|
|
|
|
GtkDragSourceInfo *info;
|
|
|
|
|
|
|
|
|
|
info = gtk_object_get_data (GTK_OBJECT (ipc_widget), "gtk-info");
|
|
|
|
|
|
|
|
|
|
return info ? info->widget : NULL;
|
|
|
|
@ -641,14 +629,14 @@ gtk_drag_finish (GdkDragContext *context,
|
|
|
|
|
else if (context->protocol == GDK_DRAG_PROTO_MOTIF)
|
|
|
|
|
{
|
|
|
|
|
target = gdk_atom_intern (success ?
|
|
|
|
|
"XmTRANSFER_SUCCESS" :
|
|
|
|
|
"XmTRANSFER_FAILURE",
|
|
|
|
|
"XmTRANSFER_SUCCESS" :
|
|
|
|
|
"XmTRANSFER_FAILURE",
|
|
|
|
|
FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (target != GDK_NONE)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *selection_widget = gtk_drag_get_ipc_widget ();
|
|
|
|
|
GtkWidget *selection_widget = gtk_drag_get_ipc_widget();
|
|
|
|
|
|
|
|
|
|
gdk_drag_context_ref (context);
|
|
|
|
|
|
|
|
|
@ -658,7 +646,7 @@ gtk_drag_finish (GdkDragContext *context,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
gtk_selection_convert (selection_widget,
|
|
|
|
|
gdk_drag_get_selection (context),
|
|
|
|
|
gdk_drag_get_selection(context),
|
|
|
|
|
target,
|
|
|
|
|
time);
|
|
|
|
|
}
|
|
|
|
@ -764,7 +752,7 @@ gtk_drag_unhighlight (GtkWidget *widget)
|
|
|
|
|
|
|
|
|
|
gtk_signal_disconnect_by_func (GTK_OBJECT (widget),
|
|
|
|
|
GTK_SIGNAL_FUNC (gtk_drag_highlight_paint),
|
|
|
|
|
NULL);
|
|
|
|
|
NULL);
|
|
|
|
|
gtk_signal_disconnect_by_func (GTK_OBJECT (widget),
|
|
|
|
|
GTK_SIGNAL_FUNC (gtk_drag_highlight_expose),
|
|
|
|
|
NULL);
|
|
|
|
@ -944,52 +932,52 @@ gtk_drag_dest_handle_event (GtkWidget *toplevel,
|
|
|
|
|
|
|
|
|
|
case GDK_DRAG_MOTION:
|
|
|
|
|
case GDK_DROP_START:
|
|
|
|
|
{
|
|
|
|
|
GtkDragFindData data;
|
|
|
|
|
gint tx, ty;
|
|
|
|
|
{
|
|
|
|
|
GtkDragFindData data;
|
|
|
|
|
gint tx, ty;
|
|
|
|
|
|
|
|
|
|
if (event->type == GDK_DROP_START)
|
|
|
|
|
info->dropped = TRUE;
|
|
|
|
|
if (event->type == GDK_DROP_START)
|
|
|
|
|
info->dropped = TRUE;
|
|
|
|
|
|
|
|
|
|
gdk_window_get_origin (toplevel->window, &tx, &ty);
|
|
|
|
|
gdk_window_get_origin (toplevel->window, &tx, &ty);
|
|
|
|
|
|
|
|
|
|
data.x = event->dnd.x_root - tx;
|
|
|
|
|
data.y = event->dnd.y_root - ty;
|
|
|
|
|
data.context = context;
|
|
|
|
|
data.info = info;
|
|
|
|
|
data.found = FALSE;
|
|
|
|
|
data.toplevel = TRUE;
|
|
|
|
|
data.callback = (event->type == GDK_DRAG_MOTION) ?
|
|
|
|
|
gtk_drag_dest_motion : gtk_drag_dest_drop;
|
|
|
|
|
data.time = event->dnd.time;
|
|
|
|
|
data.x = event->dnd.x_root - tx;
|
|
|
|
|
data.y = event->dnd.y_root - ty;
|
|
|
|
|
data.context = context;
|
|
|
|
|
data.info = info;
|
|
|
|
|
data.found = FALSE;
|
|
|
|
|
data.toplevel = TRUE;
|
|
|
|
|
data.callback = (event->type == GDK_DRAG_MOTION) ?
|
|
|
|
|
gtk_drag_dest_motion : gtk_drag_dest_drop;
|
|
|
|
|
data.time = event->dnd.time;
|
|
|
|
|
|
|
|
|
|
gtk_drag_find_widget (toplevel, &data);
|
|
|
|
|
gtk_drag_find_widget (toplevel, &data);
|
|
|
|
|
|
|
|
|
|
/* We send a leave here so that the widget unhighlights
|
|
|
|
|
* properly
|
|
|
|
|
*/
|
|
|
|
|
if (info->widget &&
|
|
|
|
|
((event->type == GDK_DROP_START) || (!data.found)))
|
|
|
|
|
{
|
|
|
|
|
gtk_drag_dest_leave (info->widget, context, event->dnd.time);
|
|
|
|
|
info->widget = NULL;
|
|
|
|
|
}
|
|
|
|
|
/* We send a leave here so that the widget unhighlights
|
|
|
|
|
* properly
|
|
|
|
|
*/
|
|
|
|
|
if (info->widget &&
|
|
|
|
|
((event->type == GDK_DROP_START) || (!data.found)))
|
|
|
|
|
{
|
|
|
|
|
gtk_drag_dest_leave (info->widget, context, event->dnd.time);
|
|
|
|
|
info->widget = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Send a reply.
|
|
|
|
|
*/
|
|
|
|
|
if (event->type == GDK_DRAG_MOTION)
|
|
|
|
|
{
|
|
|
|
|
if (!data.found)
|
|
|
|
|
gdk_drag_status (context, 0, event->dnd.time);
|
|
|
|
|
}
|
|
|
|
|
else if (event->type == GDK_DROP_START)
|
|
|
|
|
{
|
|
|
|
|
gdk_drop_reply (context, data.found, event->dnd.time);
|
|
|
|
|
if ((context->protocol == GDK_DRAG_PROTO_MOTIF) && !data.found)
|
|
|
|
|
gtk_drag_finish (context, FALSE, FALSE, event->dnd.time);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
/* Send a reply.
|
|
|
|
|
*/
|
|
|
|
|
if (event->type == GDK_DRAG_MOTION)
|
|
|
|
|
{
|
|
|
|
|
if (!data.found)
|
|
|
|
|
gdk_drag_status (context, 0, event->dnd.time);
|
|
|
|
|
}
|
|
|
|
|
else if (event->type == GDK_DROP_START)
|
|
|
|
|
{
|
|
|
|
|
gdk_drop_reply (context, data.found, event->dnd.time);
|
|
|
|
|
if ((context->protocol == GDK_DRAG_PROTO_MOTIF) && !data.found)
|
|
|
|
|
gtk_drag_finish (context, FALSE, FALSE, event->dnd.time);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
g_assert_not_reached();
|
|
|
|
@ -1243,8 +1231,7 @@ gtk_drag_find_widget (GtkWidget *widget,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_drag_proxy_begin (GtkWidget *widget,
|
|
|
|
|
GtkDragDestInfo *dest_info)
|
|
|
|
|
gtk_drag_proxy_begin (GtkWidget *widget, GtkDragDestInfo *dest_info)
|
|
|
|
|
{
|
|
|
|
|
GtkDragSourceInfo *source_info;
|
|
|
|
|
GList *tmp_list;
|
|
|
|
@ -1553,7 +1540,7 @@ gtk_drag_dest_drop (GtkWidget *widget,
|
|
|
|
|
* results:
|
|
|
|
|
*************************************************************/
|
|
|
|
|
|
|
|
|
|
GdkDragContext*
|
|
|
|
|
GdkDragContext *
|
|
|
|
|
gtk_drag_begin (GtkWidget *widget,
|
|
|
|
|
GtkTargetList *target_list,
|
|
|
|
|
GdkDragAction actions,
|
|
|
|
@ -1673,11 +1660,11 @@ gtk_drag_begin (GtkWidget *widget,
|
|
|
|
|
*************************************************************/
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gtk_drag_source_set (GtkWidget *widget,
|
|
|
|
|
GdkModifierType start_button_mask,
|
|
|
|
|
const GtkTargetEntry *targets,
|
|
|
|
|
gint n_targets,
|
|
|
|
|
GdkDragAction actions)
|
|
|
|
|
gtk_drag_source_set (GtkWidget *widget,
|
|
|
|
|
GdkModifierType start_button_mask,
|
|
|
|
|
const GtkTargetEntry *targets,
|
|
|
|
|
gint n_targets,
|
|
|
|
|
GdkDragAction actions)
|
|
|
|
|
{
|
|
|
|
|
GtkDragSourceSite *site;
|
|
|
|
|
|
|
|
|
@ -1757,10 +1744,10 @@ gtk_drag_source_unset (GtkWidget *widget)
|
|
|
|
|
*************************************************************/
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gtk_drag_source_set_icon (GtkWidget *widget,
|
|
|
|
|
GdkColormap *colormap,
|
|
|
|
|
GdkPixmap *pixmap,
|
|
|
|
|
GdkBitmap *mask)
|
|
|
|
|
gtk_drag_source_set_icon (GtkWidget *widget,
|
|
|
|
|
GdkColormap *colormap,
|
|
|
|
|
GdkPixmap *pixmap,
|
|
|
|
|
GdkBitmap *mask)
|
|
|
|
|
{
|
|
|
|
|
GtkDragSourceSite *site;
|
|
|
|
|
|
|
|
|
@ -1801,10 +1788,10 @@ gtk_drag_source_set_icon (GtkWidget *widget,
|
|
|
|
|
*************************************************************/
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gtk_drag_set_icon_widget (GdkDragContext *context,
|
|
|
|
|
GtkWidget *widget,
|
|
|
|
|
gint hot_x,
|
|
|
|
|
gint hot_y)
|
|
|
|
|
gtk_drag_set_icon_widget (GdkDragContext *context,
|
|
|
|
|
GtkWidget *widget,
|
|
|
|
|
gint hot_x,
|
|
|
|
|
gint hot_y)
|
|
|
|
|
{
|
|
|
|
|
GtkDragSourceInfo *info;
|
|
|
|
|
|
|
|
|
@ -1843,12 +1830,12 @@ gtk_drag_set_icon_widget (GdkDragContext *context,
|
|
|
|
|
*************************************************************/
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gtk_drag_set_icon_pixmap (GdkDragContext *context,
|
|
|
|
|
GdkColormap *colormap,
|
|
|
|
|
GdkPixmap *pixmap,
|
|
|
|
|
GdkBitmap *mask,
|
|
|
|
|
gint hot_x,
|
|
|
|
|
gint hot_y)
|
|
|
|
|
gtk_drag_set_icon_pixmap (GdkDragContext *context,
|
|
|
|
|
GdkColormap *colormap,
|
|
|
|
|
GdkPixmap *pixmap,
|
|
|
|
|
GdkBitmap *mask,
|
|
|
|
|
gint hot_x,
|
|
|
|
|
gint hot_y)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *window;
|
|
|
|
|
gint width, height;
|
|
|
|
@ -1859,7 +1846,7 @@ gtk_drag_set_icon_pixmap (GdkDragContext *context,
|
|
|
|
|
|
|
|
|
|
gdk_window_get_size (pixmap, &width, &height);
|
|
|
|
|
|
|
|
|
|
gtk_widget_push_visual (gdk_colormap_get_visual (colormap));
|
|
|
|
|
gtk_widget_push_visual (gdk_colormap_get_visual(colormap));
|
|
|
|
|
gtk_widget_push_colormap (colormap);
|
|
|
|
|
|
|
|
|
|
window = gtk_window_new (GTK_WINDOW_POPUP);
|
|
|
|
@ -1986,48 +1973,48 @@ gtk_drag_source_handle_event (GtkWidget *widget,
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
case GDK_DRAG_STATUS:
|
|
|
|
|
{
|
|
|
|
|
GdkCursor *cursor;
|
|
|
|
|
{
|
|
|
|
|
GdkCursor *cursor;
|
|
|
|
|
|
|
|
|
|
if (info->proxy_dest)
|
|
|
|
|
{
|
|
|
|
|
if (!event->dnd.send_event)
|
|
|
|
|
{
|
|
|
|
|
if (info->proxy_dest->proxy_drop_wait)
|
|
|
|
|
{
|
|
|
|
|
/* Aha - we can finally pass the MOTIF DROP on... */
|
|
|
|
|
gdk_drag_drop (info->context, info->proxy_dest->proxy_drop_time);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gdk_drag_status (info->proxy_dest->context,
|
|
|
|
|
event->dnd.context->action,
|
|
|
|
|
event->dnd.time);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cursor = gtk_drag_get_cursor (event->dnd.context->action);
|
|
|
|
|
if (info->cursor != cursor)
|
|
|
|
|
{
|
|
|
|
|
XChangeActivePointerGrab (GDK_WINDOW_XDISPLAY (widget->window),
|
|
|
|
|
PointerMotionMask | PointerMotionHintMask | ButtonReleaseMask,
|
|
|
|
|
((GdkCursorPrivate *)cursor)->xcursor,
|
|
|
|
|
event->dnd.time);
|
|
|
|
|
info->cursor = cursor;
|
|
|
|
|
}
|
|
|
|
|
if (info->proxy_dest)
|
|
|
|
|
{
|
|
|
|
|
if (!event->dnd.send_event)
|
|
|
|
|
{
|
|
|
|
|
if (info->proxy_dest->proxy_drop_wait)
|
|
|
|
|
{
|
|
|
|
|
/* Aha - we can finally pass the MOTIF DROP on... */
|
|
|
|
|
gdk_drag_drop (info->context, info->proxy_dest->proxy_drop_time);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gdk_drag_status (info->proxy_dest->context,
|
|
|
|
|
event->dnd.context->action,
|
|
|
|
|
event->dnd.time);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cursor = gtk_drag_get_cursor (event->dnd.context->action);
|
|
|
|
|
if (info->cursor != cursor)
|
|
|
|
|
{
|
|
|
|
|
XChangeActivePointerGrab (GDK_WINDOW_XDISPLAY (widget->window),
|
|
|
|
|
PointerMotionMask | PointerMotionHintMask | ButtonReleaseMask,
|
|
|
|
|
((GdkCursorPrivate *)cursor)->xcursor,
|
|
|
|
|
event->dnd.time);
|
|
|
|
|
info->cursor = cursor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (info->last_event)
|
|
|
|
|
{
|
|
|
|
|
gtk_drag_motion_cb (info->widget,
|
|
|
|
|
(GdkEventMotion *)info->last_event,
|
|
|
|
|
info);
|
|
|
|
|
info->last_event = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
if (info->last_event)
|
|
|
|
|
{
|
|
|
|
|
gtk_drag_motion_cb (info->widget,
|
|
|
|
|
(GdkEventMotion *)info->last_event,
|
|
|
|
|
info);
|
|
|
|
|
info->last_event = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GDK_DROP_FINISHED:
|
|
|
|
|
gtk_drag_drop_finished (info, TRUE, event->dnd.time);
|
|
|
|
@ -2136,7 +2123,7 @@ gtk_drag_drop_finished (GtkDragSourceInfo *info,
|
|
|
|
|
anim->n_steps = CLAMP (anim->n_steps, ANIM_MIN_STEPS, ANIM_MAX_STEPS);
|
|
|
|
|
if (info->icon_window)
|
|
|
|
|
{
|
|
|
|
|
gtk_widget_show (info->icon_window);
|
|
|
|
|
gtk_widget_show(info->icon_window);
|
|
|
|
|
gdk_window_raise (info->icon_window->window);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2157,7 +2144,6 @@ gtk_drag_source_release_selections (GtkDragSourceInfo *info,
|
|
|
|
|
while (tmp_list)
|
|
|
|
|
{
|
|
|
|
|
GdkAtom selection = GPOINTER_TO_UINT (tmp_list->data);
|
|
|
|
|
|
|
|
|
|
if (gdk_selection_owner_get (selection) == info->ipc_widget->window)
|
|
|
|
|
gtk_selection_owner_set (NULL, selection, time);
|
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
@ -2176,8 +2162,7 @@ gtk_drag_source_release_selections (GtkDragSourceInfo *info,
|
|
|
|
|
*************************************************************/
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_drag_drop (GtkDragSourceInfo *info,
|
|
|
|
|
guint32 time)
|
|
|
|
|
gtk_drag_drop (GtkDragSourceInfo *info, guint32 time)
|
|
|
|
|
{
|
|
|
|
|
if (info->context->protocol == GDK_DRAG_PROTO_ROOTWIN)
|
|
|
|
|
{
|
|
|
|
|