summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Stachowiak <mstachow@src.gnome.org>2000-11-21 08:20:01 +0000
committerMaciej Stachowiak <mstachow@src.gnome.org>2000-11-21 08:20:01 +0000
commitc82012c9ea09edc61bdc141b62b7f7956492a11f (patch)
treed21e0d728b2ab22d7eefb2b24d9955f9eb8fd6f7
parent1956c13187c26aa914c3d65456bbba6f4fdbaf9d (diff)
downloadnautilus-c82012c9ea09edc61bdc141b62b7f7956492a11f.tar.gz
reviewed by: Pavel Cisler <pavel@eazel.com>
Fix bugs 2943 (Dragging icons between windows or to the desktop triggers scrolling), 4786 (Need to remove tree view auto-expand feature for 1.0) and 4476 (weird horizontal autoscroll behavior). Auto-scroll now has a consistent 750 ms startup delay, and the tree auto-expand is off. * libnautilus-extensions/nautilus-drag.h, libnautilus-extensions/nautilus-drag.c: (nautilus_drag_autoscroll_in_scroll_region, nautilus_drag_autoscroll_start, nautilus_drag_autoscroll_stop): New convenience functions that factor out common code formerly in the tree, list and icon view DnD code. This fixes the mistakes common to all three of those views, where the auto-scroll initial delay was measured from the start of dragging overall, not from entering the scroll region. * libnautilus-extensions/nautilus-icon-private.h, libnautilus-extensions/nautilus-icon-dnd.c (auto_scroll_timeout_callback, set_up_auto_scroll_if_needed, stop_auto_scroll): Use the above calls. Also, correct a `<' vs. `>' mistake that made the auto-scroll delay never take effect. * libnautilus-extensions/nautilus-list.c (auto_scroll_timeout_callback, nautilus_list_start_auto_scroll, nautilus_list_stop_auto_scroll): Use the above calls. Also, correct a `<' vs. `>' mistake that made the auto-scroll delay never take effect. * components/tree/nautilus-tree-view-dnd.c: (nautilus_tree_view_drag_leave, nautilus_tree_view_drag_motion, collapse_time_callback, nautilus_tree_view_expand_node, nautilus_tree_view_is_tree_node_expanded, nautilus_dump_info expand_hack_unref, expand_hack_new, expand_time_callback, nautilus_tree_view_expand_maybe_later): Remove bunches of code to disable auto-expand. (ready_to_start_scrolling, auto_scroll_timeout_callback), (nautilus_tree_view_start_auto_scroll), (nautilus_tree_view_stop_auto_scroll), (nautilus_tree_view_drag_destroy): Use new common auto-scroll code. I also made it possible to add an extra auto-scroll delay for horizontal auto-scroll, but now that the startup delay has been fixed, it seems almost impossible to trigger horizontal auto-scroll accidentally, so I consider 4476 fixed. * components/adapter/bonobo-stream-vfs.c: (vfs_get_info, vfs_set_info, vfs_write, vfs_read, vfs_copy_to, vfs_destroy, bonobo_stream_vfs_open): Added FIXME bug numbers. * components/adapter/nautilus-adapter-control-embed-strategy.c: (activate_uri_callback): Added FIXME bug numbers. * components/adapter/nautilus-adapter.c: (nautilus_adapter_new): Added FIXME bug numbers.
-rw-r--r--ChangeLog57
-rw-r--r--components/adapter/bonobo-stream-vfs.c44
-rw-r--r--components/adapter/nautilus-adapter-control-embed-strategy.c6
-rw-r--r--components/adapter/nautilus-adapter.c4
-rw-r--r--components/tree/nautilus-tree-view-dnd.c295
-rw-r--r--libnautilus-extensions/nautilus-drag.c53
-rw-r--r--libnautilus-extensions/nautilus-drag.h12
-rw-r--r--libnautilus-extensions/nautilus-icon-dnd.c24
-rw-r--r--libnautilus-extensions/nautilus-icon-private.h3
-rw-r--r--libnautilus-extensions/nautilus-list.c26
-rw-r--r--libnautilus-private/nautilus-drag.c53
-rw-r--r--libnautilus-private/nautilus-drag.h12
-rw-r--r--libnautilus-private/nautilus-icon-dnd.c24
-rw-r--r--libnautilus-private/nautilus-icon-private.h3
-rw-r--r--libnautilus-private/nautilus-list.c26
15 files changed, 269 insertions, 373 deletions
diff --git a/ChangeLog b/ChangeLog
index 5c7a03e67..1416c65c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,60 @@
+2000-11-20 Maciej Stachowiak <mjs@eazel.com>
+
+ reviewed by: Pavel Cisler <pavel@eazel.com>
+
+ Fix bugs 2943 (Dragging icons between windows or to the desktop
+ triggers scrolling), 4786 (Need to remove tree view auto-expand
+ feature for 1.0) and 4476 (weird horizontal autoscroll
+ behavior). Auto-scroll now has a consistent 750 ms startup delay,
+ and the tree auto-expand is off.
+
+ * libnautilus-extensions/nautilus-drag.h,
+ libnautilus-extensions/nautilus-drag.c:
+ (nautilus_drag_autoscroll_in_scroll_region,
+ nautilus_drag_autoscroll_start, nautilus_drag_autoscroll_stop):
+ New convenience functions that factor out common code formerly in
+ the tree, list and icon view DnD code. This fixes the mistakes
+ common to all three of those views, where the auto-scroll initial
+ delay was measured from the start of dragging overall, not from
+ entering the scroll region.
+
+ * libnautilus-extensions/nautilus-icon-private.h,
+ libnautilus-extensions/nautilus-icon-dnd.c
+ (auto_scroll_timeout_callback, set_up_auto_scroll_if_needed,
+ stop_auto_scroll): Use the above calls. Also, correct a `<'
+ vs. `>' mistake that made the auto-scroll delay never take effect.
+
+ * libnautilus-extensions/nautilus-list.c
+ (auto_scroll_timeout_callback, nautilus_list_start_auto_scroll,
+ nautilus_list_stop_auto_scroll): Use the above calls. Also,
+ correct a `<' vs. `>' mistake that made the auto-scroll delay
+ never take effect.
+
+ * components/tree/nautilus-tree-view-dnd.c:
+ (nautilus_tree_view_drag_leave, nautilus_tree_view_drag_motion,
+ collapse_time_callback, nautilus_tree_view_expand_node,
+ nautilus_tree_view_is_tree_node_expanded, nautilus_dump_info
+ expand_hack_unref, expand_hack_new, expand_time_callback,
+ nautilus_tree_view_expand_maybe_later): Remove bunches of code to
+ disable auto-expand.
+
+ (ready_to_start_scrolling, auto_scroll_timeout_callback),
+ (nautilus_tree_view_start_auto_scroll),
+ (nautilus_tree_view_stop_auto_scroll),
+ (nautilus_tree_view_drag_destroy): Use new common auto-scroll
+ code. I also made it possible to add an extra auto-scroll delay
+ for horizontal auto-scroll, but now that the startup delay has
+ been fixed, it seems almost impossible to trigger horizontal
+ auto-scroll accidentally, so I consider 4476 fixed.
+
+ * components/adapter/bonobo-stream-vfs.c: (vfs_get_info,
+ vfs_set_info, vfs_write, vfs_read, vfs_copy_to, vfs_destroy,
+ bonobo_stream_vfs_open): Added FIXME bug numbers.
+ * components/adapter/nautilus-adapter-control-embed-strategy.c:
+ (activate_uri_callback): Added FIXME bug numbers.
+ * components/adapter/nautilus-adapter.c: (nautilus_adapter_new):
+ Added FIXME bug numbers.
+
2000-11-20 Robin * Slomkowski <rslomkow@eazel.com>
* configure.in: reduced versions of glib
diff --git a/components/adapter/bonobo-stream-vfs.c b/components/adapter/bonobo-stream-vfs.c
index dba7cfc32..b624c7103 100644
--- a/components/adapter/bonobo-stream-vfs.c
+++ b/components/adapter/bonobo-stream-vfs.c
@@ -27,9 +27,9 @@
* bonobo-stream-vfs.c: Gnome VFS-based Stream implementation
*/
-/* FIXME: There's another copy of this file, with a few subtle
- * differences, in the Bonobo sources, although it's currently not being
- * compiled.
+/* FIXME bugzilla.eazel.com 4400: There's another copy of this file,
+ * with a few subtle differences, in the Bonobo sources, although it's
+ * currently not being compiled.
*/
#include <config.h>
@@ -55,7 +55,9 @@ vfs_get_info (BonoboStream *stream,
Bonobo_StorageInfoFields mask,
CORBA_Environment *ev)
{
- /* FIXME: Is it OK to have this unimplemented? */
+ /* FIXME bugzilla.eazel.com 4402: Is it OK to have this
+ * unimplemented?
+ */
g_warning ("BonoboStreamVFS:get_info not implemented");
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Stream_IOError, NULL);
@@ -77,8 +79,8 @@ vfs_get_info (BonoboStream *stream,
return 0;
}
- /* FIXME: Will munge >31-bit file sizes, which can
- * happen in gnome-vfs.
+ /* FIXME bugzilla.eazel.com 4397: Will munge >31-bit file
+ * sizes, which can happen in gnome-vfs.
*/
size = file_info.size;
gnome_vfs_file_info_clear (&file_info);
@@ -95,7 +97,9 @@ vfs_set_info (BonoboStream *stream,
Bonobo_StorageInfoFields mask,
CORBA_Environment *ev)
{
- /* FIXME: Is it OK to have this unimplemented? */
+ /* FIXME bugzilla.eazel.com 4403: Is it OK to have this
+ * unimplemented?
+ */
g_warning ("BonoboStreamVFS:set_info not implemented");
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Stream_IOError, NULL);
@@ -114,8 +118,8 @@ vfs_write (BonoboStream *stream,
res = gnome_vfs_write (stream_vfs->details->handle, buffer->_buffer, buffer->_length, &written);
if (res != GNOME_VFS_OK) {
- /* FIXME: We might need to distinguish NoPermission
- * from IOError.
+ /* FIXME bugzilla.eazel.com 4396: We might need to
+ * distinguish NoPermission from IOError.
*/
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Stream_IOError, NULL);
@@ -152,8 +156,8 @@ vfs_read (BonoboStream *stream,
CORBA_free (data);
CORBA_free (*buffer);
*buffer = NULL;
- /* FIXME: We might need to distinguish NoPermission
- * from IOError.
+ /* FIXME bugzilla.eazel.com 4396: We might need to
+ * distinguish NoPermission from IOError.
*/
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Stream_IOError, NULL);
@@ -236,7 +240,7 @@ vfs_copy_to (BonoboStream *stream,
res = gnome_vfs_create (&fd_out, dest, GNOME_VFS_OPEN_WRITE, FALSE, 0666);
if (res != GNOME_VFS_OK) {
- /* FIXME: Need to set exception here. */
+ /* FIXME bugzilla.eazel.com 4398: Need to set exception here. */
return;
}
@@ -249,14 +253,14 @@ vfs_copy_to (BonoboStream *stream,
do {
res = gnome_vfs_read (stream_vfs->details->handle, data, MIN (READ_CHUNK_SIZE, more), &rsize);
if (res != GNOME_VFS_OK) {
- /* FIXME: Need to set exception here. */
+ /* FIXME bugzilla.eazel.com 4398: Need to set exception here. */
break;
}
*read_bytes += rsize;
res = gnome_vfs_write (fd_out, data, rsize, &wsize);
if (res != GNOME_VFS_OK) {
- /* FIXME: Need to set exception here. */
+ /* FIXME bugzilla.eazel.com 4398: Need to set exception here. */
break;
}
*written_bytes += wsize;
@@ -294,9 +298,10 @@ vfs_destroy (GtkObject *object)
if (stream_vfs->details->handle != NULL) {
gnome_vfs_close (stream_vfs->details->handle);
- /* FIXME: Errors that happen only at flush time are
- * lost here. Many gnome-vfs modules return errors at
- * close time about the remaining flushed writes.
+ /* FIXME bugzilla.eazel.com 4399: Errors that happen
+ * only at flush time are lost here. Many gnome-vfs
+ * modules return errors at close time about the
+ * remaining flushed writes.
*/
stream_vfs->details->handle = NULL;
}
@@ -458,8 +463,9 @@ bonobo_stream_vfs_open (const char *uri, Bonobo_Storage_OpenMode mode)
} else if (mode == Bonobo_Storage_WRITE) {
result = gnome_vfs_open (&handle, uri, GNOME_VFS_OPEN_WRITE);
} else {
- /* FIXME: Do we need to support CREATE, FAILIFEXIST,
- * COMPRESSED, TRANSACTED, or combinations?
+ /* FIXME bugzilla.eazel.com 4401: Do we need to
+ * support CREATE, FAILIFEXIST, COMPRESSED,
+ * TRANSACTED, or combinations?
*/
result = GNOME_VFS_ERROR_NOT_SUPPORTED;
}
diff --git a/components/adapter/nautilus-adapter-control-embed-strategy.c b/components/adapter/nautilus-adapter-control-embed-strategy.c
index c843add0e..0f7cfba3d 100644
--- a/components/adapter/nautilus-adapter-control-embed-strategy.c
+++ b/components/adapter/nautilus-adapter-control-embed-strategy.c
@@ -149,9 +149,9 @@ activate_uri_callback (BonoboControlFrame *frame,
gboolean relative,
NautilusAdapterControlEmbedStrategy *strategy)
{
- /* FIXME: ignoring `relative' parameter as the concept is kind
- of broken. */
-
+ /* FIXME bugzilla.eazel.com 4404: ignoring `relative' parameter as
+ * the concept is kind of broken.
+ */
nautilus_adapter_embed_strategy_emit_open_location (NAUTILUS_ADAPTER_EMBED_STRATEGY (strategy),
uri);
}
diff --git a/components/adapter/nautilus-adapter.c b/components/adapter/nautilus-adapter.c
index 163c1a3fb..73878f9c4 100644
--- a/components/adapter/nautilus-adapter.c
+++ b/components/adapter/nautilus-adapter.c
@@ -152,7 +152,9 @@ nautilus_adapter_new (Bonobo_Unknown component)
CORBA_Environment ev;
- /* FIXME: should be done with construct args */
+ /* FIXME bugzilla.eazel.com 4405: should be done with
+ * construct args
+ */
CORBA_exception_init (&ev);
diff --git a/components/tree/nautilus-tree-view-dnd.c b/components/tree/nautilus-tree-view-dnd.c
index c9a3fe44e..86f11c23b 100644
--- a/components/tree/nautilus-tree-view-dnd.c
+++ b/components/tree/nautilus-tree-view-dnd.c
@@ -57,9 +57,14 @@
#include "nautilus-tree-view-private.h"
#define nopeMATHIEU_DEBUG 1
-/* timeout for the automatic expand in tree view */
-#define EXPAND_TIMEOUT 1000
-#define COLLAPSE_TIMEOUT 500
+
+
+/* This constant is zero because right now it does not seem we need
+ extra delay on horizontal-only auto-scroll. However, it's left in
+ so we can easily add this delay if we decide we want it. */
+
+#define AUTOSCROLL_X_ONLY_EXTRA_DELAY 0
+/* in microseconds */
static void nautilus_tree_view_drag_begin (GtkWidget *widget,
@@ -118,8 +123,6 @@ static char *nautilus_tree_view_get_drag_uri (NautilusTreeView
static void nautilus_tree_view_expand_or_collapse_row (NautilusCTree *tree,
int row);
-static gboolean nautilus_tree_view_expand_node (NautilusCTree *tree,
- NautilusCTreeNode *node);
static gboolean nautilus_tree_view_is_tree_node_directory (NautilusTreeView *tree_view,
NautilusCTreeNode *node);
static NautilusCTreeNode *nautilus_tree_view_tree_node_at (NautilusTreeView *tree_view,
@@ -146,9 +149,7 @@ static void nautilus_tree_view_make_prelight_if_file_operation (NautilusTreeVie
static void nautilus_tree_view_ensure_drag_data (NautilusTreeView *tree_view,
GdkDragContext *context,
guint32 time);
-static void nautilus_tree_view_expand_maybe_later (NautilusTreeView *tree_view,
- int x,
- int y);
+
static void nautilus_tree_view_get_drop_action (NautilusTreeView *tree_view,
GdkDragContext *context,
int x,
@@ -315,34 +316,6 @@ nautilus_tree_view_drag_end (GtkWidget *widget, GdkDragContext *context,
}
-/* will be called shortly after you have left the tree view.
- It will collapse everything which got expanded during the
- drag and drop unless it already got collapsed by the
- drop
-*/
-static gboolean
-collapse_time_callback (gpointer data)
-{
- NautilusTreeView *tree_view;
- NautilusTreeViewDndDetails *dnd;
- NautilusCTreeNode *dropped_node;
-
- g_assert (NAUTILUS_IS_TREE_VIEW (data));
- tree_view = NAUTILUS_TREE_VIEW (data);
- dnd = tree_view->details->dnd;
-
- if (dnd->expanded_nodes != NULL) {
- dropped_node = nautilus_tree_view_tree_node_at (tree_view, -1, -1);
- if (dropped_node != NULL) {
- nautilus_tree_view_collapse_all (tree_view, dropped_node);
- }
-
- g_slist_free (dnd->expanded_nodes);
- dnd->expanded_nodes = NULL;
- }
-
- return FALSE;
-}
static void
nautilus_tree_view_drag_leave (GtkWidget *widget,
@@ -358,8 +331,6 @@ nautilus_tree_view_drag_leave (GtkWidget *widget,
nautilus_tree_view_drag_destroy (tree_view);
- g_timeout_add (COLLAPSE_TIMEOUT, collapse_time_callback, tree_view);
-
gtk_signal_emit_stop_by_name (GTK_OBJECT (widget),
"drag_leave");
}
@@ -393,11 +364,9 @@ nautilus_tree_view_drag_motion (GtkWidget *widget, GdkDragContext *context,
switch (drag_info->data_type) {
case NAUTILUS_ICON_DND_GNOME_ICON_LIST:
case NAUTILUS_ICON_DND_URI_LIST:
- nautilus_tree_view_expand_maybe_later (NAUTILUS_TREE_VIEW (tree_view),
- x, y);
+
nautilus_ctree_set_prelight (NAUTILUS_CTREE (tree_view->details->tree),
y);
-
nautilus_tree_view_make_prelight_if_file_operation (NAUTILUS_TREE_VIEW (tree_view),
x, y);
@@ -874,34 +843,6 @@ nautilus_tree_view_make_prelight_if_file_operation (NautilusTreeView *tree_view,
-/* return if it was expanded or not */
-static gboolean
-nautilus_tree_view_expand_node (NautilusCTree *tree, NautilusCTreeNode *node)
-{
- char *node_text;
- guint8 node_spacing;
- GdkPixmap *pixmap_closed;
- GdkBitmap *mask_closed;
- GdkPixmap *pixmap_opened;
- GdkBitmap *mask_opened;
- gboolean is_leaf;
- gboolean is_expanded;
-
- nautilus_ctree_get_node_info (NAUTILUS_CTREE(tree),
- node, &node_text,
- &node_spacing, &pixmap_closed, &mask_closed,
- &pixmap_opened, &mask_opened,
- &is_leaf, &is_expanded);
- if (!is_expanded) {
- /* expand */
- nautilus_ctree_expand (NAUTILUS_CTREE(tree),
- node);
- }
-
- return is_expanded;
-
-}
-
/* returns if it was expanded or not */
static gboolean
nautilus_tree_view_collapse_node (NautilusCTree *tree, NautilusCTreeNode *node)
@@ -929,26 +870,6 @@ nautilus_tree_view_collapse_node (NautilusCTree *tree, NautilusCTreeNode *node)
return is_expanded;
}
-static gboolean
-nautilus_tree_view_is_tree_node_expanded (NautilusCTree *tree, NautilusCTreeNode *node)
-{
- char *node_text;
- guint8 node_spacing;
- GdkPixmap *pixmap_closed;
- GdkBitmap *mask_closed;
- GdkPixmap *pixmap_opened;
- GdkBitmap *mask_opened;
- gboolean is_leaf;
- gboolean is_expanded;
-
- nautilus_ctree_get_node_info (NAUTILUS_CTREE(tree),
- node, &node_text,
- &node_spacing, &pixmap_closed, &mask_closed,
- &pixmap_opened, &mask_opened,
- &is_leaf, &is_expanded);
-
- return is_expanded;
-}
static void
nautilus_tree_view_expand_or_collapse_row (NautilusCTree *tree, int row)
@@ -1139,157 +1060,6 @@ nautilus_tree_view_ensure_drag_data (NautilusTreeView *tree_view,
-/* hacks for automatic expand/collapse of tree view */
-typedef struct _NautilusTreeViewExpandHack NautilusTreeViewExpandHack;
-struct _NautilusTreeViewExpandHack {
- NautilusCTree *ctree;
- NautilusTreeView *tree_view;
- gboolean is_valid;
- int org_x;
- int org_y;
- int refcount;
-};
-
-
-static int expand_time_callback (gpointer data);
-static void expand_hack_unref (NautilusTreeViewExpandHack * expand_hack);
-static NautilusTreeViewExpandHack *expand_hack_new (int x, int y, NautilusTreeView *tree_view);
-
-static void
-nautilus_dump_info (NautilusTreeView *tree_view)
-{
-#ifdef MATHIEU_DEBUG
- GSList *list, *tmp;
- NautilusCTreeNode *node;
- char *uri;
-
- list = tree_view->details->dnd->expanded_nodes;
-
- for (tmp = list; tmp != NULL;tmp = tmp->next) {
- node = (NautilusCTreeNode *) tmp->data;
- uri = nautilus_file_get_uri (nautilus_tree_view_node_to_file (tree_view,
- node));
- g_print ("will collapse: %s\n", uri);
- g_free (uri);
- }
-
- g_print ("\n");
-#endif
-}
-
-static void
-expand_hack_unref (NautilusTreeViewExpandHack * expand_hack)
-{
- expand_hack->refcount--;
-
- if (expand_hack->refcount == 0) {
- g_free (expand_hack);
- }
-
-}
-
-static NautilusTreeViewExpandHack *
-expand_hack_new (int x, int y, NautilusTreeView *tree_view)
-{
- NautilusTreeViewExpandHack *expand_hack;
-
- expand_hack = g_new0 (NautilusTreeViewExpandHack, 1);
- expand_hack->is_valid = TRUE;
- expand_hack->org_x = x;
- expand_hack->org_y = y;
- expand_hack->ctree = (NautilusCTree *)tree_view->details->tree;
- expand_hack->tree_view = tree_view;
- expand_hack->refcount = 2;
-
- g_timeout_add (EXPAND_TIMEOUT, expand_time_callback, expand_hack);
-
- return expand_hack;
-}
-
-static gint
-expand_time_callback (gpointer data)
-{
- NautilusTreeViewExpandHack *expand_hack;
-
- expand_hack = (NautilusTreeViewExpandHack *) data;
-
- if (expand_hack->is_valid) {
- NautilusCTreeNode *current_node;
- gboolean was_expanded, is_expanded, is_directory;
-
- current_node = nautilus_tree_view_tree_node_at (expand_hack->tree_view,
- expand_hack->org_x,
- expand_hack->org_y);
- is_directory = nautilus_tree_view_is_tree_node_directory (expand_hack->tree_view, current_node);
- is_expanded = nautilus_tree_view_is_tree_node_expanded (NAUTILUS_CTREE (expand_hack->ctree),
- current_node);
- if (current_node == NULL
- || !is_directory
- || is_expanded) {
- expand_hack_unref (expand_hack);
- return FALSE;
- }
- was_expanded = nautilus_tree_view_expand_node (NAUTILUS_CTREE (expand_hack->ctree),
- current_node);
- if (!was_expanded) {
- GSList *list;
- list = expand_hack->tree_view->details->dnd->expanded_nodes;
- expand_hack->tree_view->details->dnd->expanded_nodes =
- g_slist_prepend (list, current_node);
- nautilus_dump_info (NAUTILUS_TREE_VIEW (expand_hack->tree_view));
- }
-
- }
- expand_hack_unref (expand_hack);
-
- /* never be called again. EVER */
- return FALSE;
-}
-
-
-
-
-
-
-
-
-static void
-nautilus_tree_view_expand_maybe_later (NautilusTreeView *tree_view,
- int x, int y)
-{
- static NautilusTreeViewExpandHack *expand_hack = NULL;
- NautilusCTreeNode *current_node;
- int distance;
-
- current_node = nautilus_tree_view_tree_node_at (tree_view,
- x, y);
- if (current_node == NULL) {
- return;
- }
- if (expand_hack == NULL) {
- expand_hack = expand_hack_new (x, y, tree_view);
- }
-
-
- distance = (abs(x - expand_hack->org_x)) + (abs(y - expand_hack->org_y));
-
- if (distance > 8) {
- expand_hack->is_valid = FALSE;
- expand_hack_unref (expand_hack);
-
- expand_hack = expand_hack_new (x, y, tree_view);
- }
-}
-
-
-
-
-
-
-
-
-
-
@@ -1298,6 +1068,14 @@ nautilus_tree_view_expand_maybe_later (NautilusTreeView *tree_view,
***********************************************************************/
+static gboolean
+ready_to_start_scrolling (NautilusDragInfo *drag_info,
+ int y_scroll_delta)
+{
+ return (y_scroll_delta != 0 && drag_info->start_auto_scroll_in < nautilus_get_system_time ()) ||
+ drag_info->start_auto_scroll_in + AUTOSCROLL_X_ONLY_EXTRA_DELAY < nautilus_get_system_time ();
+}
+
static int
auto_scroll_timeout_callback (gpointer data)
{
@@ -1305,60 +1083,47 @@ auto_scroll_timeout_callback (gpointer data)
NautilusTreeView *tree_view;
GtkWidget *widget;
float x_scroll_delta, y_scroll_delta;
-
+
g_assert (NAUTILUS_IS_TREE_VIEW (data));
widget = GTK_WIDGET (data);
tree_view = NAUTILUS_TREE_VIEW (widget);
drag_info = tree_view->details->dnd->drag_info;
+ nautilus_drag_autoscroll_calculate_delta (tree_view->details->tree, &x_scroll_delta, &y_scroll_delta);
+
if (drag_info->waiting_to_autoscroll
- && drag_info->start_auto_scroll_in < nautilus_get_system_time()) {
+ && !ready_to_start_scrolling (drag_info, y_scroll_delta)) {
/* not yet */
return TRUE;
}
drag_info->waiting_to_autoscroll = FALSE;
- nautilus_drag_autoscroll_calculate_delta (tree_view->details->tree, &x_scroll_delta, &y_scroll_delta);
-
/* make the GtkScrolledWindow actually scroll */
nautilus_tree_view_real_scroll (tree_view, x_scroll_delta, y_scroll_delta);
return TRUE;
}
+
static void
nautilus_tree_view_start_auto_scroll (NautilusTreeView *tree_view)
{
- NautilusDragInfo *drag_info;
-
g_assert (NAUTILUS_IS_TREE_VIEW (tree_view));
- drag_info = tree_view->details->dnd->drag_info;
-
- if (drag_info->auto_scroll_timeout_id == 0) {
- drag_info->waiting_to_autoscroll = TRUE;
- drag_info->start_auto_scroll_in = nautilus_get_system_time()
- + AUTOSCROLL_INITIAL_DELAY;
- drag_info->auto_scroll_timeout_id = gtk_timeout_add
- (AUTOSCROLL_TIMEOUT_INTERVAL,
- auto_scroll_timeout_callback,
- tree_view);
- }
+ nautilus_drag_autoscroll_start (tree_view->details->dnd->drag_info,
+ tree_view->details->tree,
+ auto_scroll_timeout_callback,
+ tree_view);
}
+
static void
nautilus_tree_view_stop_auto_scroll (NautilusTreeView *tree_view)
{
- NautilusDragInfo *drag_info;
-
g_assert (NAUTILUS_IS_TREE_VIEW (tree_view));
- drag_info = tree_view->details->dnd->drag_info;
- if (drag_info->auto_scroll_timeout_id) {
- gtk_timeout_remove (drag_info->auto_scroll_timeout_id);
- drag_info->auto_scroll_timeout_id = 0;
- }
+ nautilus_drag_autoscroll_stop (tree_view->details->dnd->drag_info);
}
@@ -1588,8 +1353,6 @@ nautilus_tree_view_drag_destroy (NautilusTreeView *tree_view)
nautilus_ctree_set_prelight (NAUTILUS_CTREE (tree_view->details->tree),
-1);
nautilus_tree_view_prelight_stop (tree_view);
-
- nautilus_tree_view_expand_maybe_later (tree_view, 0, 0);
}
diff --git a/libnautilus-extensions/nautilus-drag.c b/libnautilus-extensions/nautilus-drag.c
index 560b9fa71..4d9f1718a 100644
--- a/libnautilus-extensions/nautilus-drag.c
+++ b/libnautilus-extensions/nautilus-drag.c
@@ -33,8 +33,9 @@
#include <libgnomevfs/gnome-vfs-ops.h>
#include <libgnomeui/gnome-uidefs.h>
#include <libgnomeui/gnome-popup-menu.h>
-#include <string.h>
#include <stdio.h>
+#include <string.h>
+#include <gtk/gtkmain.h>
#include "nautilus-glib-extensions.h"
#include "nautilus-link.h"
@@ -468,6 +469,19 @@ nautilus_drag_drop_action_ask (GdkDragAction actions)
* edge
*/
+
+
+gboolean
+nautilus_drag_autoscroll_in_scroll_region (GtkWidget *widget)
+{
+ float x_scroll_delta, y_scroll_delta;
+
+ nautilus_drag_autoscroll_calculate_delta (widget, &x_scroll_delta, &y_scroll_delta);
+
+ return x_scroll_delta != 0 || y_scroll_delta != 0;
+}
+
+
void
nautilus_drag_autoscroll_calculate_delta (GtkWidget *widget, float *x_scroll_delta, float *y_scroll_delta)
{
@@ -537,6 +551,43 @@ nautilus_drag_autoscroll_calculate_delta (GtkWidget *widget, float *x_scroll_del
}
+
+
+void
+nautilus_drag_autoscroll_start (NautilusDragInfo *drag_info,
+ GtkWidget *widget,
+ GtkFunction callback,
+ gpointer user_data)
+{
+ if (nautilus_drag_autoscroll_in_scroll_region (widget)) {
+ if (drag_info->auto_scroll_timeout_id == 0) {
+ drag_info->waiting_to_autoscroll = TRUE;
+ drag_info->start_auto_scroll_in = nautilus_get_system_time()
+ + AUTOSCROLL_INITIAL_DELAY;
+
+ drag_info->auto_scroll_timeout_id = gtk_timeout_add
+ (AUTOSCROLL_TIMEOUT_INTERVAL,
+ callback,
+ user_data);
+ }
+ } else {
+ if (drag_info->auto_scroll_timeout_id != 0) {
+ gtk_timeout_remove (drag_info->auto_scroll_timeout_id);
+ drag_info->auto_scroll_timeout_id = 0;
+ }
+ }
+}
+
+void
+nautilus_drag_autoscroll_stop (NautilusDragInfo *drag_info)
+{
+ if (drag_info->auto_scroll_timeout_id) {
+ gtk_timeout_remove (drag_info->auto_scroll_timeout_id);
+ drag_info->auto_scroll_timeout_id = 0;
+ }
+}
+
+
void
nautilus_drag_file_receive_dropped_keyword (NautilusFile *file, char *keyword)
{
diff --git a/libnautilus-extensions/nautilus-drag.h b/libnautilus-extensions/nautilus-drag.h
index 56abfdc17..6610c18be 100644
--- a/libnautilus-extensions/nautilus-drag.h
+++ b/libnautilus-extensions/nautilus-drag.h
@@ -36,7 +36,6 @@
#define AUTOSCROLL_INITIAL_DELAY 750000
/* in microseconds */
-
/* Item of the drag selection list */
typedef struct {
char *uri;
@@ -142,12 +141,21 @@ int nautilus_drag_modifier_based_action (int default_action,
GdkDragAction nautilus_drag_drop_action_ask (GdkDragAction possible_actions);
+gboolean nautilus_drag_autoscroll_in_scroll_region (GtkWidget *widget);
void nautilus_drag_autoscroll_calculate_delta (GtkWidget *widget,
float *x_scroll_delta,
float *y_scroll_delta);
+
+void nautilus_drag_autoscroll_start (NautilusDragInfo *drag_info,
+ GtkWidget *widget,
+ GtkFunction callback,
+ gpointer user_data);
+
+void nautilus_drag_autoscroll_stop (NautilusDragInfo *drag_info);
+
+
void nautilus_drag_file_receive_dropped_keyword (NautilusFile *file,
char *keyword);
-
#endif
diff --git a/libnautilus-extensions/nautilus-icon-dnd.c b/libnautilus-extensions/nautilus-icon-dnd.c
index 6d6a38c3e..31530e480 100644
--- a/libnautilus-extensions/nautilus-icon-dnd.c
+++ b/libnautilus-extensions/nautilus-icon-dnd.c
@@ -639,13 +639,13 @@ auto_scroll_timeout_callback (gpointer data)
widget = GTK_WIDGET (data);
container = NAUTILUS_ICON_CONTAINER (widget);
- if (container->details->waiting_to_autoscroll
- && container->details->start_auto_scroll_in < nautilus_get_system_time()) {
+ if (container->details->dnd_info->drag_info.waiting_to_autoscroll
+ && container->details->dnd_info->drag_info.start_auto_scroll_in > nautilus_get_system_time()) {
/* not yet */
return TRUE;
}
- container->details->waiting_to_autoscroll = FALSE;
+ container->details->dnd_info->drag_info.waiting_to_autoscroll = FALSE;
nautilus_drag_autoscroll_calculate_delta (widget, &x_scroll_delta, &y_scroll_delta);
if (x_scroll_delta == 0 && y_scroll_delta == 0) {
@@ -697,24 +697,16 @@ auto_scroll_timeout_callback (gpointer data)
static void
set_up_auto_scroll_if_needed (NautilusIconContainer *container)
{
- if (container->details->auto_scroll_timeout_id == 0) {
- container->details->waiting_to_autoscroll = TRUE;
- container->details->start_auto_scroll_in = nautilus_get_system_time()
- + AUTOSCROLL_INITIAL_DELAY;
- container->details->auto_scroll_timeout_id = gtk_timeout_add
- (AUTOSCROLL_TIMEOUT_INTERVAL,
- auto_scroll_timeout_callback,
- container);
- }
+ nautilus_drag_autoscroll_start (&container->details->dnd_info->drag_info,
+ GTK_WIDGET (container),
+ auto_scroll_timeout_callback,
+ container);
}
static void
stop_auto_scroll (NautilusIconContainer *container)
{
- if (container->details->auto_scroll_timeout_id) {
- gtk_timeout_remove (container->details->auto_scroll_timeout_id);
- container->details->auto_scroll_timeout_id = 0;
- }
+ nautilus_drag_autoscroll_stop (&container->details->dnd_info->drag_info);
}
static gboolean
diff --git a/libnautilus-extensions/nautilus-icon-private.h b/libnautilus-extensions/nautilus-icon-private.h
index b3c1fd25d..18977fc11 100644
--- a/libnautilus-extensions/nautilus-icon-private.h
+++ b/libnautilus-extensions/nautilus-icon-private.h
@@ -143,9 +143,6 @@ struct NautilusIconContainerDetails {
gboolean drag_started;
StretchState stretch_start;
int context_menu_timeout_id;
- int auto_scroll_timeout_id;
- gboolean waiting_to_autoscroll;
- gint64 start_auto_scroll_in;
/* Renaming Details */
gboolean renaming;
diff --git a/libnautilus-extensions/nautilus-list.c b/libnautilus-extensions/nautilus-list.c
index 6f33a3d74..c7af9f4cc 100644
--- a/libnautilus-extensions/nautilus-list.c
+++ b/libnautilus-extensions/nautilus-list.c
@@ -2962,7 +2962,7 @@ auto_scroll_timeout_callback (gpointer data)
drag_info = list->details->drag_info;
if (drag_info->waiting_to_autoscroll
- && drag_info->start_auto_scroll_in < nautilus_get_system_time()) {
+ && drag_info->start_auto_scroll_in > nautilus_get_system_time()) {
/* not yet */
return TRUE;
}
@@ -2979,34 +2979,20 @@ auto_scroll_timeout_callback (gpointer data)
static void
nautilus_list_start_auto_scroll (NautilusList *list)
{
- NautilusDragInfo *drag_info;
-
g_assert (NAUTILUS_IS_LIST (list));
- drag_info = list->details->drag_info;
- if (drag_info->auto_scroll_timeout_id == 0) {
- drag_info->waiting_to_autoscroll = TRUE;
- drag_info->start_auto_scroll_in = nautilus_get_system_time()
- + AUTOSCROLL_INITIAL_DELAY;
- drag_info->auto_scroll_timeout_id = gtk_timeout_add
- (AUTOSCROLL_TIMEOUT_INTERVAL,
- auto_scroll_timeout_callback,
- list);
- }
+ nautilus_drag_autoscroll_start (list->details->drag_info,
+ GTK_WIDGET (list),
+ auto_scroll_timeout_callback,
+ list);
}
static void
nautilus_list_stop_auto_scroll (NautilusList *list)
{
- NautilusDragInfo *drag_info;
-
g_assert (NAUTILUS_IS_LIST (list));
- drag_info = list->details->drag_info;
- if (drag_info->auto_scroll_timeout_id) {
- gtk_timeout_remove (drag_info->auto_scroll_timeout_id);
- drag_info->auto_scroll_timeout_id = 0;
- }
+ nautilus_drag_autoscroll_stop (list->details->drag_info);
}
static void
diff --git a/libnautilus-private/nautilus-drag.c b/libnautilus-private/nautilus-drag.c
index 560b9fa71..4d9f1718a 100644
--- a/libnautilus-private/nautilus-drag.c
+++ b/libnautilus-private/nautilus-drag.c
@@ -33,8 +33,9 @@
#include <libgnomevfs/gnome-vfs-ops.h>
#include <libgnomeui/gnome-uidefs.h>
#include <libgnomeui/gnome-popup-menu.h>
-#include <string.h>
#include <stdio.h>
+#include <string.h>
+#include <gtk/gtkmain.h>
#include "nautilus-glib-extensions.h"
#include "nautilus-link.h"
@@ -468,6 +469,19 @@ nautilus_drag_drop_action_ask (GdkDragAction actions)
* edge
*/
+
+
+gboolean
+nautilus_drag_autoscroll_in_scroll_region (GtkWidget *widget)
+{
+ float x_scroll_delta, y_scroll_delta;
+
+ nautilus_drag_autoscroll_calculate_delta (widget, &x_scroll_delta, &y_scroll_delta);
+
+ return x_scroll_delta != 0 || y_scroll_delta != 0;
+}
+
+
void
nautilus_drag_autoscroll_calculate_delta (GtkWidget *widget, float *x_scroll_delta, float *y_scroll_delta)
{
@@ -537,6 +551,43 @@ nautilus_drag_autoscroll_calculate_delta (GtkWidget *widget, float *x_scroll_del
}
+
+
+void
+nautilus_drag_autoscroll_start (NautilusDragInfo *drag_info,
+ GtkWidget *widget,
+ GtkFunction callback,
+ gpointer user_data)
+{
+ if (nautilus_drag_autoscroll_in_scroll_region (widget)) {
+ if (drag_info->auto_scroll_timeout_id == 0) {
+ drag_info->waiting_to_autoscroll = TRUE;
+ drag_info->start_auto_scroll_in = nautilus_get_system_time()
+ + AUTOSCROLL_INITIAL_DELAY;
+
+ drag_info->auto_scroll_timeout_id = gtk_timeout_add
+ (AUTOSCROLL_TIMEOUT_INTERVAL,
+ callback,
+ user_data);
+ }
+ } else {
+ if (drag_info->auto_scroll_timeout_id != 0) {
+ gtk_timeout_remove (drag_info->auto_scroll_timeout_id);
+ drag_info->auto_scroll_timeout_id = 0;
+ }
+ }
+}
+
+void
+nautilus_drag_autoscroll_stop (NautilusDragInfo *drag_info)
+{
+ if (drag_info->auto_scroll_timeout_id) {
+ gtk_timeout_remove (drag_info->auto_scroll_timeout_id);
+ drag_info->auto_scroll_timeout_id = 0;
+ }
+}
+
+
void
nautilus_drag_file_receive_dropped_keyword (NautilusFile *file, char *keyword)
{
diff --git a/libnautilus-private/nautilus-drag.h b/libnautilus-private/nautilus-drag.h
index 56abfdc17..6610c18be 100644
--- a/libnautilus-private/nautilus-drag.h
+++ b/libnautilus-private/nautilus-drag.h
@@ -36,7 +36,6 @@
#define AUTOSCROLL_INITIAL_DELAY 750000
/* in microseconds */
-
/* Item of the drag selection list */
typedef struct {
char *uri;
@@ -142,12 +141,21 @@ int nautilus_drag_modifier_based_action (int default_action,
GdkDragAction nautilus_drag_drop_action_ask (GdkDragAction possible_actions);
+gboolean nautilus_drag_autoscroll_in_scroll_region (GtkWidget *widget);
void nautilus_drag_autoscroll_calculate_delta (GtkWidget *widget,
float *x_scroll_delta,
float *y_scroll_delta);
+
+void nautilus_drag_autoscroll_start (NautilusDragInfo *drag_info,
+ GtkWidget *widget,
+ GtkFunction callback,
+ gpointer user_data);
+
+void nautilus_drag_autoscroll_stop (NautilusDragInfo *drag_info);
+
+
void nautilus_drag_file_receive_dropped_keyword (NautilusFile *file,
char *keyword);
-
#endif
diff --git a/libnautilus-private/nautilus-icon-dnd.c b/libnautilus-private/nautilus-icon-dnd.c
index 6d6a38c3e..31530e480 100644
--- a/libnautilus-private/nautilus-icon-dnd.c
+++ b/libnautilus-private/nautilus-icon-dnd.c
@@ -639,13 +639,13 @@ auto_scroll_timeout_callback (gpointer data)
widget = GTK_WIDGET (data);
container = NAUTILUS_ICON_CONTAINER (widget);
- if (container->details->waiting_to_autoscroll
- && container->details->start_auto_scroll_in < nautilus_get_system_time()) {
+ if (container->details->dnd_info->drag_info.waiting_to_autoscroll
+ && container->details->dnd_info->drag_info.start_auto_scroll_in > nautilus_get_system_time()) {
/* not yet */
return TRUE;
}
- container->details->waiting_to_autoscroll = FALSE;
+ container->details->dnd_info->drag_info.waiting_to_autoscroll = FALSE;
nautilus_drag_autoscroll_calculate_delta (widget, &x_scroll_delta, &y_scroll_delta);
if (x_scroll_delta == 0 && y_scroll_delta == 0) {
@@ -697,24 +697,16 @@ auto_scroll_timeout_callback (gpointer data)
static void
set_up_auto_scroll_if_needed (NautilusIconContainer *container)
{
- if (container->details->auto_scroll_timeout_id == 0) {
- container->details->waiting_to_autoscroll = TRUE;
- container->details->start_auto_scroll_in = nautilus_get_system_time()
- + AUTOSCROLL_INITIAL_DELAY;
- container->details->auto_scroll_timeout_id = gtk_timeout_add
- (AUTOSCROLL_TIMEOUT_INTERVAL,
- auto_scroll_timeout_callback,
- container);
- }
+ nautilus_drag_autoscroll_start (&container->details->dnd_info->drag_info,
+ GTK_WIDGET (container),
+ auto_scroll_timeout_callback,
+ container);
}
static void
stop_auto_scroll (NautilusIconContainer *container)
{
- if (container->details->auto_scroll_timeout_id) {
- gtk_timeout_remove (container->details->auto_scroll_timeout_id);
- container->details->auto_scroll_timeout_id = 0;
- }
+ nautilus_drag_autoscroll_stop (&container->details->dnd_info->drag_info);
}
static gboolean
diff --git a/libnautilus-private/nautilus-icon-private.h b/libnautilus-private/nautilus-icon-private.h
index b3c1fd25d..18977fc11 100644
--- a/libnautilus-private/nautilus-icon-private.h
+++ b/libnautilus-private/nautilus-icon-private.h
@@ -143,9 +143,6 @@ struct NautilusIconContainerDetails {
gboolean drag_started;
StretchState stretch_start;
int context_menu_timeout_id;
- int auto_scroll_timeout_id;
- gboolean waiting_to_autoscroll;
- gint64 start_auto_scroll_in;
/* Renaming Details */
gboolean renaming;
diff --git a/libnautilus-private/nautilus-list.c b/libnautilus-private/nautilus-list.c
index 6f33a3d74..c7af9f4cc 100644
--- a/libnautilus-private/nautilus-list.c
+++ b/libnautilus-private/nautilus-list.c
@@ -2962,7 +2962,7 @@ auto_scroll_timeout_callback (gpointer data)
drag_info = list->details->drag_info;
if (drag_info->waiting_to_autoscroll
- && drag_info->start_auto_scroll_in < nautilus_get_system_time()) {
+ && drag_info->start_auto_scroll_in > nautilus_get_system_time()) {
/* not yet */
return TRUE;
}
@@ -2979,34 +2979,20 @@ auto_scroll_timeout_callback (gpointer data)
static void
nautilus_list_start_auto_scroll (NautilusList *list)
{
- NautilusDragInfo *drag_info;
-
g_assert (NAUTILUS_IS_LIST (list));
- drag_info = list->details->drag_info;
- if (drag_info->auto_scroll_timeout_id == 0) {
- drag_info->waiting_to_autoscroll = TRUE;
- drag_info->start_auto_scroll_in = nautilus_get_system_time()
- + AUTOSCROLL_INITIAL_DELAY;
- drag_info->auto_scroll_timeout_id = gtk_timeout_add
- (AUTOSCROLL_TIMEOUT_INTERVAL,
- auto_scroll_timeout_callback,
- list);
- }
+ nautilus_drag_autoscroll_start (list->details->drag_info,
+ GTK_WIDGET (list),
+ auto_scroll_timeout_callback,
+ list);
}
static void
nautilus_list_stop_auto_scroll (NautilusList *list)
{
- NautilusDragInfo *drag_info;
-
g_assert (NAUTILUS_IS_LIST (list));
- drag_info = list->details->drag_info;
- if (drag_info->auto_scroll_timeout_id) {
- gtk_timeout_remove (drag_info->auto_scroll_timeout_id);
- drag_info->auto_scroll_timeout_id = 0;
- }
+ nautilus_drag_autoscroll_stop (list->details->drag_info);
}
static void