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



commit d8440ef9e48d5476840ae890b4ea9f14b8fd34e8
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 a9c062937..197234a49 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,7 +259,7 @@ st_entry_dispose (GObject *object)
 {
   StEntry *entry = ST_ENTRY (object);
   StEntryPrivate *priv = ST_ENTRY_PRIV (entry);
-  GdkKeymap *keymap;
+  ClutterKeymap *keymap;
 
   if (priv->text_shadow_material != COGL_INVALID_HANDLE)
     {
@@ -267,7 +267,7 @@ st_entry_dispose (GObject *object)
       priv->text_shadow_material = COGL_INVALID_HANDLE;
     }
 
-  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);
@@ -571,11 +571,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);
@@ -589,7 +589,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");
 
@@ -598,7 +598,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]