[Spice-commits] client/inputs_channel.cpp client/inputs_channel.h
Alon Levy
alon at kemper.freedesktop.org
Thu Dec 30 02:18:22 PST 2010
client/inputs_channel.cpp | 14 +++++++++++++-
client/inputs_channel.h | 2 ++
2 files changed, 15 insertions(+), 1 deletion(-)
New commits:
commit d66c1904f984bcb1f4a5d9e24811636cdda0c2e1
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Mon Nov 1 23:45:43 2010 +0100
client inputs: stop blinking keyboard when out of focus
We could introduce another boolean to prevent changes, or just reuse
_active_modifiers_event = true to prevent further update.
Additionaly this patch restore the keyboard state when focusing out,
which is fine when dealing with full remote desktop, but should be
reconsidered if/when SPICE supports remote windows managed by client
window manager for instance, imho.
diff --git a/client/inputs_channel.cpp b/client/inputs_channel.cpp
index 9ff5479..c527580 100644
--- a/client/inputs_channel.cpp
+++ b/client/inputs_channel.cpp
@@ -404,10 +404,14 @@ void InputsChannel::set_local_modifiers()
void InputsChannel::on_focus_in()
{
+ Lock lock(_update_modifiers_lock);
+ _active_modifiers_event = false;
+ _on_focus_modifiers = Platform::get_keyboard_lock_modifiers();
+
#ifdef SYNC_REMOTE_MODIFIERS
Message* message = new Message(SPICE_MSGC_INPUTS_KEY_MODIFIERS);
SpiceMsgcKeyModifiers modifiers;
- modifiers.modifiers = Platform::get_keyboard_lock_modifiers();
+ modifiers.modifiers = _on_focus_modifiers;
_marshallers->msgc_inputs_key_modifiers(message->marshaller(), &modifiers);
post_message(message);
#else
@@ -415,6 +419,14 @@ void InputsChannel::on_focus_in()
#endif
}
+void InputsChannel::on_focus_out()
+{
+ Lock lock(_update_modifiers_lock);
+ _active_modifiers_event = true;
+ _modifiers = _on_focus_modifiers;
+ set_local_modifiers();
+}
+
void InputsChannel::init_scan_code(int index)
{
ASSERT((index & 0x80) == 0);
diff --git a/client/inputs_channel.h b/client/inputs_channel.h
index 00e185c..254ed45 100644
--- a/client/inputs_channel.h
+++ b/client/inputs_channel.h
@@ -34,6 +34,7 @@ public:
virtual void on_key_down(RedKey key);
virtual void on_key_up(RedKey key);
virtual void on_focus_in();
+ virtual void on_focus_out();
void on_mouse_position(int x, int y, int buttons_state, int display_id);
@@ -72,6 +73,7 @@ private:
bool _active_motion;
int _motion_count;
uint32_t _modifiers;
+ uint32_t _on_focus_modifiers;
Mutex _update_modifiers_lock;
bool _active_modifiers_event;
More information about the Spice-commits
mailing list