From 71e085d82570496ff0077d7828f984e71cffe8de Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 18 Mar 2024 10:49:15 -0600 Subject: [PATCH] ensure that the canvas fully redraws after style/visibility events --- libs/canvas/canvas.cc | 20 ++++++++++++++++++++ libs/canvas/canvas/canvas.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc index 2721c6c96b..b2876d4a26 100644 --- a/libs/canvas/canvas.cc +++ b/libs/canvas/canvas.cc @@ -966,6 +966,9 @@ GtkCanvas::on_size_allocate (Gtk::Allocation& a) } #endif + /* call to ensure that entire canvas is marked in the invalidation region */ + queue_draw (); + /* x, y in a are relative to the parent. When passing this down to the root group, this origin is effectively 0,0 */ @@ -1113,6 +1116,23 @@ GtkCanvas::on_scroll_event (GdkEventScroll* ev) return deliver_event (reinterpret_cast(©)); } +void +GtkCanvas::on_style_changed (const Glib::RefPtr& style) +{ + EventBox::on_style_changed (style); + /* call to ensure that entire canvas is marked in the invalidation region */ + queue_draw (); +} + +bool +GtkCanvas::on_visibility_notify_event (GdkEventVisibility* ev) +{ + bool ret = EventBox::on_visibility_notify_event (ev); + /* call to ensure that entire canvas is marked in the invalidation region */ + queue_draw (); + return ret; +} + /** Handler for GDK key press events. * @param ev Event. * @return true if the event was handled. diff --git a/libs/canvas/canvas/canvas.h b/libs/canvas/canvas/canvas.h index 75fcd9e495..c8d53a3e4f 100644 --- a/libs/canvas/canvas/canvas.h +++ b/libs/canvas/canvas/canvas.h @@ -270,6 +270,8 @@ protected: bool on_motion_notify_event (GdkEventMotion *); bool on_enter_notify_event (GdkEventCrossing*); bool on_leave_notify_event (GdkEventCrossing*); + void on_style_changed (const Glib::RefPtr&); + bool on_visibility_notify_event (GdkEventVisibility*); void on_map(); void on_unmap();