diff options
author | Maciej Stachowiak <mstachow@src.gnome.org> | 2000-11-21 08:20:01 +0000 |
---|---|---|
committer | Maciej Stachowiak <mstachow@src.gnome.org> | 2000-11-21 08:20:01 +0000 |
commit | c82012c9ea09edc61bdc141b62b7f7956492a11f (patch) | |
tree | d21e0d728b2ab22d7eefb2b24d9955f9eb8fd6f7 /libnautilus-extensions/nautilus-drag.c | |
parent | 1956c13187c26aa914c3d65456bbba6f4fdbaf9d (diff) | |
download | nautilus-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.
Diffstat (limited to 'libnautilus-extensions/nautilus-drag.c')
-rw-r--r-- | libnautilus-extensions/nautilus-drag.c | 53 |
1 files changed, 52 insertions, 1 deletions
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) { |