summaryrefslogtreecommitdiff
path: root/gtk/a11y
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2020-11-11 17:43:44 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2020-11-11 18:33:15 +0000
commit3b2cd972d5ae60f93b5aa1a97bd0c9dab7dd60cb (patch)
tree5991855a045abc0fa433c0902b484250f8a7ef2a /gtk/a11y
parent428ec295981492f16da9efac52f126305735071c (diff)
downloadgtk+-3b2cd972d5ae60f93b5aa1a97bd0c9dab7dd60cb.tar.gz
a11y: Implement missing atspi.Component getters
Some of them are entirely innocuous, and we can easily provide values that match what GTK3 provides.
Diffstat (limited to 'gtk/a11y')
-rw-r--r--gtk/a11y/gtkatspicomponent.c19
-rw-r--r--gtk/a11y/gtkatspiprivate.h12
2 files changed, 28 insertions, 3 deletions
diff --git a/gtk/a11y/gtkatspicomponent.c b/gtk/a11y/gtkatspicomponent.c
index 2ab1ffc81c..7da968d1d1 100644
--- a/gtk/a11y/gtkatspicomponent.c
+++ b/gtk/a11y/gtkatspicomponent.c
@@ -26,7 +26,9 @@
#include "gtkatspiprivate.h"
#include "gtkatspiutilsprivate.h"
#include "gtkaccessibleprivate.h"
+#include "gtkpopover.h"
#include "gtkwidget.h"
+#include "gtkwindow.h"
#include "a11y/atspi/atspi-component.h"
@@ -194,11 +196,20 @@ component_handle_method (GDBusConnection *connection,
}
else if (g_strcmp0 (method_name, "GetLayer") == 0)
{
- g_dbus_method_invocation_return_error_literal (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "");
+ AtspiComponentLayer layer;
+
+ if (GTK_IS_WINDOW (widget))
+ layer = ATSPI_COMPONENT_LAYER_WINDOW;
+ else if (GTK_IS_POPOVER (widget))
+ layer = ATSPI_COMPONENT_LAYER_POPUP;
+ else
+ layer = ATSPI_COMPONENT_LAYER_WIDGET;
+
+ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(u)", layer));
}
else if (g_strcmp0 (method_name, "GetMDIZOrder") == 0)
{
- g_dbus_method_invocation_return_error_literal (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "");
+ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(n)", 0));
}
else if (g_strcmp0 (method_name, "GrabFocus") == 0)
{
@@ -206,7 +217,9 @@ component_handle_method (GDBusConnection *connection,
}
else if (g_strcmp0 (method_name, "GetAlpha") == 0)
{
- g_dbus_method_invocation_return_error_literal (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "");
+ double opacity = gtk_widget_get_opacity (widget);
+
+ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(d)", opacity));
}
else if (g_strcmp0 (method_name, "SetExtents") == 0)
{
diff --git a/gtk/a11y/gtkatspiprivate.h b/gtk/a11y/gtkatspiprivate.h
index 9d3d316354..036a41ef27 100644
--- a/gtk/a11y/gtkatspiprivate.h
+++ b/gtk/a11y/gtkatspiprivate.h
@@ -252,4 +252,16 @@ typedef enum {
ATSPI_COORD_TYPE_PARENT,
} AtspiCoordType;
+typedef enum {
+ ATSPI_COMPONENT_LAYER_INVALID,
+ ATSPI_COMPONENT_LAYER_BACKGROUND,
+ ATSPI_COMPONENT_LAYER_CANVAS,
+ ATSPI_COMPONENT_LAYER_WIDGET,
+ ATSPI_COMPONENT_LAYER_MDI,
+ ATSPI_COMPONENT_LAYER_POPUP,
+ ATSPI_COMPONENT_LAYER_OVERLAY,
+ ATSPI_COMPONENT_LAYER_WINDOW
+} AtspiComponentLayer;
+
+
G_END_DECLS