[retro-gtk] core-view: Reset inputs when losing focus



commit 3296f08c298ac561f11ac079d26941d31e2bc5d6
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Sun Sep 17 09:15:27 2017 +0200

    core-view: Reset inputs when losing focus
    
    This avoids key to appear as stuck by receiving the key press event but
    not the corresponding key release event.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787769

 retro-gtk/retro-core-view-extern.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/retro-gtk/retro-core-view-extern.c b/retro-gtk/retro-core-view-extern.c
index 76c6694..c6614ff 100644
--- a/retro-gtk/retro-core-view-extern.c
+++ b/retro-gtk/retro-core-view-extern.c
@@ -48,6 +48,12 @@ set_input_released (GHashTable *table,
   g_hash_table_remove (table, &input);
 }
 
+static void
+reset_input (GHashTable *table)
+{
+  g_hash_table_remove_all (table);
+}
+
 static gboolean
 get_input_state (GHashTable *table,
                  guint       input)
@@ -235,6 +241,9 @@ retro_core_view_on_focus_out_event (RetroCoreView *self,
   if (retro_core_view_get_is_pointer_grabbed (self))
     retro_core_view_ungrab (self);
 
+  reset_input (self->key_state);
+  reset_input (self->mouse_button_state);
+
   return FALSE;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]