[file-roller] fixed wrong drag&drop activation when in single click mode
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller] fixed wrong drag&drop activation when in single click mode
- Date: Mon, 17 Feb 2014 11:26:08 +0000 (UTC)
commit 279b76d6ae36ddbb0425827cd55eebf0089e0197
Author: Paolo Bacchilega <paobac src gnome org>
Date: Mon Feb 17 10:56:03 2014 +0100
fixed wrong drag&drop activation when in single click mode
when calling the parent button_press_event function a
button released event could be emitted, in that case
stop the drag&drop action.
src/eggtreemultidnd.c | 32 ++++++++++++++++----------------
src/fr-window.c | 5 +++++
2 files changed, 21 insertions(+), 16 deletions(-)
---
diff --git a/src/eggtreemultidnd.c b/src/eggtreemultidnd.c
index 252b9e8..c979784 100644
--- a/src/eggtreemultidnd.c
+++ b/src/eggtreemultidnd.c
@@ -40,10 +40,10 @@ typedef struct
gint x;
gint y;
guint motion_notify_handler;
- guint button_release_handler;
guint drag_data_get_handler;
GSList *event_list;
gboolean pending_event;
+ gboolean button_released;
} EggTreeMultiDndData;
@@ -161,10 +161,6 @@ stop_drag_check (GtkWidget *widget)
g_signal_handler_disconnect (widget, priv_data->motion_notify_handler);
priv_data->motion_notify_handler = 0;
}
- if (priv_data->button_release_handler) {
- g_signal_handler_disconnect (widget, priv_data->button_release_handler);
- priv_data->button_release_handler = 0;
- }
}
@@ -177,6 +173,10 @@ egg_tree_multi_drag_button_release_event (GtkWidget *widget,
GSList *l;
priv_data = g_object_get_data (G_OBJECT (widget), EGG_TREE_MULTI_DND_STRING);
+ if (priv_data == NULL)
+ return FALSE;
+
+ priv_data->button_released = TRUE;
for (l = priv_data->event_list; l != NULL; l = l->next)
gtk_propagate_event (widget, l->data);
@@ -272,6 +272,9 @@ egg_tree_multi_drag_motion_event (GtkWidget *widget,
priv_data = g_object_get_data (G_OBJECT (widget), EGG_TREE_MULTI_DND_STRING);
+ if (! priv_data->pending_event)
+ return FALSE;
+
if (gtk_drag_check_threshold (widget,
priv_data->x,
priv_data->y,
@@ -398,10 +401,12 @@ egg_tree_multi_drag_button_press_event (GtkWidget *widget,
!gtk_tree_selection_path_is_selected (selection, path) ||
event->button != 1);
+ /* calling the parent the button_release event could be emitted */
+ priv_data->button_released = FALSE;
if (call_parent)
(GTK_WIDGET_GET_CLASS (tree_view))->button_press_event (widget, event);
- if (gtk_tree_selection_path_is_selected (selection, path))
+ if (! priv_data->button_released && gtk_tree_selection_path_is_selected (selection, path))
{
priv_data->pressed_button = event->button;
priv_data->x = event->x;
@@ -421,15 +426,6 @@ egg_tree_multi_drag_button_press_event (GtkWidget *widget,
NULL);
}
- if (priv_data->button_release_handler == 0)
- {
- priv_data->button_release_handler =
- g_signal_connect (G_OBJECT (tree_view),
- "button_release_event",
- G_CALLBACK (egg_tree_multi_drag_button_release_event),
- NULL);
- }
-
if (priv_data->drag_data_get_handler == 0)
{
priv_data->drag_data_get_handler =
@@ -440,6 +436,7 @@ egg_tree_multi_drag_button_press_event (GtkWidget *widget,
}
}
+ priv_data->button_released = FALSE;
gtk_tree_path_free (path);
/* We called the default handler so we don't let the default handler run */
return TRUE;
@@ -457,5 +454,8 @@ egg_tree_multi_drag_add_drag_support (GtkTreeView *tree_view)
"button_press_event",
G_CALLBACK (egg_tree_multi_drag_button_press_event),
NULL);
+ g_signal_connect (G_OBJECT (tree_view),
+ "button_release_event",
+ G_CALLBACK (egg_tree_multi_drag_button_release_event),
+ NULL);
}
-
diff --git a/src/fr-window.c b/src/fr-window.c
index 00093b3..7ecafe9 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -4126,6 +4126,11 @@ tree_view_drag_begin (GtkWidget *widget,
if (window->priv->activity_ref > 0)
return FALSE;
+ if (window->priv->path_clicked != NULL) {
+ gtk_tree_path_free (window->priv->path_clicked);
+ window->priv->path_clicked = NULL;
+ }
+
_g_clear_object (&window->priv->drag_destination_folder);
g_free (window->priv->drag_base_dir);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]