X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fgtkmm2ext%2Fcairo_widget.cc;h=fe93f1eb7cc384dc72f9f72c95332b1f3ab288bc;hb=0eb509ac2e023b556a43017c0d018be972b10673;hp=0f34a3ffdbbff3ac828e4d71fe819975b4c8fd9f;hpb=4a9ffee48632a9ca9241b03a8e9b20cff229c423;p=ardour.git diff --git a/libs/gtkmm2ext/cairo_widget.cc b/libs/gtkmm2ext/cairo_widget.cc index 0f34a3ffdb..fe93f1eb7c 100644 --- a/libs/gtkmm2ext/cairo_widget.cc +++ b/libs/gtkmm2ext/cairo_widget.cc @@ -30,8 +30,7 @@ static const char* has_cairo_widget_background_info = "has_cairo_widget_backgrou bool CairoWidget::_flat_buttons = false; bool CairoWidget::_widget_prelight = true; -static void noop() { } -sigc::slot CairoWidget::focus_handler (sigc::ptr_fun (noop)); +sigc::slot CairoWidget::focus_handler; void CairoWidget::set_source_rgb_a( cairo_t* cr, Gdk::Color col, float a) //ToDo: this one and the Canvas version should be in a shared file (?) { @@ -61,7 +60,7 @@ CairoWidget::~CairoWidget () bool CairoWidget::on_button_press_event (GdkEventButton*) { - focus_handler(); + focus_handler (this); return false; } @@ -183,15 +182,21 @@ CairoWidget::on_expose_event (GdkEventExpose *ev) #endif cr->rectangle (ev->area.x, ev->area.y, ev->area.width, ev->area.height); - cr->clip_preserve (); - /* paint expose area the color of the parent window bg - */ + if (_need_bg) { + cr->clip_preserve (); + + /* paint expose area the color of the parent window bg + */ - Gdk::Color bg (get_parent_bg()); + Gdk::Color bg (get_parent_bg()); - cr->set_source_rgb (bg.get_red_p(), bg.get_green_p(), bg.get_blue_p()); - cr->fill (); + cr->set_source_rgb (bg.get_red_p(), bg.get_green_p(), bg.get_blue_p()); + cr->fill (); + } else { + std::cerr << get_name() << " skipped bg fill\n"; + cr->clip (); + } cairo_rectangle_t expose_area; expose_area.x = ev->area.x; @@ -388,7 +393,7 @@ CairoWidget::set_widget_prelight (bool yn) } void -CairoWidget::set_focus_handler (sigc::slot s) +CairoWidget::set_focus_handler (sigc::slot s) { focus_handler = s; }