summaryrefslogtreecommitdiff
diff options
-rw-r--r--CMakeLists.txt2
-rw-r--r--HACKING1
-rw-r--r--launcher/SwitcherController.cpp2
-rw-r--r--manual-tests/Launcher.txt47
-rw-r--r--plugins/unityshell/src/unitya11y.cpp129
-rw-r--r--services/CMakeLists.txt3
-rw-r--r--services/panel-a11y.c118
-rw-r--r--tests/autopilot/unity/tests/launcher/test_icon_behavior.py21
-rw-r--r--tests/autopilot/unity/tests/launcher/test_keynav.py36
9 files changed, 70 insertions, 289 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 17b4d71ab..5332d8f48 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -127,7 +127,7 @@ endif (DISABLE_MAINTAINER_CFLAGS)
#
# Compiz Plugins
#
-set (UNITY_PLUGIN_DEPS "compiz>=0.9.8.0;nux-3.0>=3.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;gmodule-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;unity-misc>=0.4.0;dbus-glib-1;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes;unity-protocol-private>=5.95.1;libgeis;xrender>=0.9")
+set (UNITY_PLUGIN_DEPS "compiz>=0.9.8.0;nux-3.0>=3.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;gmodule-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;atk-bridge-2.0;unity-misc>=0.4.0;dbus-glib-1;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes;unity-protocol-private>=5.95.1;libgeis;xrender>=0.9")
set (UNITY_PROTOCOL_PRIVATE_DEPS "unity-protocol-private>=5.95.1")
find_package (PkgConfig)
diff --git a/HACKING b/HACKING
index a2ac75320..997a53989 100644
--- a/HACKING
+++ b/HACKING
@@ -7,6 +7,7 @@ If you want to hack on unity you need the following packages
- gthread-2.0
- indicator
- atk
+ - libatk-adaptor
Or if you are on ubuntu run the command, apt-get build-dep unity
diff --git a/launcher/SwitcherController.cpp b/launcher/SwitcherController.cpp
index a4ecaf104..910c728d1 100644
--- a/launcher/SwitcherController.cpp
+++ b/launcher/SwitcherController.cpp
@@ -46,7 +46,7 @@ namespace switcher
Controller::Controller(unsigned int load_timeout)
: timeout_length(75)
, detail_on_timeout(true)
- , detail_timeout_length(250)
+ , detail_timeout_length(500)
, initial_detail_timeout_length(1500)
, construct_timeout_(load_timeout)
, main_layout_(nullptr)
diff --git a/manual-tests/Launcher.txt b/manual-tests/Launcher.txt
index be3e6e0fc..adc77fee5 100644
--- a/manual-tests/Launcher.txt
+++ b/manual-tests/Launcher.txt
@@ -63,23 +63,6 @@ Expected Result:
Verify each icon gets highlighted from top to bottom.
-Test Alt+F1 KeyNavMode Mouse Works
--------------------------------
-This test shows that the mouse still works normally while keynav mode is active.
-
-Setup:
-
-Actions:
-#. Press Alt+F1 to enter keynav mode
-#. Using the mouse perform a normal action (such as dragging a window)
-
-Expected Result:
- The keynav mode exits, along with the mouse performing the normal action
- the user expects. Such as highlighting text, moving a window, clicking out
- of keynav mode, or clicking on a launcher icon. All these actions should
- also exit the keynav mode.
-
-
Test Alt+F1 KeyNavMode Shortcuts
-----------------------------
This test shows that all the shortcuts work and also exits from keynav mode.
@@ -102,21 +85,6 @@ Expected Result:
closing the keynav mode.
-Test Alt+F1 NavMode Quicklist Click Exit
-----------------------------------------
-This Test shows that clicking on a quicklist option quits keynav mode.
-
-Setup:
-
-Actions:
-#. Press Alt+F1 to enter keynav mode
-#. Press Right arrow
-#. Click on any option
-
-Expected Result:
- No matter what option you click will exit keynav mode.
-
-
Drag Icons to Trash
-------------------
@@ -314,21 +282,6 @@ Expected Result:
compiz process should be much lower than 50.
-Test Quicklist while on Expo
------------------------------
-This test shows how the launcher quicklists work when the expo plugin is activated.
-
-Setup:
-#. Start with a clear screen
-#. Press Super+S or select the workspace switcher on the launcher
-
-Actions:
-#. When the workspace switcher is running, right-click over a launcher icon
-
-Expected Result:
- The expo should terminate, and the quicklist should be shown once the
- workspace switcher has been closed.
-
Test highlight BFB
-------------------
This test shows that the BFB launcher icon highlights during key navigation.
diff --git a/plugins/unityshell/src/unitya11y.cpp b/plugins/unityshell/src/unitya11y.cpp
index 9a8c143d9..1035af609 100644
--- a/plugins/unityshell/src/unitya11y.cpp
+++ b/plugins/unityshell/src/unitya11y.cpp
@@ -20,6 +20,7 @@
#include <gio/gio.h>
#include <gmodule.h>
#include <stdio.h>
+#include <atk-bridge.h>
#include "unitya11y.h"
#include "unitya11ytests.h"
@@ -62,12 +63,6 @@ static GHashTable* accessible_table = NULL;
static gboolean a11y_initialized = FALSE;
-#define INIT_METHOD "gnome_accessibility_module_init"
-#define DESKTOP_SCHEMA "org.gnome.desktop.interface"
-#define ACCESSIBILITY_ENABLED_KEY "toolkit-accessibility"
-#define AT_SPI_SCHEMA "org.a11y.atspi"
-#define ATK_BRIDGE_LOCATION_KEY "atk-bridge-location"
-
static void
unity_a11y_restore_environment(void)
{
@@ -82,102 +77,6 @@ load_unity_atk_util(nux::WindowThread* wt)
g_type_class_unref(g_type_class_ref(UNITY_TYPE_UTIL_ACCESSIBLE));
}
-/* This method is required because g_setting_new aborts if the schema
- is not present. */
-static gboolean
-has_gsettings_schema(const gchar* schema)
-{
- const char* const* list_schemas = NULL;
- gboolean found = FALSE;
- int i = 0;
-
- list_schemas = g_settings_list_schemas();
- for (i = 0; list_schemas [i]; i++)
- {
- if (!g_strcmp0(list_schemas[i], schema))
- {
- found = TRUE;
- break;
- }
- }
-
- return found;
-}
-
-static gboolean
-should_enable_a11y(void)
-{
- GSettings* desktop_settings = NULL;
- gboolean value = FALSE;
-
- if (!has_gsettings_schema(DESKTOP_SCHEMA))
- return FALSE;
-
- desktop_settings = g_settings_new(DESKTOP_SCHEMA);
- value = g_settings_get_boolean(desktop_settings, ACCESSIBILITY_ENABLED_KEY);
-
- g_object_unref(desktop_settings);
-
- return value;
-}
-
-static gchar*
-get_atk_bridge_path(void)
-{
- GSettings* atspi_settings = NULL;
- GVariant *variant = NULL;
- char* value = NULL;
-
- if (!has_gsettings_schema(AT_SPI_SCHEMA))
- return NULL;
-
- atspi_settings = g_settings_new(AT_SPI_SCHEMA);
- variant = g_settings_get_value (atspi_settings, ATK_BRIDGE_LOCATION_KEY);
- value = g_variant_dup_bytestring (variant, NULL);
-
- g_variant_unref (variant);
- g_object_unref(atspi_settings);
-
- return value;
-}
-
-static gboolean
-a11y_invoke_module(const char* module_path)
-{
- GModule* handle;
- void (*invoke_fn)(void);
-
- if (!module_path)
- {
- g_warning("Accessibility: invalid module path (NULL)");
-
- return FALSE;
- }
-
- if (!(handle = g_module_open(module_path, (GModuleFlags)0)))
- {
- g_warning("Accessibility: failed to load module '%s': '%s'",
- module_path, g_module_error());
-
- return FALSE;
- }
-
- if (!g_module_symbol(handle, INIT_METHOD, (gpointer*)&invoke_fn))
- {
- g_warning("Accessibility: error library '%s' does not include "
- "method '%s' required for accessibility support",
- module_path, INIT_METHOD);
- g_module_close(handle);
-
- return FALSE;
- }
-
- invoke_fn();
-
- return TRUE;
-}
-
-/********************************************************************************/
/*
* In order to avoid the atk-bridge loading and the GAIL
* initialization during the gtk_init, it is required to set some
@@ -194,35 +93,19 @@ unity_a11y_preset_environment(void)
/*
* Initializes the accessibility (ATK) support on Unity
*
- * It loads the atk-bridge if required. It checks:
- * * If the proper gsettings keys are set
- * * Loads the proper AtkUtil implementation
*/
void
unity_a11y_init(nux::WindowThread* wt)
{
- gchar* bridge_path = NULL;
-
- unity_a11y_restore_environment();
-
- if (!should_enable_a11y())
+ if (a11y_initialized)
return;
+ unity_a11y_restore_environment();
load_unity_atk_util(wt);
+ atk_bridge_adaptor_init(NULL, NULL);
+ atk_get_root();
- bridge_path = get_atk_bridge_path();
-
- if (a11y_invoke_module(bridge_path))
- {
- g_debug("Unity Oneiric accessibility started, using bridge on %s",
- bridge_path);
-
- atk_get_root();
-
- a11y_initialized = TRUE;
- }
-
- g_free(bridge_path);
+ a11y_initialized = TRUE;
// NOTE: we run the unit tests manually while developing by
// uncommenting this. Take a look at the explanation in the
diff --git a/services/CMakeLists.txt b/services/CMakeLists.txt
index 865aa4125..2da54dce0 100644
--- a/services/CMakeLists.txt
+++ b/services/CMakeLists.txt
@@ -2,7 +2,8 @@
# Panel Service
#
find_package(PkgConfig)
-pkg_check_modules(SERVICE_DEPS REQUIRED gtk+-3.0>=3.3 gobject-2.0 gio-2.0 gthread-2.0 indicator3-0.4>=0.4.90 x11)
+
+pkg_check_modules(SERVICE_DEPS REQUIRED gtk+-3.0>=3.3 gobject-2.0 gio-2.0 gthread-2.0 indicator3-0.4>=0.4.90 x11 atk-bridge-2.0)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator3-0.4 --variable indicatordir OUTPUT_VARIABLE _indicatordir OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator3-0.4 --variable iconsdir OUTPUT_VARIABLE _iconsdir OUTPUT_STRIP_TRAILING_WHITESPACE)
diff --git a/services/panel-a11y.c b/services/panel-a11y.c
index 6f870555b..a22b39b87 100644
--- a/services/panel-a11y.c
+++ b/services/panel-a11y.c
@@ -17,119 +17,16 @@
*/
#include <gio/gio.h>
+#include <atk-bridge.h>
#include "panel-a11y.h"
#include "panel-util-accessible.h"
static gboolean a11y_initialized = FALSE;
-#define INIT_METHOD "gnome_accessibility_module_init"
-#define DESKTOP_SCHEMA "org.gnome.desktop.interface"
-#define ACCESSIBILITY_ENABLED_KEY "toolkit-accessibility"
-#define AT_SPI_SCHEMA "org.a11y.atspi"
-#define ATK_BRIDGE_LOCATION_KEY "atk-bridge-location"
-
-
-/* This method is required because g_setting_new abort if the schema
- is not present. */
-static gboolean
-has_gsettings_schema (const gchar *schema)
-{
- const char * const *list_schemas = NULL;
- gboolean found = FALSE;
- int i = 0;
-
- list_schemas = g_settings_list_schemas ();
- for (i = 0; list_schemas [i]; i++)
- {
- if (!g_strcmp0 (list_schemas[i], schema))
- {
- found = TRUE;
- break;
- }
- }
-
- return found;
-}
-
-static gboolean
-should_enable_a11y (void)
-{
- GSettings *desktop_settings = NULL;
- gboolean value = FALSE;
-
- if (!has_gsettings_schema (DESKTOP_SCHEMA))
- return FALSE;
-
- desktop_settings = g_settings_new (DESKTOP_SCHEMA);
- value = g_settings_get_boolean (desktop_settings, ACCESSIBILITY_ENABLED_KEY);
-
- g_object_unref (desktop_settings);
-
- return value;
-}
-
-static gchar*
-get_atk_bridge_path (void)
-{
- GSettings *atspi_settings = NULL;
- GVariant *variant = NULL;
- char *value = NULL;
-
- if (!has_gsettings_schema (AT_SPI_SCHEMA))
- return NULL;
-
- atspi_settings = g_settings_new(AT_SPI_SCHEMA);
- variant = g_settings_get_value (atspi_settings, ATK_BRIDGE_LOCATION_KEY);
- value = g_variant_dup_bytestring (variant, NULL);
-
- g_variant_unref (variant);
- g_object_unref (atspi_settings);
-
- return value;
-}
-
-static gboolean
-a11y_invoke_module (const char *module_path)
-{
- GModule *handle;
- void (*invoke_fn) (void);
-
- if (!module_path)
- {
- g_warning ("Accessibility: invalid module path (NULL)");
-
- return FALSE;
- }
-
- if (!(handle = g_module_open (module_path, (GModuleFlags)0)))
- {
- g_warning ("Accessibility: failed to load module '%s': '%s'",
- module_path, g_module_error ());
-
- return FALSE;
- }
-
- if (!g_module_symbol (handle, INIT_METHOD, (gpointer *)&invoke_fn))
- {
- g_warning ("Accessibility: error library '%s' does not include "
- "method '%s' required for accessibility support",
- module_path, INIT_METHOD);
- g_module_close (handle);
-
- return FALSE;
- }
-
- invoke_fn ();
-
- return TRUE;
-}
-
void
panel_a11y_init (void)
{
- gchar *bridge_path = NULL;
-
if (a11y_initialized)
return;
@@ -137,20 +34,9 @@ panel_a11y_init (void)
g_unsetenv ("NO_AT_BRIDGE");
g_unsetenv ("NO_GAIL");
- if (!should_enable_a11y ())
- return;
-
/* Load PanelUtilAccessible class */
g_type_class_unref (g_type_class_ref (PANEL_TYPE_UTIL_ACCESSIBLE));
-
- bridge_path = get_atk_bridge_path ();
- if (a11y_invoke_module (bridge_path))
- {
- g_debug ("Unity accessibility started, using bridge on %s", bridge_path);
- }
-
- g_free (bridge_path);
- atk_get_root ();
+ atk_bridge_adaptor_init(NULL, NULL);
a11y_initialized = TRUE;
}
diff --git a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py
index 798283d21..f24a73c71 100644
--- a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py
+++ b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py
@@ -150,6 +150,27 @@ class LauncherIconsTests(LauncherTestCase):
self.assertThat(calc_icon, NotEquals(None))
self.assertThat(calc_icon.visible, Eventually(Equals(True)))
+ def test_right_click_on_icon_ends_expo(self):
+ """Right click on a launcher icon in expo mode must end the expo
+ and show the quicklist.
+
+ """
+ self.keybinding("expo/start")
+ self.addCleanup(self.keybinding, "expo/cancel")
+
+ bfb = self.launcher.model.get_bfb_icon()
+ self.mouse.move(bfb.center_x, bfb.center_y)
+ self.mouse.click(button=3)
+
+ self.assertThat(self.launcher_instance.quicklist_open, Eventually(Equals(True)))
+
+ monitor = self.screen_geo.get_primary_monitor()
+ self.panel = self.panels.get_panel_for_monitor(monitor)
+
+ # When workspace switcher is opened the panel title is "Ubuntu Desktop" so we check
+ # to make sure that workspace switcher end.
+ self.assertThat(self.panels.get_active_panel().title, Eventually(NotEquals("Ubuntu Desktop")))
+
class LauncherDragIconsBehavior(LauncherTestCase):
"""Tests dragging icons around the Launcher."""
diff --git a/tests/autopilot/unity/tests/launcher/test_keynav.py b/tests/autopilot/unity/tests/launcher/test_keynav.py
index cf4a79f4e..474463a30 100644
--- a/tests/autopilot/unity/tests/launcher/test_keynav.py
+++ b/tests/autopilot/unity/tests/launcher/test_keynav.py
@@ -198,3 +198,39 @@ class LauncherKeyNavTests(LauncherTestCase):
self.assertThat(self.hud.visible, Equals(False))
self.assertThat(self.launcher.key_nav_is_active, Equals(True))
+
+ def test_launcher_keynav_cancel_on_click_outside(self):
+ """A single click outside of launcher must cancel keynav."""
+ self.start_keynav_with_cleanup_cancel()
+
+ self.launcher_instance.move_mouse_to_right_of_launcher()
+ self.mouse.click()
+
+ self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(False)))
+
+ def test_launcher_keynav_cancel_on_click_icon(self):
+ """A single click on a launcher icon must cancel keynav."""
+ calc_win = self.start_app_window('Calculator', locale = 'C')
+ calc_app = calc_win.application
+ calc_icon = self.launcher.model.get_icon(desktop_id=calc_app.desktop_file)
+
+ self.start_keynav_with_cleanup_cancel()
+
+ self.launcher_instance.click_launcher_icon(calc_icon)
+
+ self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(False)))
+
+ def test_launcher_keynav_cancel_on_quicklist_activate(self):
+ """A single click on a quicklist item must cancel keynav."""
+ self.start_keynav_with_cleanup_cancel()
+ self.launcher_instance.key_nav_enter_quicklist()
+
+ bfb_icon = self.launcher.model.get_bfb_icon()
+ bfb_ql = bfb_icon.get_quicklist()
+
+ bfb_ql.click_item(bfb_ql.selected_item)
+ self.addCleanup(self.dash.ensure_hidden)
+
+ self.assertThat(self.dash.visible, Eventually(Equals(True)))
+ self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(False)))
+