[Spice-devel] [PATCH] client inputs: stop blinking keyboard when out of focus

Marc-André Lureau marcandre.lureau at redhat.com
Fri Nov 12 04:37:55 PST 2010


We could introduce another boolean to prevent changes, or just reuse
_active_modifiers_event = true to prevent further update until the
focus comes back.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=626975
---
 client/inputs_channel.cpp |    9 +++++++++
 client/inputs_channel.h   |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/client/inputs_channel.cpp b/client/inputs_channel.cpp
index 9ff5479..efcd96f 100644
--- a/client/inputs_channel.cpp
+++ b/client/inputs_channel.cpp
@@ -404,6 +404,9 @@ void InputsChannel::set_local_modifiers()
 
 void InputsChannel::on_focus_in()
 {
+    Lock lock(_update_modifiers_lock);
+    _active_modifiers_event = false;
+
 #ifdef SYNC_REMOTE_MODIFIERS
     Message* message = new Message(SPICE_MSGC_INPUTS_KEY_MODIFIERS);
     SpiceMsgcKeyModifiers modifiers;
@@ -415,6 +418,12 @@ void InputsChannel::on_focus_in()
 #endif
 }
 
+void InputsChannel::on_focus_out()
+{
+    Lock lock(_update_modifiers_lock);
+    _active_modifiers_event = true;
+}
+
 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..a9a2e2f 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);
 
-- 
1.7.3.2



More information about the Spice-devel mailing list