[orca] Get rid of the fake window:activate event * We can set the locus of focus to achieve the same result



commit a45c5ff4ce1d198c61aea39609c5388d46bf1c6e
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Dec 26 19:49:07 2011 -0500

    Get rid of the fake window:activate event
    * We can set the locus of focus to achieve the same result.
    * Nobody likes a liar.

 src/orca/event_manager.py |   24 ------------------------
 src/orca/orca.py          |    5 +++++
 2 files changed, 5 insertions(+), 24 deletions(-)
---
diff --git a/src/orca/event_manager.py b/src/orca/event_manager.py
index 7772e7f..a02add0 100644
--- a/src/orca/event_manager.py
+++ b/src/orca/event_manager.py
@@ -70,30 +70,6 @@ class EventManager:
         self._registerListener("object:children-changed")
         self._registerListener("mouse:button")
 
-        win = orca_state.activeScript.utilities.activeWindow()
-        if win:
-            # Generate a fake window activation event so the application
-            # can tell the user about itself.
-            #
-            class _FakeEvent:
-                def __init__(self, source, eventType,
-                             detail1, detail2, any_data):
-                    self.source = source
-                    self.type = eventType
-                    self.detail1 = detail1
-                    self.detail2 = detail2
-                    self.any_data = any_data
-                    self.host_application = None
-
-            class _FakeData:
-                def __init__(self):
-                    pass
-                def value(self):
-                    return None
-
-            fe = _FakeEvent(win, "window:activate", 0, 0, _FakeData())
-            self._enqueue(fe)
-
     def deactivate(self):
         """Called when this event manager is deactivated."""
 
diff --git a/src/orca/orca.py b/src/orca/orca.py
index c7d956b..dfe915d 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -1820,6 +1820,11 @@ def main():
         debug.printException(debug.LEVEL_SEVERE)
 
     showSplashGUI()
+    script = orca_state.activeScript
+    if script:
+        window = script.utilities.activeWindow()
+        if window:
+            setLocusOfFocus(None, window, force=True)
 
     # Check to see if the user wants the configuration GUI. It's
     # done here so that the user's existing preferences can be used



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