[orca] Create a custom script for Epiphany to handle window activation and deactivation better



commit 2bfd37f7dadfa659447c4dec2549cf4c9acc03bc
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Feb 1 20:00:31 2014 -0500

    Create a custom script for Epiphany to handle window activation and deactivation better

 configure.ac                               |    1 +
 src/orca/scripts/apps/Makefile.am          |    1 +
 src/orca/scripts/apps/__init__.py          |    1 +
 src/orca/scripts/apps/epiphany/Makefile.am |    5 ++
 src/orca/scripts/apps/epiphany/__init__.py |   23 +++++++++++
 src/orca/scripts/apps/epiphany/script.py   |   57 ++++++++++++++++++++++++++++
 6 files changed, 88 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index bf08077..6407ff0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,6 +92,7 @@ src/orca/scripts/apps/Banshee/Makefile
 src/orca/scripts/apps/Eclipse/Makefile
 src/orca/scripts/apps/ekiga/Makefile
 src/orca/scripts/apps/empathy/Makefile
+src/orca/scripts/apps/epiphany/Makefile
 src/orca/scripts/apps/evince/Makefile
 src/orca/scripts/apps/evolution/Makefile
 src/orca/scripts/apps/gajim/Makefile
diff --git a/src/orca/scripts/apps/Makefile.am b/src/orca/scripts/apps/Makefile.am
index f110d60..ae63dc9 100644
--- a/src/orca/scripts/apps/Makefile.am
+++ b/src/orca/scripts/apps/Makefile.am
@@ -3,6 +3,7 @@ SUBDIRS = \
        Eclipse \
        ekiga \
        empathy \
+       epiphany \
        evince \
        evolution \
        gajim \
diff --git a/src/orca/scripts/apps/__init__.py b/src/orca/scripts/apps/__init__.py
index 3348399..21a25c5 100644
--- a/src/orca/scripts/apps/__init__.py
+++ b/src/orca/scripts/apps/__init__.py
@@ -2,6 +2,7 @@ __all__ = ['Banshee',
            'Eclipse',
            'ekiga',
            'empathy',
+           'epiphany',
            'evince',
            'evolution',
            'gajim',
diff --git a/src/orca/scripts/apps/epiphany/Makefile.am b/src/orca/scripts/apps/epiphany/Makefile.am
new file mode 100644
index 0000000..3af586b
--- /dev/null
+++ b/src/orca/scripts/apps/epiphany/Makefile.am
@@ -0,0 +1,5 @@
+orca_python_PYTHON = \
+       __init__.py \
+       script.py
+
+orca_pythondir=$(pkgpythondir)/scripts/apps/epiphany
diff --git a/src/orca/scripts/apps/epiphany/__init__.py b/src/orca/scripts/apps/epiphany/__init__.py
new file mode 100644
index 0000000..077efbc
--- /dev/null
+++ b/src/orca/scripts/apps/epiphany/__init__.py
@@ -0,0 +1,23 @@
+# Orca
+#
+# Copyright 2014 Igalia, S.L.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
+# Boston MA  02110-1301 USA.
+
+"""Custom script for epiphany."""
+
+from .script import Script
+
diff --git a/src/orca/scripts/apps/epiphany/script.py b/src/orca/scripts/apps/epiphany/script.py
new file mode 100644
index 0000000..78ec346
--- /dev/null
+++ b/src/orca/scripts/apps/epiphany/script.py
@@ -0,0 +1,57 @@
+# Orca
+#
+# Copyright 2014 Igalia, S.L.
+#
+# Author: Joanmarie Diggs <jdiggs igalia com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
+# Boston MA  02110-1301 USA.
+
+"""Custom script for epiphany."""
+
+__id__        = "$Id$"
+__version__   = "$Revision$"
+__date__      = "$Date$"
+__copyright__ = "Copyright (c) 2014 Igalia, S.L."
+__license__   = "LGPL"
+
+import orca.orca as orca
+import orca.scripts.toolkits.gtk as gtk
+import orca.scripts.toolkits.WebKitGtk as WebKitGtk
+
+class Script(WebKitGtk.Script):
+
+    def __init__(self, app):
+        WebKitGtk.Script.__init__(self, app)
+        self._lastCaretContext = None, -1
+
+    def onWindowActivated(self, event):
+        """Callback for window:activate accessibility events."""
+
+        gtk.Script.onWindowActivated(self, event)
+
+        obj, offset = self._lastCaretContext
+        if self.utilities.isWebKitGtk(obj):
+            orca.setLocusOfFocus(None, obj)
+
+    def onWindowDeactivated(self, event):
+        """Callback for window:deactivate accessibility events."""
+
+        obj, offset = self.pointOfReference.get("lastCursorPosition", (None, -1))
+        if self.utilities.isWebKitGtk(obj):
+            self._lastCaretContext = obj, offset
+
+        gtk.Script.onWindowDeactivated(self, event)
+


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