aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog12
-rw-r--r--shell/e-storage-set-view.c23
2 files changed, 31 insertions, 4 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 9f481a3a81..29f9e0e3a1 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,17 @@
2000-05-31 Ettore Perazzoli <ettore@helixcode.com>
+ * e-storage-set-view.c: New constant `DRAG_RESISTANCE'. New
+ members `button_x', `button_y' in `EStorageSetViewPrivate'.
+ (init): Initialize to zero.
+ (button_press_event): Set.
+ (motion_notify_event): Don't start drag unless the current x/y
+ position is farther than `DRAG_RESISTANCE', in any of the two
+ directions, from the original position of the button click.
+ (button_release_event): Always ungrab the pointer, even if
+ `selected_row_path' is NULL.
+
+2000-05-31 Ettore Perazzoli <ettore@helixcode.com>
+
* evolution-shell-component.c (class_init): Eeek!
s/owner_set/owner_unset/.
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index 7aa6f65e5a..3b0aabe044 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -56,11 +56,16 @@ struct _EStorageSetViewPrivate {
/* Whether we are currently performing a drag from this view. */
int in_drag : 1;
+ /* X/Y position for the last button click. */
+ int button_x, button_y;
+
/* Button used for the drag. This is initialized in the `button_press_event'
handler. */
int drag_button;
};
+#define DRAG_RESISTANCE 3
+
enum {
FOLDER_SELECTED,
@@ -257,6 +262,8 @@ button_press_event (GtkWidget *widget,
return FALSE;
priv->drag_button = event->button;
+ priv->button_x = event->x;
+ priv->button_y = event->y;
/* KLUDGE ALERT. So look at this. We need to grab the pointer now, to check for
motion events and maybe start a drag operation. And GtkCTree seems to do it
@@ -293,6 +300,10 @@ motion_notify_event (GtkWidget *widget,
if (priv->in_drag || priv->drag_button == 0)
return FALSE;
+ if (ABS (event->x - priv->button_x) < DRAG_RESISTANCE
+ && ABS (event->y - priv->button_y) < DRAG_RESISTANCE)
+ return FALSE;
+
priv->in_drag = TRUE;
priv->dragged_row_path = priv->selected_row_path;
@@ -315,14 +326,16 @@ button_release_event (GtkWidget *widget,
storage_set_view = E_STORAGE_SET_VIEW (widget);
priv = storage_set_view->priv;
- if (! priv->in_drag && priv->selected_row_path != NULL) {
+ if (! priv->in_drag) {
gdk_pointer_ungrab (GDK_CURRENT_TIME);
gtk_grab_remove (widget);
gdk_flush ();
- gtk_signal_emit (GTK_OBJECT (widget), signals[FOLDER_SELECTED],
- priv->selected_row_path);
- priv->selected_row_path = NULL;
+ if (priv->selected_row_path != NULL) {
+ gtk_signal_emit (GTK_OBJECT (widget), signals[FOLDER_SELECTED],
+ priv->selected_row_path);
+ priv->selected_row_path = NULL;
+ }
}
priv->selected_row_path_before_click = NULL;
@@ -641,6 +654,8 @@ init (EStorageSetView *storage_set_view)
priv->dragged_row_path = NULL;
priv->selected_row_path_before_click = NULL;
priv->in_drag = FALSE;
+ priv->button_x = 0;
+ priv->button_y = 0;
storage_set_view->priv = priv;
}