[gnome-shell/wip/carlosg/clutter-keymap: 61/61] st: Use ClutterKeymap to detect caps lock state changes



commit 95a31b0c319ee86d5b64d3115c62dcd324bd7138
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jan 10 23:19:17 2019 +0100

    st: Use ClutterKeymap to detect caps lock state changes
    
    This drops usage of Gtk/X11, replacing it with code that is dependent
    of the Clutter backend in use. Another positive side effect is that
    the keymap state will now be correct on wayland, since there were no
    guarantees that X11 key state would reflect the current reality.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762881

 src/st/st-entry.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/st/st-entry.c b/src/st/st-entry.c
index 909d0377c..d23eeb2c7 100644
--- a/src/st/st-entry.c
+++ b/src/st/st-entry.c
@@ -239,15 +239,15 @@ remove_capslock_feedback (StEntry *entry)
 }
 
 static void
-keymap_state_changed (GdkKeymap *keymap,
-                      gpointer   user_data)
+keymap_state_changed (ClutterKeymap *keymap,
+                      gpointer       user_data)
 {
   StEntry *entry = ST_ENTRY (user_data);
   StEntryPrivate *priv = ST_ENTRY_PRIV (entry);
 
   if (clutter_text_get_password_char (CLUTTER_TEXT (priv->entry)) != 0)
     {
-      if (gdk_keymap_get_caps_lock_state (keymap))
+      if (clutter_keymap_get_caps_lock_state (keymap))
         show_capslock_feedback (entry);
       else
         remove_capslock_feedback (entry);
@@ -259,11 +259,11 @@ st_entry_dispose (GObject *object)
 {
   StEntry *entry = ST_ENTRY (object);
   StEntryPrivate *priv = ST_ENTRY_PRIV (entry);
-  GdkKeymap *keymap;
+  ClutterKeymap *keymap;
 
   cogl_clear_object (&priv->text_shadow_material);
 
-  keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
+  keymap = clutter_backend_get_keymap (clutter_get_default_backend ());
   g_signal_handlers_disconnect_by_func (keymap, keymap_state_changed, entry);
 
   G_OBJECT_CLASS (st_entry_parent_class)->dispose (object);
@@ -563,11 +563,11 @@ clutter_text_focus_in_cb (ClutterText  *text,
                           ClutterActor *actor)
 {
   StEntry *entry = ST_ENTRY (actor);
-  GdkKeymap *keymap;
+  ClutterKeymap *keymap;
 
   st_entry_update_hint_visibility (entry);
 
-  keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
+  keymap = clutter_backend_get_keymap (clutter_get_default_backend ());
   keymap_state_changed (keymap, entry);
   g_signal_connect (keymap, "state-changed",
                     G_CALLBACK (keymap_state_changed), entry);
@@ -581,7 +581,7 @@ clutter_text_focus_out_cb (ClutterText  *text,
                            ClutterActor *actor)
 {
   StEntry *entry = ST_ENTRY (actor);
-  GdkKeymap *keymap;
+  ClutterKeymap *keymap;
 
   st_widget_remove_style_pseudo_class (ST_WIDGET (actor), "focus");
 
@@ -590,7 +590,7 @@ clutter_text_focus_out_cb (ClutterText  *text,
   clutter_text_set_cursor_visible (text, FALSE);
   remove_capslock_feedback (entry);
 
-  keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
+  keymap = clutter_backend_get_keymap (clutter_get_default_backend ());
   g_signal_handlers_disconnect_by_func (keymap, keymap_state_changed, entry);
 }
 


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