a11y: Return the ATSPI role for the root element

This commit is contained in:
Emmanuele Bassi 2020-10-09 14:49:10 +01:00
parent d7ebf18723
commit e6c5d57ffe
2 changed files with 168 additions and 0 deletions

160
gtk/a11y/gtkatspiprivate.h Normal file
View File

@ -0,0 +1,160 @@
/* gtkatspiprivate.h: AT-SPI shared types
*
* Copyright 2020 GNOME Foundation
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <glib.h>
G_BEGIN_DECLS
typedef enum {
ATSPI_ROLE_INVALID,
ATSPI_ROLE_ACCELERATOR_LABEL,
ATSPI_ROLE_ALERT,
ATSPI_ROLE_ANIMATION,
ATSPI_ROLE_ARROW,
ATSPI_ROLE_CALENDAR,
ATSPI_ROLE_CANVAS,
ATSPI_ROLE_CHECK_BOX,
ATSPI_ROLE_CHECK_MENU_ITEM,
ATSPI_ROLE_COLOR_CHOOSER,
ATSPI_ROLE_COLUMN_HEADER,
ATSPI_ROLE_COMBO_BOX,
ATSPI_ROLE_DATE_EDITOR,
ATSPI_ROLE_DESKTOP_ICON,
ATSPI_ROLE_DESKTOP_FRAME,
ATSPI_ROLE_DIAL,
ATSPI_ROLE_DIALOG,
ATSPI_ROLE_DIRECTORY_PANE,
ATSPI_ROLE_DRAWING_AREA,
ATSPI_ROLE_FILE_CHOOSER,
ATSPI_ROLE_FILLER,
ATSPI_ROLE_FOCUS_TRAVERSABLE,
ATSPI_ROLE_FONT_CHOOSER,
ATSPI_ROLE_FRAME,
ATSPI_ROLE_GLASS_PANE,
ATSPI_ROLE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ROLE_FOOTNOTE,
ATSPI_ROLE_CONTENT_DELETION,
ATSPI_ROLE_CONTENT_INSERTION,
ATSPI_ROLE_MARK,
ATSPI_ROLE_SUGGESTION,
ATSPI_ROLE_LAST_DEFINED,
} AtspiRole;
G_END_DECLS

View File

@ -22,6 +22,8 @@
#include "gtkatspirootprivate.h"
#include "gtkatspiprivate.h"
#include "gtkdebug.h"
#include "gtkwindow.h"
@ -210,6 +212,12 @@ handle_accessible_method (GDBusConnection *connection,
g_printerr ("[Accessible] Method '%s' on interface '%s' for object '%s' from '%s'\n",
method_name, interface_name, object_path, sender);
if (g_strcmp0 (method_name, "GetRole") == 0)
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(u)", ATSPI_ROLE_APPLICATION));
else if (g_strcmp0 (method_name, "GetRoleName") == 0)
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", "application"));
else if (g_strcmp0 (method_name, "GetLocalizedRoleName") == 0)
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", "application"));
}
static GVariant *