diff options
author | Yonit Halperin <yhalperi@redhat.com> | 2009-11-12 19:57:34 +0200 |
---|---|---|
committer | Yaniv Kamay <ykamay@redhat.com> | 2009-11-15 13:41:10 +0200 |
commit | a461f0655f1d97503fe854d285da95c306d7edf8 (patch) | |
tree | ca7a0b9376209c2198cb1cd9e6cedcf90a41270f /client/application.h | |
parent | 39153191258c4a37e4e61241c3149f7ca08e217c (diff) | |
download | spice-a461f0655f1d97503fe854d285da95c306d7edf8.tar.gz spice-a461f0655f1d97503fe854d285da95c306d7edf8.tar.xz spice-a461f0655f1d97503fe854d285da95c306d7edf8.zip |
spice client: sticky Alt activation when holding an Alt key: bug #505912.
Additional changes that were required for the feature:
1) focusing on the pointed window in full screen mode
2) In X11 - handling events that occur during keyboard ungrabbing
3) In X11 - handling Leave/Enter Notify events that occur during keyboard grabbing/ungrabbing
4) In X11 - fix for focus events that are handled in the wrong order (happens when
focus events occur during grabbing the keyboard)
5) In X11 - ignoring key release events during key holding
6) In Windows - synchronizing keyboard release events that occured during a modal loop
Diffstat (limited to 'client/application.h')
-rw-r--r-- | client/application.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/client/application.h b/client/application.h index 91afb54e..c576dba6 100644 --- a/client/application.h +++ b/client/application.h @@ -90,6 +90,25 @@ enum CanvasOption { #endif }; +class StickyKeyTimer: public Timer { +public: + virtual void response(AbstractProcessLoop& events_loop); +}; + +typedef struct StickyInfo { + bool trace_is_on; + bool sticky_mode; + bool key_first_down; // True when (1) a potential sticky key is pressed, + // and none of the other keys are pressed and (2) in the moment + // of pressing, _sticky_mode is false. When the key is up + // for the first time, it is set to false. + bool key_down; // The physical state of the sticky key. Valid only till + // stickiness is removed. + RedKey key; // the key that is currently being traced, or, + // if _sticky mode is on, the sticky key + AutoRef<StickyKeyTimer> timer; +} StickyInfo; + class Application : public ProcessLoop, public Platform::EventListener, public Platform::DisplayModeListner, @@ -114,6 +133,8 @@ public: void on_key_up(RedKey key); void on_deactivate_screen(RedScreen* screen); void on_activate_screen(RedScreen* screen); + void on_start_screen_key_interception(RedScreen* screen); + void on_stop_screen_key_interception(RedScreen* screen); virtual void on_app_activated(); virtual void on_app_deactivated(); virtual void on_monitors_change(); @@ -180,6 +201,13 @@ private: int get_hotkeys_commnad(); bool is_key_set_pressed(const HotkeySet& key_set); bool is_cad_pressed(); + void do_on_key_up(RedKey key); + + // returns the press value before operation (i.e., if it was already pressed) + bool press_key(RedKey key); + bool unpress_key(RedKey key); + void reset_sticky(); + static bool is_sticky_trace_key(RedKey key); static void init_logger(); static void init_globals(); @@ -188,6 +216,7 @@ private: friend class ConnectionErrorEvent; friend class MonitorsQuery; friend class AutoAbort; + friend class StickyKeyTimer; private: RedClient _client; @@ -201,12 +230,16 @@ private: int _exit_code; RedScreen* _active_screen; KeyInfo _key_table[REDKEY_NUM_KEYS]; + int _num_keys_pressed; HotKeys _hot_keys; CommandsMap _commands_map; std::auto_ptr<GUILayer> _gui_layer; InputsHandler* _inputs_handler; const MonitorsList* _monitors; std::wstring _title; + bool _splash_mode; + bool _sys_key_intercept_mode; + StickyInfo _sticky_info; std::vector<int> _canvas_types; AutoRef<Menu> _app_menu; }; |