[caribou] daemon: Don't use deprecated 'focus:' event



commit b2d9ac02c41f890652749c0a563d381bb9a44ad0
Author: Daiki Ueno <dueno src gnome org>
Date:   Mon Oct 20 17:34:41 2014 +0900

    daemon: Don't use deprecated 'focus:' event

 daemon/daemon.vala |   29 +++++++++++++----------------
 1 files changed, 13 insertions(+), 16 deletions(-)
---
diff --git a/daemon/daemon.vala b/daemon/daemon.vala
index ca80799..af6e895 100644
--- a/daemon/daemon.vala
+++ b/daemon/daemon.vala
@@ -88,19 +88,20 @@ namespace Caribou {
                 case Atspi.Role.PASSWORD_TEXT:
                 case Atspi.Role.TERMINAL:
                 case Atspi.Role.ENTRY:
-                    if (event.type.has_prefix ("focus") || event.detail1 == 1) {
-                        set_entry_location (acc);
-                        current_acc = event.source;
-                        debug ("enter text widget in %s",
-                               event.source.get_application ().name);
-                    } else if (event.detail1 == 0 && acc == current_acc) {
-                        keyboard.hide (get_timestamp ());
-                        current_acc = null;
-                        debug ("leave text widget in %s",
-                               event.source.get_application ().name);
+                    if (event.type == "object:state-changed:focused") {
+                        if (event.detail1 == 1) {
+                            set_entry_location (acc);
+                            current_acc = event.source;
+                            debug ("enter text widget in %s",
+                                   event.source.get_application ().name);
+                        } else if (acc == current_acc) {
+                            keyboard.hide (get_timestamp ());
+                            current_acc = null;
+                            debug ("leave text widget in %s",
+                                   event.source.get_application ().name);
+                        }
                     } else {
-                        warning ("unhandled editable widget: %s",
-                                 event.source.name);
+                        warning ("unknown focus event: %s", event.type);
                     }
                     break;
                 default:
@@ -148,8 +149,6 @@ namespace Caribou {
             Atspi.EventListener.register_from_callback (
                 on_focus_ignore_error, "object:state-changed:focused");
             Atspi.EventListener.register_from_callback (
-                on_focus_ignore_error, "focus:");
-            Atspi.EventListener.register_from_callback (
                 on_text_caret_moved_ignore_error, "object:text-caret-moved");
         }
 
@@ -157,8 +156,6 @@ namespace Caribou {
             Atspi.EventListener.deregister_from_callback (
                 on_focus_ignore_error, "object:state-changed:focused");
             Atspi.EventListener.deregister_from_callback (
-                on_focus_ignore_error, "focus:");
-            Atspi.EventListener.deregister_from_callback (
                 on_text_caret_moved_ignore_error, "object:text-caret-moved");
         }
 


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