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