[at-spi2-core] Add an "announcement" event/signal to allow objects to send notifications
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core] Add an "announcement" event/signal to allow objects to send notifications
- Date: Thu, 4 Aug 2022 17:39:43 +0000 (UTC)
commit 26835da29918be2c0da6c08fb70d893de22891d2
Author: Mike Gorse <mgorse suse com>
Date: Thu Aug 4 12:38:27 2022 -0500
Add an "announcement" event/signal to allow objects to send notifications
Fixes #63
atk-adaptor/event.c | 24 ++++++++++++++++++++++++
atk/atkobject.c | 19 +++++++++++++++++++
atspi/atspi-device-legacy.c | 2 +-
atspi/atspi-event-listener.c | 1 +
atspi/meson.build | 2 ++
xml/Event.xml | 3 +++
6 files changed, 50 insertions(+), 1 deletion(-)
---
diff --git a/atk-adaptor/event.c b/atk-adaptor/event.c
index a3e1a060..201962a2 100644
--- a/atk-adaptor/event.c
+++ b/atk-adaptor/event.c
@@ -886,6 +886,28 @@ active_descendant_event_listener (GSignalInvocationHint * signal_hint,
return TRUE;
}
+static gboolean
+announcement_event_listener (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values, gpointer data)
+{
+ AtkObject *accessible;
+ gchar *text;
+ GSignalQuery signal_query;
+ const gchar *name;
+
+ g_signal_query (signal_hint->signal_id, &signal_query);
+ name = signal_query.signal_name;
+
+ accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
+ text = g_value_get_string (¶m_values[1]);
+ g_return_val_if_fail (text != NULL, TRUE);
+
+ emit_event (accessible, ITF_EVENT_OBJECT, name, "", 0, 0,
+ "s", text, append_basic);
+ return TRUE;
+}
+
/*---------------------------------------------------------------------------*/
/*
@@ -1290,6 +1312,8 @@ spi_atk_register_event_listeners (void)
/* TODO */
add_signal_listener (active_descendant_event_listener,
"Gtk:AtkObject:active-descendant-changed");
+ add_signal_listener (announcement_event_listener,
+ "Gtk:AtkObject:announcement");
add_signal_listener (bounds_event_listener,
"Gtk:AtkComponent:bounds-changed");
add_signal_listener (text_selection_changed_event_listener,
diff --git a/atk/atkobject.c b/atk/atkobject.c
index 39823aaf..8b6ad0c0 100644
--- a/atk/atkobject.c
+++ b/atk/atkobject.c
@@ -89,6 +89,7 @@ enum {
STATE_CHANGE,
VISIBLE_DATA_CHANGED,
ACTIVE_DESCENDANT_CHANGED,
+ ANNOUNCEMENT,
LAST_SIGNAL
};
@@ -684,6 +685,24 @@ atk_object_class_init (AtkObjectClass *klass)
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE,
1, G_TYPE_POINTER);
+
+ /**
+ * AtkObject::announcement
+ * @atkobject: the object which received the signal.
+ * @arg1: (type gchar *): the text to be announced.
+ *
+ * The "announcement" signal can be emitted to pass an announcement on to
+ * be read by a screen reader.
+ */
+ atk_object_signals[ANNOUNCEMENT] =
+ g_signal_new ("announcement",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, /* no class handler in order to avoid breaking ABI */
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE,
+ 1, G_TYPE_STRING);
}
static void
diff --git a/atspi/atspi-device-legacy.c b/atspi/atspi-device-legacy.c
index bfb63d4b..eec11378 100644
--- a/atspi/atspi-device-legacy.c
+++ b/atspi/atspi-device-legacy.c
@@ -86,7 +86,7 @@ set_virtual_modifier (AtspiDeviceLegacy *legacy_device, gint keycode, gboolean e
}
-gboolean
+static gboolean
key_cb (AtspiDeviceEvent *event, void *user_data)
{
AtspiDeviceLegacy *legacy_device = ATSPI_DEVICE_LEGACY (user_data);
diff --git a/atspi/atspi-event-listener.c b/atspi/atspi-event-listener.c
index 68eb921e..8b172434 100644
--- a/atspi/atspi-event-listener.c
+++ b/atspi/atspi-event-listener.c
@@ -461,6 +461,7 @@ listener_entry_free (EventListenerEntry *e)
* object:column-deleted
* object:model-changed
* object:active-descendant-changed
+ * object:announcement
*
* (screen reader events)
* screen-reader:region-changed
diff --git a/atspi/meson.build b/atspi/meson.build
index bd8dbb19..592ed0b3 100644
--- a/atspi/meson.build
+++ b/atspi/meson.build
@@ -7,6 +7,7 @@ atspi_sources = [
'atspi-device.c',
'atspi-device-legacy.c',
'atspi-device-listener.c',
+ 'atspi-device-mutter.c',
'atspi-document.c',
'atspi-editabletext.c',
'atspi-event-listener.c',
@@ -39,6 +40,7 @@ atspi_headers = [
'atspi-device.h',
'atspi-device-legacy.h',
'atspi-device-listener.h',
+ 'atspi-device-mutter.h',
'atspi-document.h',
'atspi-editabletext.h',
'atspi-event-listener.h',
diff --git a/xml/Event.xml b/xml/Event.xml
index 9f78c8e4..0e3e563b 100644
--- a/xml/Event.xml
+++ b/xml/Event.xml
@@ -35,6 +35,9 @@
<signal name="ActiveDescendantChanged"><arg type="(suuv)"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiEvent"/>
</signal>
+ <signal name="Announcement"><arg type="(suuv)"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiEvent"/>
+ </signal>
<signal name="RowInserted"><arg type="(suuv)"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiEvent"/>
</signal>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]