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/screen.cpp | |
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/screen.cpp')
-rw-r--r-- | client/screen.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/client/screen.cpp b/client/screen.cpp index 8b7ee289..bbc76e75 100644 --- a/client/screen.cpp +++ b/client/screen.cpp @@ -93,11 +93,13 @@ RedScreen::RedScreen(Application& owner, int id, const std::wstring& name, int w _window.set_menu(*menu); AutoRef<Icon> icon(Platform::load_icon(RED_ICON_RES_ID)); _window.set_icon(*icon); + _window.start_key_interception(); } RedScreen::~RedScreen() { bool captured = is_captured(); + _window.stop_key_interception(); relase_inputs(); destroy_composit_area(); _owner.deactivate_interval_timer(*_update_timer); @@ -435,9 +437,6 @@ void RedScreen::capture_inputs() reset_mouse_pos(); _window.cupture_mouse(); } -#ifndef NO_KEY_GRAB - _window.start_key_interception(); -#endif _captured = true; } @@ -446,9 +445,6 @@ void RedScreen::relase_inputs() if (!_captured) { return; } -#ifndef NO_KEY_GRAB - _window.stop_key_interception(); -#endif _captured = false; _window.release_mouse(); if (_owner.get_mouse_mode() == RED_MOUSE_MODE_SERVER) { @@ -576,6 +572,11 @@ void RedScreen::on_pointer_enter() if (!_frame_area) { _pointer_location = POINTER_IN_ACTIVE_AREA; update_active_cursor(); + if (_full_screen) { + /* allowing enterance to key interception mode without + requiring the user to press the window */ + activate(); + } } } @@ -584,6 +585,18 @@ void RedScreen::on_pointer_leave() _pointer_location = POINTER_OUTSIDE_WINDOW; } +void RedScreen::on_start_key_interception() +{ + _key_interception = true; + _owner.on_start_screen_key_interception(this); +} + +void RedScreen::on_stop_key_interception() +{ + _key_interception = false; + _owner.on_stop_screen_key_interception(this); +} + void RedScreen::enter_modal_loop() { _forec_update_timer++; |