Only pass keypresses to the input manager after trying to process them in VTE
Following on from #246 (moved) I took @chpe suggestion and wrote a patch that simply moves the section where vte passes the keypress to the input manager to the end of the function, and that fixes my problem.
It's kind of a big hammer, but the more I think about it, the more I think it's the right solution. A terminal should pass all keypresses on to the terminal unless it really knows what else to do with them.
Anyway, lemme know what you think. If you think this is a good idea I can set up a PR.
diff --git a/src/vte.cc b/src/vte.cc
index 034c3062..634bb018 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -4610,15 +4610,6 @@ Terminal::widget_key_press(KeyEvent const& event)
}
}
- /* Let the input method at this one first. */
- if (!steal && m_input_enabled) {
- if (m_real_widget->im_filter_keypress(event)) {
- _vte_debug_print(VTE_DEBUG_EVENTS,
- "Keypress taken by IM.\n");
- return true;
- }
- }
-
/* Now figure out what to send to the child. */
if (event.is_key_press() && !modifier) {
handled = FALSE;
@@ -4943,6 +4934,14 @@ Terminal::widget_key_press(KeyEvent const& event)
}
return true;
}
+ if (!steal && m_input_enabled) {
+ if (m_real_widget->im_filter_keypress(event)) {
+ _vte_debug_print(VTE_DEBUG_EVENTS,
+ "Keypress taken by IM.\n");
+ return true;
+ }
+
+ }
return false;
}