diff options
author | nick_m <mainsbridge@gmail.com> | 2015-04-02 02:41:49 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2015-04-02 02:41:49 +1100 |
commit | 35f69656e859cdd00ce28e29083788a91d3fbd5f (patch) | |
tree | b53ca99b60eff69381ffc85a6011d56aea412535 /libs/gtkmm2ext/keyboard.cc | |
parent | 9a4827374ca4e4c310d02adf65c727d92b56724c (diff) |
Window focus handling fixes.
Many windows were not getting key events.
Use magic focus infrastructure (built for widgets) to deliver key events
via window focus in/out.
Diffstat (limited to 'libs/gtkmm2ext/keyboard.cc')
-rw-r--r-- | libs/gtkmm2ext/keyboard.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libs/gtkmm2ext/keyboard.cc b/libs/gtkmm2ext/keyboard.cc index 48fcae8482..420d42209b 100644 --- a/libs/gtkmm2ext/keyboard.cc +++ b/libs/gtkmm2ext/keyboard.cc @@ -384,6 +384,29 @@ Keyboard::leave_window (GdkEventCrossing *ev, Gtk::Window* /*win*/) return false; } +bool +Keyboard::focus_in_window (GdkEventFocus *, Gtk::Window* win) +{ + current_window = win; + DEBUG_TRACE (DEBUG::Keyboard, string_compose ("Focusing in window, title = %1\n", win->get_title())); + return false; +} + +bool +Keyboard::focus_out_window (GdkEventFocus * ev, Gtk::Window* win) +{ + if (ev) { + state.clear (); + current_window = 0; + } else { + current_window = 0; + } + + DEBUG_TRACE (DEBUG::Keyboard, string_compose ("Foucusing out window, title = %1\n", win->get_title())); + + return false; +} + void Keyboard::set_edit_button (guint but) { |