[orca] Improve support for KWin
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Improve support for KWin
- Date: Wed, 13 Mar 2019 20:35:03 +0000 (UTC)
commit c93947e9502541cb9fd942d9a18fcb6a2c410827
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Mar 13 16:33:38 2019 -0400
Improve support for KWin
configure.ac | 1 +
src/orca/scripts/apps/Makefile.am | 1 +
src/orca/scripts/apps/__init__.py | 4 +-
src/orca/scripts/apps/kwin/Makefile.am | 6 +++
src/orca/scripts/apps/kwin/__init__.py | 24 +++++++++++
src/orca/scripts/apps/kwin/script.py | 45 ++++++++++++++++++++
src/orca/scripts/apps/kwin/script_utilities.py | 59 ++++++++++++++++++++++++++
src/orca/scripts/switcher/__init__.py | 2 +-
src/orca/scripts/switcher/script.py | 8 ++++
9 files changed, 146 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b85a576b5..521c0d6ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,6 +106,7 @@ src/orca/scripts/apps/gnome-screensaver-dialog/Makefile
src/orca/scripts/apps/gnome-search-tool/Makefile
src/orca/scripts/apps/gnome-shell/Makefile
src/orca/scripts/apps/gnome-window-properties/Makefile
+src/orca/scripts/apps/kwin/Makefile
src/orca/scripts/apps/Instantbird/Makefile
src/orca/scripts/apps/notification-daemon/Makefile
src/orca/scripts/apps/notify-osd/Makefile
diff --git a/src/orca/scripts/apps/Makefile.am b/src/orca/scripts/apps/Makefile.am
index 9df8aa38e..0b179d792 100644
--- a/src/orca/scripts/apps/Makefile.am
+++ b/src/orca/scripts/apps/Makefile.am
@@ -17,6 +17,7 @@ SUBDIRS = \
gnome-search-tool \
gnome-window-properties \
Instantbird \
+ kwin \
notification-daemon \
notify-osd \
Mozilla \
diff --git a/src/orca/scripts/apps/__init__.py b/src/orca/scripts/apps/__init__.py
index 751692275..1dedebc1b 100644
--- a/src/orca/scripts/apps/__init__.py
+++ b/src/orca/scripts/apps/__init__.py
@@ -10,19 +10,17 @@ __all__ = ['Banshee',
'gedit',
'gnome-documents',
'gnome-keyring-ask',
- 'gnome-mud',
'gnome-panel',
'gnome-screensaver-dialog',
'gnome-search-tool',
'gnome-shell',
'gnome-window-properties',
'Instantbird',
- 'liferea',
+ 'kwin',
'Mozilla',
'notification-daemon',
'notify-osd',
'pidgin',
- 'planner',
'rhythmbox',
'soffice',
'SeaMonkey',
diff --git a/src/orca/scripts/apps/kwin/Makefile.am b/src/orca/scripts/apps/kwin/Makefile.am
new file mode 100644
index 000000000..f44130a36
--- /dev/null
+++ b/src/orca/scripts/apps/kwin/Makefile.am
@@ -0,0 +1,6 @@
+orca_python_PYTHON = \
+ __init__.py \
+ script.py \
+ script_utilities.py
+
+orca_pythondir=$(pkgpythondir)/scripts/apps/kwin
diff --git a/src/orca/scripts/apps/kwin/__init__.py b/src/orca/scripts/apps/kwin/__init__.py
new file mode 100644
index 000000000..1d83171b0
--- /dev/null
+++ b/src/orca/scripts/apps/kwin/__init__.py
@@ -0,0 +1,24 @@
+# Orca
+#
+# Copyright 2019 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 kwin."""
+
+from .script import Script
+
diff --git a/src/orca/scripts/apps/kwin/script.py b/src/orca/scripts/apps/kwin/script.py
new file mode 100644
index 000000000..bdb433bf7
--- /dev/null
+++ b/src/orca/scripts/apps/kwin/script.py
@@ -0,0 +1,45 @@
+# Orca
+#
+# Copyright 2019 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 kwin."""
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2019 Igalia, S.L."
+__license__ = "LGPL"
+
+from orca.scripts import switcher
+from orca.scripts.toolkits import Qt
+
+from .script_utilities import Utilities
+
+
+class Script(switcher.Script, Qt.Script):
+
+ def __init__(self, app):
+ """Creates a new script for the given application."""
+
+ super().__init__(app)
+
+ def getUtilities(self):
+ """Returns the utilites for this script."""
+
+ return Utilities(self)
diff --git a/src/orca/scripts/apps/kwin/script_utilities.py b/src/orca/scripts/apps/kwin/script_utilities.py
new file mode 100644
index 000000000..180e55c40
--- /dev/null
+++ b/src/orca/scripts/apps/kwin/script_utilities.py
@@ -0,0 +1,59 @@
+# Orca
+#
+# Copyright 2019 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2019 Igalia, S.L."
+__license__ = "LGPL"
+
+import pyatspi
+
+from orca.scripts import switcher
+
+
+class Utilities(switcher.Utilities):
+
+ def __init__(self, script):
+ super().__init__(script)
+
+ def isSwitcherContainer(self, obj):
+ """Returns True if obj is the switcher container."""
+
+ if not (obj and obj.getRole() == pyatspi.ROLE_FILLER):
+ return False
+
+ return obj.getState().contains(pyatspi.STATE_FOCUSED)
+
+ def isSwitcherSelectionChangeEventType(self, event):
+ """Returns True if this event is the one we use to present changes."""
+
+ if event.type.startswith("object:state-changed:focused"):
+ return event.detail1
+
+ return False
+
+ def getSelectionName(self, container):
+ """Returns the name of the currently-selected item."""
+
+ if self.isSwitcherContainer(container):
+ return container.name
+
+ return ""
diff --git a/src/orca/scripts/switcher/__init__.py b/src/orca/scripts/switcher/__init__.py
index 78e10f0a5..ba6b8a0ac 100644
--- a/src/orca/scripts/switcher/__init__.py
+++ b/src/orca/scripts/switcher/__init__.py
@@ -20,4 +20,4 @@
"""Custom script for basic switchers like Metacity."""
from .script import Script
-
+from .script_utilities import Utilities
diff --git a/src/orca/scripts/switcher/script.py b/src/orca/scripts/switcher/script.py
index f4680304d..51654ca97 100644
--- a/src/orca/scripts/switcher/script.py
+++ b/src/orca/scripts/switcher/script.py
@@ -76,6 +76,14 @@ class Script(default.Script):
self.presentMessage(self.utilities.getSelectionName(event.source))
return True
+ def onFocusedChanged(self, event):
+ """Callback for object:state-changed:focused accessibility events."""
+
+ if self._handleSwitcherEvent(event):
+ return
+
+ super().onFocusedChanged(event)
+
def onNameChanged(self, event):
"""Callback for object:property-change:accessible-name events."""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]