From a1699ff612f27dd2916e0616096a4eaead6a8dc3 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 3 Oct 2021 19:47:18 -0600 Subject: [PATCH] canvas: size_allocate() from GTK gives origin in parent coordinates. Convert to canvas-relative origin when passing to root group for allocation --- libs/canvas/canvas.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc index 05b1f10aa3..2be916eebd 100644 --- a/libs/canvas/canvas.cc +++ b/libs/canvas/canvas.cc @@ -916,7 +916,11 @@ GtkCanvas::on_size_allocate (Gtk::Allocation& a) } #endif - Rect r (a.get_x(), a.get_y(), a.get_width(), a.get_height()); + /* x, y in a are relative to the parent. When passing this down to the + root group, this origin is effectively 0,0 + */ + + Rect r (0., 0., a.get_width(), a.get_height()); _root.size_allocate (r); }