diff options
-rw-r--r-- | engine/engine.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/engine/engine.py b/engine/engine.py index a42f642..be66738 100644 --- a/engine/engine.py +++ b/engine/engine.py @@ -126,6 +126,10 @@ class Engine(IBus.EngineSimple): # init state self.__idle_id = 0 self.__prop_dict = {} + self.__input_purpose = 0 + self.__has_input_purpose = False + if hasattr(IBus, 'InputPurpose'): + self.__has_input_purpose = True try: self.__is_utf8 = (getpreferredencoding().lower() == 'utf-8') except: @@ -963,11 +967,17 @@ class Engine(IBus.EngineSimple): self.__lookup_table.set_page_size(size) def do_focus_out(self): + if self.__has_input_purpose: + self.__input_purpose = 0 mode = self.__prefs.get_value('common', 'behavior_on_focus_out') if mode == 0 or mode == 1: self.__reset() self.__invalidate() + def do_set_content_type(self, purpose, hints): + if self.__has_input_purpose: + self.__input_purpose = purpose + def do_disable(self): self.__reset() self.__invalidate() @@ -1807,6 +1817,10 @@ class Engine(IBus.EngineSimple): return True def __process_key_event_internal2(self, keyval, keycode, state): + if self.__has_input_purpose and \ + self.__input_purpose == IBus.InputPurpose.PASSWORD: + return False + if Engine.__typing_mode == jastring.TYPING_MODE_THUMB_SHIFT and \ Engine.__input_mode not in [INPUT_MODE_LATIN, INPUT_MODE_WIDE_LATIN]: return self.process_key_event_thumb(keyval, keycode, state) |