diff options
author | Robin Gareus <robin@gareus.org> | 2016-12-10 20:48:57 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-12-10 21:30:33 +0100 |
commit | 642b3573760646c902225eaba83c2bc10442e057 (patch) | |
tree | bf986b44c54c9640618b1d5ca0395353f1c01cef | |
parent | 914224f808a5611029434c55855448c82053d0f8 (diff) | |
download | ardour-642b3573760646c902225eaba83c2bc10442e057.zip ardour-642b3573760646c902225eaba83c2bc10442e057.tar.gz ardour-642b3573760646c902225eaba83c2bc10442e057.tar.bz2 |
CairoPacker draws outside of its widget allocation
This fixes fixes TimeInfoBox packing when the InfoBox position changes.
-rw-r--r-- | libs/gtkmm2ext/cairo_packer.cc | 14 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/cairo_packer.h | 20 |
2 files changed, 25 insertions, 9 deletions
diff --git a/libs/gtkmm2ext/cairo_packer.cc b/libs/gtkmm2ext/cairo_packer.cc index 71f35fc..2f7b46f 100644 --- a/libs/gtkmm2ext/cairo_packer.cc +++ b/libs/gtkmm2ext/cairo_packer.cc @@ -65,6 +65,13 @@ CairoHPacker::on_expose_event (GdkEventExpose* ev) return HBox::on_expose_event (ev); } +void +CairoHPacker::on_size_allocate (Gtk::Allocation& alloc) +{ + get_parent()->queue_draw(); + HBox::on_size_allocate (alloc); +} + CairoVPacker::CairoVPacker () { } @@ -83,6 +90,13 @@ CairoVPacker::on_realize () CairoWidget::provide_background_for_cairo_widget (*this, get_bg()); } +void +CairoVPacker::on_size_allocate (Gtk::Allocation& alloc) +{ + get_parent()->queue_draw(); + VBox::on_size_allocate (alloc); +} + Gdk::Color CairoVPacker::get_bg () const { diff --git a/libs/gtkmm2ext/gtkmm2ext/cairo_packer.h b/libs/gtkmm2ext/gtkmm2ext/cairo_packer.h index 74f6130..9a7cbcb 100644 --- a/libs/gtkmm2ext/gtkmm2ext/cairo_packer.h +++ b/libs/gtkmm2ext/gtkmm2ext/cairo_packer.h @@ -7,38 +7,40 @@ class LIBGTKMM2EXT_API CairoPacker { - public: +public: CairoPacker () {} virtual ~CairoPacker () {} - virtual Gdk::Color get_bg () const = 0; + virtual Gdk::Color get_bg () const = 0; - protected: +protected: virtual void draw_background (Gtk::Widget&, GdkEventExpose*); }; class LIBGTKMM2EXT_API CairoHPacker : public CairoPacker, public Gtk::HBox { - public: +public: CairoHPacker (); ~CairoHPacker() {} - Gdk::Color get_bg () const; + Gdk::Color get_bg () const; bool on_expose_event (GdkEventExpose*); - void on_realize (); + void on_realize (); + void on_size_allocate (Gtk::Allocation& alloc); }; class LIBGTKMM2EXT_API CairoVPacker : public CairoPacker, public Gtk::VBox { - public: +public: CairoVPacker (); ~CairoVPacker () {} - Gdk::Color get_bg () const; + Gdk::Color get_bg () const; bool on_expose_event (GdkEventExpose*); - void on_realize (); + void on_realize (); + void on_size_allocate (Gtk::Allocation& alloc); }; #endif /* __gtkmm2ext_cairo_packer_h__ */ |