Fix #1106: Split/Split pane sync - Shift+Arrow keys scrolling is out of sync on high...
authorColin Clark <colin.clark@cclark.uk>
Thu, 15 Jun 2023 10:31:07 +0000 (11:31 +0100)
committerColin Clark <colin.clark@cclark.uk>
Thu, 15 Jun 2023 10:31:07 +0000 (11:31 +0100)
https://github.com/BestImageViewer/geeqie/issues/1106

I do not know which situations the previous code was designed to handle
- there may be some problems in test cases I did not use.

src/layout-image.cc

index e1d2b6a..70c30f9 100644 (file)
@@ -1079,8 +1079,7 @@ void layout_image_to_root(LayoutWindow *lw)
 
 void layout_image_scroll(LayoutWindow *lw, gint x, gint y, gboolean connect_scroll)
 {
-       gdouble dx, dy;
-       gint width, height, i;
+       gint i;
        if (!layout_valid(&lw)) return;
 
        image_scroll(lw->image, x, y);
@@ -1092,19 +1091,11 @@ void layout_image_scroll(LayoutWindow *lw, gint x, gint y, gboolean connect_scro
 
        if (!connect_scroll) return;
 
-       image_get_image_size(lw->image, &width, &height);
-       dx = static_cast<gdouble>(x) / width;
-       dy = static_cast<gdouble>(y) / height;
-
        for (i = 0; i < MAX_SPLIT_IMAGES; i++)
                {
                if (lw->split_images[i] && lw->split_images[i] != lw->image)
                        {
-                       gdouble sx, sy;
-                       image_get_scroll_center(lw->split_images[i], &sx, &sy);
-                       sx += dx;
-                       sy += dy;
-                       image_set_scroll_center(lw->split_images[i], sx, sy);
+                       image_scroll(lw->split_images[i], x, y);
                        }
                }