diff cagou/core/cagou_main.py @ 349:33244f944bd8

core: "key_input" method is now checked and used if suitable in selected widget.
author Goffi <goffi@goffi.org>
date Fri, 17 Jan 2020 18:44:35 +0100
parents 7b9a0e57df53
children 1ac40d3121f6
line wrap: on
line diff
--- a/cagou/core/cagou_main.py	Fri Jan 17 18:44:32 2020 +0100
+++ b/cagou/core/cagou_main.py	Fri Jan 17 18:44:35 2020 +0100
@@ -342,6 +342,14 @@
         return local_platform.on_stop()
 
     def key_input(self, window, key, scancode, codepoint, modifier):
+
+        # we first check if selected widget handles the key
+        if ((self.host.selected_widget is not None
+             and hasattr(self.host.selected_widget, 'key_input')
+             and self.host.selected_widget.key_input(window, key, scancode, codepoint,
+                 modifier))):
+            return True
+
         if key == 27:
             # we disable [esc] handling, because default action is to quit app
             return True