ensure that the canvas fully redraws after style/visibility events

This commit is contained in:
Paul Davis 2024-03-18 10:49:15 -06:00
parent 0c4eada414
commit 71e085d825
2 changed files with 22 additions and 0 deletions

View File

@ -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<GdkEvent*>(&copy));
}
void
GtkCanvas::on_style_changed (const Glib::RefPtr<Gtk::Style>& 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.

View File

@ -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<Gtk::Style>&);
bool on_visibility_notify_event (GdkEventVisibility*);
void on_map();
void on_unmap();