|
|
d695c0 |
From a7a31137aee8c4af81d7d447ceb83ccdb2ddadc0 Mon Sep 17 00:00:00 2001
|
|
|
d695c0 |
From: Xiang Fan <sfanxiang@gmail.com>
|
|
|
d695c0 |
Date: Fri, 13 Jul 2018 11:49:09 -0700
|
|
|
d695c0 |
Subject: [PATCH] nautilus-canvas-container: Remove the "include visible area"
|
|
|
d695c0 |
logic.
|
|
|
d695c0 |
|
|
|
d695c0 |
canvas_set_scroll_region_include_visible_area() was added in
|
|
|
d695c0 |
ec054c80981e26b71c8bb2e6853b035dc2063e7d to fix
|
|
|
d695c0 |
https://bugzilla.gnome.org/show_bug.cgi?id=42068 ("Dragging icons
|
|
|
d695c0 |
adjusts scroll area in a way that causes immediate scrolling"). This is
|
|
|
d695c0 |
no longer the case, because now icons remain in place when being dragged
|
|
|
d695c0 |
and are not allowed to be rearranged.
|
|
|
d695c0 |
|
|
|
d695c0 |
ec054c80981e26b71c8bb2e6853b035dc2063e7d causes issues relating to extra
|
|
|
d695c0 |
scrolling space (#340), hence the removal.
|
|
|
d695c0 |
|
|
|
d695c0 |
Fixes #340.
|
|
|
d695c0 |
---
|
|
|
d695c0 |
src/nautilus-canvas-container.c | 79 +--------------------------------
|
|
|
d695c0 |
src/nautilus-canvas-container.h | 1 -
|
|
|
d695c0 |
src/nautilus-canvas-private.h | 3 --
|
|
|
d695c0 |
src/nautilus-canvas-view.c | 6 ---
|
|
|
d695c0 |
4 files changed, 1 insertion(+), 88 deletions(-)
|
|
|
d695c0 |
|
|
|
d695c0 |
diff --git a/src/nautilus-canvas-container.c b/src/nautilus-canvas-container.c
|
|
|
d695c0 |
index 09acd47fc..bd05a3a2d 100644
|
|
|
d695c0 |
--- a/src/nautilus-canvas-container.c
|
|
|
d695c0 |
+++ b/src/nautilus-canvas-container.c
|
|
|
d695c0 |
@@ -968,45 +968,6 @@ get_all_icon_bounds (NautilusCanvasContainer *container,
|
|
|
d695c0 |
x1, y1, x2, y2, usage);
|
|
|
d695c0 |
}
|
|
|
d695c0 |
|
|
|
d695c0 |
-/* Don't preserve visible white space the next time the scroll region
|
|
|
d695c0 |
- * is recomputed when the container is not empty. */
|
|
|
d695c0 |
-void
|
|
|
d695c0 |
-nautilus_canvas_container_reset_scroll_region (NautilusCanvasContainer *container)
|
|
|
d695c0 |
-{
|
|
|
d695c0 |
- container->details->reset_scroll_region_trigger = TRUE;
|
|
|
d695c0 |
-}
|
|
|
d695c0 |
-
|
|
|
d695c0 |
-/* Set a new scroll region without eliminating any of the currently-visible area. */
|
|
|
d695c0 |
-static void
|
|
|
d695c0 |
-canvas_set_scroll_region_include_visible_area (EelCanvas *canvas,
|
|
|
d695c0 |
- double x1,
|
|
|
d695c0 |
- double y1,
|
|
|
d695c0 |
- double x2,
|
|
|
d695c0 |
- double y2)
|
|
|
d695c0 |
-{
|
|
|
d695c0 |
- double old_x1, old_y1, old_x2, old_y2;
|
|
|
d695c0 |
- double old_scroll_x, old_scroll_y;
|
|
|
d695c0 |
- double height, width;
|
|
|
d695c0 |
- GtkAllocation allocation;
|
|
|
d695c0 |
-
|
|
|
d695c0 |
- eel_canvas_get_scroll_region (canvas, &old_x1, &old_y1, &old_x2, &old_y2);
|
|
|
d695c0 |
- gtk_widget_get_allocation (GTK_WIDGET (canvas), &allocation);
|
|
|
d695c0 |
-
|
|
|
d695c0 |
- width = (allocation.width) / canvas->pixels_per_unit;
|
|
|
d695c0 |
- height = (allocation.height) / canvas->pixels_per_unit;
|
|
|
d695c0 |
-
|
|
|
d695c0 |
- old_scroll_x = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas)));
|
|
|
d695c0 |
- old_scroll_y = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas)));
|
|
|
d695c0 |
-
|
|
|
d695c0 |
- x1 = MIN (x1, old_x1 + old_scroll_x);
|
|
|
d695c0 |
- y1 = MIN (y1, old_y1 + old_scroll_y);
|
|
|
d695c0 |
- x2 = MAX (x2, old_x1 + old_scroll_x + width);
|
|
|
d695c0 |
- y2 = MAX (y2, old_y1 + old_scroll_y + height);
|
|
|
d695c0 |
-
|
|
|
d695c0 |
- eel_canvas_set_scroll_region
|
|
|
d695c0 |
- (canvas, x1, y1, x2, y2);
|
|
|
d695c0 |
-}
|
|
|
d695c0 |
-
|
|
|
d695c0 |
void
|
|
|
d695c0 |
nautilus_canvas_container_update_scroll_region (NautilusCanvasContainer *container)
|
|
|
d695c0 |
{
|
|
|
d695c0 |
@@ -1014,24 +975,10 @@ nautilus_canvas_container_update_scroll_region (NautilusCanvasContainer *contain
|
|
|
d695c0 |
double pixels_per_unit;
|
|
|
d695c0 |
GtkAdjustment *hadj, *vadj;
|
|
|
d695c0 |
float step_increment;
|
|
|
d695c0 |
- gboolean reset_scroll_region;
|
|
|
d695c0 |
GtkAllocation allocation;
|
|
|
d695c0 |
|
|
|
d695c0 |
pixels_per_unit = EEL_CANVAS (container)->pixels_per_unit;
|
|
|
d695c0 |
|
|
|
d695c0 |
- reset_scroll_region = container->details->reset_scroll_region_trigger
|
|
|
d695c0 |
- || nautilus_canvas_container_is_empty (container);
|
|
|
d695c0 |
-
|
|
|
d695c0 |
- /* The trigger is only cleared when container is non-empty, so
|
|
|
d695c0 |
- * callers can reliably reset the scroll region when an item
|
|
|
d695c0 |
- * is added even if extraneous relayouts are called when the
|
|
|
d695c0 |
- * window is still empty.
|
|
|
d695c0 |
- */
|
|
|
d695c0 |
- if (!nautilus_canvas_container_is_empty (container))
|
|
|
d695c0 |
- {
|
|
|
d695c0 |
- container->details->reset_scroll_region_trigger = FALSE;
|
|
|
d695c0 |
- }
|
|
|
d695c0 |
-
|
|
|
d695c0 |
get_all_icon_bounds (container, &x1, &y1, &x2, &y2, BOUNDS_USAGE_FOR_ENTIRE_ITEM);
|
|
|
d695c0 |
|
|
|
d695c0 |
/* Add border at the "end"of the layout (i.e. after the icons), to
|
|
|
d695c0 |
@@ -1053,18 +1000,7 @@ nautilus_canvas_container_update_scroll_region (NautilusCanvasContainer *contain
|
|
|
d695c0 |
y2 -= 1;
|
|
|
d695c0 |
y2 = MAX (y1, y2);
|
|
|
d695c0 |
|
|
|
d695c0 |
- if (reset_scroll_region)
|
|
|
d695c0 |
- {
|
|
|
d695c0 |
- eel_canvas_set_scroll_region
|
|
|
d695c0 |
- (EEL_CANVAS (container),
|
|
|
d695c0 |
- x1, y1, x2, y2);
|
|
|
d695c0 |
- }
|
|
|
d695c0 |
- else
|
|
|
d695c0 |
- {
|
|
|
d695c0 |
- canvas_set_scroll_region_include_visible_area
|
|
|
d695c0 |
- (EEL_CANVAS (container),
|
|
|
d695c0 |
- x1, y1, x2, y2);
|
|
|
d695c0 |
- }
|
|
|
d695c0 |
+ eel_canvas_set_scroll_region (EEL_CANVAS (container), x1, y1, x2, y2);
|
|
|
d695c0 |
|
|
|
d695c0 |
hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container));
|
|
|
d695c0 |
vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container));
|
|
|
d695c0 |
@@ -5722,23 +5658,10 @@ nautilus_canvas_container_get_icon_drop_target_uri (NautilusCanvasContainer *con
|
|
|
d695c0 |
return uri;
|
|
|
d695c0 |
}
|
|
|
d695c0 |
|
|
|
d695c0 |
-/* Call to reset the scroll region only if the container is not empty,
|
|
|
d695c0 |
- * to avoid having the flag linger until the next file is added.
|
|
|
d695c0 |
- */
|
|
|
d695c0 |
-static void
|
|
|
d695c0 |
-reset_scroll_region_if_not_empty (NautilusCanvasContainer *container)
|
|
|
d695c0 |
-{
|
|
|
d695c0 |
- if (!nautilus_canvas_container_is_empty (container))
|
|
|
d695c0 |
- {
|
|
|
d695c0 |
- nautilus_canvas_container_reset_scroll_region (container);
|
|
|
d695c0 |
- }
|
|
|
d695c0 |
-}
|
|
|
d695c0 |
-
|
|
|
d695c0 |
/* Re-sort, switching to automatic layout if it was in manual layout. */
|
|
|
d695c0 |
void
|
|
|
d695c0 |
nautilus_canvas_container_sort (NautilusCanvasContainer *container)
|
|
|
d695c0 |
{
|
|
|
d695c0 |
- reset_scroll_region_if_not_empty (container);
|
|
|
d695c0 |
container->details->needs_resort = TRUE;
|
|
|
d695c0 |
redo_layout (container);
|
|
|
d695c0 |
}
|
|
|
d695c0 |
diff --git a/src/nautilus-canvas-container.h b/src/nautilus-canvas-container.h
|
|
|
d695c0 |
index a370bba26..33929375d 100644
|
|
|
d695c0 |
--- a/src/nautilus-canvas-container.h
|
|
|
d695c0 |
+++ b/src/nautilus-canvas-container.h
|
|
|
d695c0 |
@@ -271,7 +271,6 @@ void nautilus_canvas_container_set_single_click_mode (Nauti
|
|
|
d695c0 |
gboolean single_click_mode);
|
|
|
d695c0 |
void nautilus_canvas_container_enable_linger_selection (NautilusCanvasContainer *view,
|
|
|
d695c0 |
gboolean enable);
|
|
|
d695c0 |
-void nautilus_canvas_container_reset_scroll_region (NautilusCanvasContainer *container);
|
|
|
d695c0 |
void nautilus_canvas_container_set_font (NautilusCanvasContainer *container,
|
|
|
d695c0 |
const char *font);
|
|
|
d695c0 |
void nautilus_canvas_container_set_margins (NautilusCanvasContainer *container,
|
|
|
d695c0 |
diff --git a/src/nautilus-canvas-private.h b/src/nautilus-canvas-private.h
|
|
|
d695c0 |
index dd5e79060..e60e86299 100644
|
|
|
d695c0 |
--- a/src/nautilus-canvas-private.h
|
|
|
d695c0 |
+++ b/src/nautilus-canvas-private.h
|
|
|
d695c0 |
@@ -192,9 +192,6 @@ struct NautilusCanvasContainerDetails {
|
|
|
d695c0 |
|
|
|
d695c0 |
int size_allocation_count;
|
|
|
d695c0 |
guint size_allocation_count_id;
|
|
|
d695c0 |
-
|
|
|
d695c0 |
- /* Ignore the visible area the next time the scroll region is recomputed */
|
|
|
d695c0 |
- gboolean reset_scroll_region_trigger;
|
|
|
d695c0 |
|
|
|
d695c0 |
/* a11y items used by canvas items */
|
|
|
d695c0 |
guint a11y_item_action_idle_handler;
|
|
|
d695c0 |
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
|
|
|
d695c0 |
index f74ea06db..bd3a7ae5d 100644
|
|
|
d695c0 |
--- a/src/nautilus-canvas-view.c
|
|
|
d695c0 |
+++ b/src/nautilus-canvas-view.c
|
|
|
d695c0 |
@@ -355,12 +355,6 @@ nautilus_canvas_view_add_files (NautilusFilesView *view,
|
|
|
d695c0 |
canvas_view = NAUTILUS_CANVAS_VIEW (view);
|
|
|
d695c0 |
canvas_container = get_canvas_container (canvas_view);
|
|
|
d695c0 |
|
|
|
d695c0 |
- /* Reset scroll region for the first canvas added when loading a directory. */
|
|
|
d695c0 |
- if (nautilus_files_view_get_loading (view) && nautilus_canvas_container_is_empty (canvas_container))
|
|
|
d695c0 |
- {
|
|
|
d695c0 |
- nautilus_canvas_container_reset_scroll_region (canvas_container);
|
|
|
d695c0 |
- }
|
|
|
d695c0 |
-
|
|
|
d695c0 |
for (l = files; l != NULL; l = l->next)
|
|
|
d695c0 |
{
|
|
|
d695c0 |
if (nautilus_canvas_container_add (canvas_container,
|
|
|
d695c0 |
--
|
|
|
d695c0 |
2.37.1
|
|
|
d695c0 |
|