diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-03-15 12:34:26 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-03-15 12:41:21 -0400 |
commit | 9a11e3a64d485f2e9ae2bb2dd6409eb1c87f99d0 (patch) | |
tree | 34a6bccac86400f74d58f7f4c9eb12e05771b50f /libs/gtkmm2ext | |
parent | a8f242f80a980698f82d6ac6692e46e5373893c6 (diff) |
change API for CairoWidget::focus_handler
This functor/closure is responsible for stealing focus from any existing text entry (or whatever else may have focus)
when clicking on a CairoWidget or derived class.
The old implementation just gave focus back to the editor canvas. The new version walks up the widget packing
heirarchy to find a focusable parent (from the CairoWidget for which it is invoked). If no focusable parent
is found, it cancels keyboard focus in the toplevel window containing the CairoWidget
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r-- | libs/gtkmm2ext/cairo_widget.cc | 6 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/cairo_widget.h | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/libs/gtkmm2ext/cairo_widget.cc b/libs/gtkmm2ext/cairo_widget.cc index 78fb042f59..fe93f1eb7c 100644 --- a/libs/gtkmm2ext/cairo_widget.cc +++ b/libs/gtkmm2ext/cairo_widget.cc @@ -30,7 +30,7 @@ static const char* has_cairo_widget_background_info = "has_cairo_widget_backgrou bool CairoWidget::_flat_buttons = false; bool CairoWidget::_widget_prelight = true; -sigc::slot<void> CairoWidget::focus_handler; +sigc::slot<void,Gtk::Widget*> 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 (?) { @@ -60,7 +60,7 @@ CairoWidget::~CairoWidget () bool CairoWidget::on_button_press_event (GdkEventButton*) { - focus_handler(); + focus_handler (this); return false; } @@ -393,7 +393,7 @@ CairoWidget::set_widget_prelight (bool yn) } void -CairoWidget::set_focus_handler (sigc::slot<void> s) +CairoWidget::set_focus_handler (sigc::slot<void,Gtk::Widget*> s) { focus_handler = s; } diff --git a/libs/gtkmm2ext/gtkmm2ext/cairo_widget.h b/libs/gtkmm2ext/gtkmm2ext/cairo_widget.h index 2a483840f9..2588adcdcc 100644 --- a/libs/gtkmm2ext/gtkmm2ext/cairo_widget.h +++ b/libs/gtkmm2ext/gtkmm2ext/cairo_widget.h @@ -93,7 +93,7 @@ public: they wish to invoke any existing focus handler from their own button press handler, they can just use: focus_handler(); */ - static void set_focus_handler (sigc::slot<void>); + static void set_focus_handler (sigc::slot<void,Gtk::Widget*>); protected: /** Render the widget to the given Cairo context */ @@ -118,7 +118,7 @@ protected: static bool _widget_prelight; bool _grabbed; - static sigc::slot<void> focus_handler; + static sigc::slot<void,Gtk::Widget*> focus_handler; private: Cairo::RefPtr<Cairo::Surface> image_surface; |