Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:mgorse:branches:GNOME:Next
at-spi2-core
174.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 174.patch of Package at-spi2-core
From 33642e2601228077d96cf7b136318587ae88ad62 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi <ebassi@gnome.org> Date: Wed, 20 Nov 2024 17:04:07 +0000 Subject: [PATCH] Use the appropriate annotations for callbacks The (closure) and (destroy) annotations are meant to be used on the callback argument, and refer to the arguments that contain the data to be passed to the callback, and the notification function, respectively. The unary (closure) annotation is meant to be used to describe the user data on a callback type definition. The "notified" scope is needed for callbacks that have a destroy notification function; if there is no notification function, and the callback is invoked after the function returns, then the correct scope is "async". See: https://gi.readthedocs.io/en/latest/annotations/giannotations.html#support-for-gobject-closures --- atspi/atspi-device-listener.c | 19 +++++++------- atspi/atspi-device-listener.h | 11 ++++---- atspi/atspi-device.c | 9 +++---- atspi/atspi-event-listener.c | 48 ++++++++++++++++++----------------- atspi/atspi-registry.c | 6 ++--- 5 files changed, 48 insertions(+), 45 deletions(-) diff --git a/atspi/atspi-device-listener.c b/atspi/atspi-device-listener.c index d575b0787..971df3639 100644 --- a/atspi/atspi-device-listener.c +++ b/atspi/atspi-device-listener.c @@ -217,12 +217,12 @@ G_DEFINE_TYPE (AtspiDeviceListener, atspi_device_listener, G_TYPE_OBJECT) /** * atspi_device_listener_new: - * @callback: (scope notified): an #AtspiDeviceListenerCB callback function, - * or NULL. - * @user_data: (closure): a pointer to data which will be passed to the - * callback when invoked. + * @callback: (scope notified) (closure user_data) (destroy callback_destroyed) (nullable): an + * #AtspiDeviceListenerCB callback function, or NULL. + * @user_data: a pointer to data which will be passed to the + * callback when invoked. * @callback_destroyed: A #GDestroyNotify called when the listener is freed - * and data associated with the callback should be freed. It can be NULL. + * and data associated with the callback should be freed. It can be NULL. * * Creates a new #AtspiDeviceListener with a specified callback function. * @@ -266,11 +266,12 @@ atspi_device_listener_new_simple (AtspiDeviceListenerSimpleCB callback, /** * atspi_device_listener_add_callback: * @listener: the #AtspiDeviceListener instance to modify. - * @callback: (scope notified): an #AtspiDeviceListenerCB function pointer. + * @callback: (scope notified) (closure user_data) (destroy callback_destroyed): an + * #AtspiDeviceListenerCB function pointer. * @callback_destroyed: A #GDestroyNotify called when the listener is freed - * and data associated with the callback should be freed. It can be NULL. - * @user_data: (closure): a pointer to data which will be passed to the - * callback when invoked. + * and data associated with the callback should be freed. It can be NULL. + * @user_data: a pointer to data which will be passed to the + * callback when invoked. * * Adds an in-process callback function to an existing #AtspiDeviceListener. * diff --git a/atspi/atspi-device-listener.h b/atspi/atspi-device-listener.h index f8d12c16d..411f6e62c 100644 --- a/atspi/atspi-device-listener.h +++ b/atspi/atspi-device-listener.h @@ -37,13 +37,14 @@ GType atspi_device_event_get_type (void); /** * AtspiDeviceListenerCB: * @stroke: (transfer full): The #AtspiDeviceEvent for which notification is - * being received. - * @user_data: Data which is passed to the client each time this callback is notified. + * being received. + * @user_data: (closure): Data which is passed to the client each time this callback is notified. * * A callback function prototype via which clients receive device event notifications. * - * Returns: #TRUE if the client wishes to consume/preempt the event, preventing it from being - * relayed to the currently focussed application, #FALSE if the event delivery should proceed as normal. + * Returns: %TRUE if the client wishes to consume/preempt the event, + * preventing it from being relayed to the currently focussed application, + * %FALSE if the event delivery should proceed as normal **/ typedef gboolean (*AtspiDeviceListenerCB) (AtspiDeviceEvent *stroke, void *user_data); @@ -51,7 +52,7 @@ typedef gboolean (*AtspiDeviceListenerCB) (AtspiDeviceEvent *stroke, /** * AtspiDeviceListenerSimpleCB: * @stroke: (transfer full): The #AtspiDeviceEvent for which notification is - * being received. + * being received. * * Similar to #AtspiDeviceListenerCB, but with no user data. * diff --git a/atspi/atspi-device.c b/atspi/atspi-device.c index e6c2c0d22..fbf34f75a 100644 --- a/atspi/atspi-device.c +++ b/atspi/atspi-device.c @@ -249,11 +249,10 @@ atspi_device_remove_key_grab (AtspiDevice *device, guint id) /** *atspi_device_add_key_watcher: * @device: the device. - * @callback: (scope notified): the function to call when the given key is - * pressed. - * @user_data: (closure callback): Data to be passed to @callback. - * @callback_destroyed: (destroy callback): callback function to be called - * when @callback is destroyed. + * @callback: (scope notified) (closure user_data) (destroy callback_destroyed): the + * function to call when the given key is pressed. + * @user_data: Data to be passed to @callback. + * @callback_destroyed: callback function to be called when @callback is destroyed. * * Add a callback that will receive a notification whenever a key is * pressed or released. diff --git a/atspi/atspi-event-listener.c b/atspi/atspi-event-listener.c index 20ba04362..789eed9d5 100644 --- a/atspi/atspi-event-listener.c +++ b/atspi/atspi-event-listener.c @@ -133,11 +133,11 @@ callback_unref (gpointer callback) /** * atspi_event_listener_new: - * @callback: (scope notified): An #AtspiEventListenerCB to be called - * when an event is fired. - * @user_data: (closure): data to pass to the callback. + * @callback: (scope notified) (destroy callback_destroyed) (closure user_data): an + * #AtspiEventListenerCB to be called when an event is fired. + * @user_data: data to pass to the callback. * @callback_destroyed: A #GDestroyNotify called when the listener is freed - * and data associated with the callback should be freed. Can be NULL. + * and data associated with the callback should be freed. Can be NULL. * * Creates a new #AtspiEventListener associated with a specified @callback. * @@ -656,13 +656,13 @@ notify_event_registered (EventListenerEntry *e) /** * atspi_event_listener_register_from_callback: - * @callback: (scope notified): the #AtspiEventListenerCB to be registered - * against an event type. - * @user_data: (closure): User data to be passed to the callback. + * @callback: (scope notified) (closure user_data) (destroy callback_destroyed): the + * #AtspiEventListenerCB to be registered against an event type. + * @user_data: User data to be passed to the callback. * @callback_destroyed: A #GDestroyNotify called when the callback is destroyed. * @event_type: a character string indicating the type of events for which - * notification is requested. See #atspi_event_listener_register - * for a description of the format. + * notification is requested. See atspi_event_listener_register() + * for a description of the format. * * Registers an #AtspiEventListenerCB against an @event_type. * @@ -702,11 +702,12 @@ copy_event_properties (GArray *src) /** * atspi_event_listener_register_from_callback_full: - * @callback: (scope async): an #AtspiEventListenerCB function pointer. - * @user_data: (closure callback) - * @callback_destroyed: (destroy callback) + * @callback: (scope notified) (closure user_data) (destroy callback_destroyed): an + * #AtspiEventListenerCB function pointer. + * @user_data: + * @callback_destroyed: * @event_type: - * @properties: (element-type utf8) + * @properties: (element-type utf8): * @error: * * Returns: #TRUE if successful, otherwise #FALSE. @@ -729,12 +730,13 @@ atspi_event_listener_register_from_callback_full (AtspiEventListenerCB callback, /** * atspi_event_listener_register_from_callback_with_app: - * @callback: (scope async): an #AtspiEventListenerCB function pointer. - * @user_data: (closure callback) - * @callback_destroyed: (destroy callback) + * @callback: (scope notified) (closure user_data) (destroy callback_destroyed): an + * #AtspiEventListenerCB function pointer. + * @user_data: + * @callback_destroyed: * @event_type: - * @properties: (element-type utf8) - * @app: (allow-none) + * @properties: (element-type utf8): + * @app: (nullable): * @error: * * Returns: #TRUE if successful, otherwise #FALSE. @@ -877,14 +879,14 @@ atspi_event_listener_deregister (AtspiEventListener *listener, /** * atspi_event_listener_deregister_from_callback: - * @callback: (scope call): the #AtspiEventListenerCB registered against an - * event type. - * @user_data: (closure): User data that was passed in for this callback. + * @callback: (scope call) (closure user_data): the #AtspiEventListenerCB + * registered against an event type. + * @user_data: User data that was passed in for this callback. * @event_type: a string specifying the event type for which this - * listener is to be deregistered. + * listener is to be deregistered. * * Deregisters an #AtspiEventListenerCB from the registry, for a specific - * event type. + * event type. * * Returns: #TRUE if successful, otherwise #FALSE. **/ diff --git a/atspi/atspi-registry.c b/atspi/atspi-registry.c index a1c932593..53f1f2a09 100644 --- a/atspi/atspi-registry.c +++ b/atspi/atspi-registry.c @@ -488,10 +488,10 @@ atspi_generate_mouse_event_cb (DBusPendingCall *pending, void *user_data) * @y: a #glong indicating the screen y coordinate of the mouse event. * @name: a string indicating which mouse event to be synthesized * (e.g. "b1p", "b1c", "b2r", "rel", "abs"). - * @callback: (scope notified) (allow-none): a callback to be called when a + * @callback: (scope async) (closure callback_data): a callback to be called when a * reply is received. May be NULL. - * @callback_data: (closure) (allow-none): data to be passed to @callback. - * @error: (allow-none): a pointer to a %NULL #GError pointer, or %NULL + * @callback_data: data to be passed to @callback. + * @error: a pointer to a %NULL #GError pointer, or %NULL * * Like atspi_generate_mouse_event, but asynchronous. **/ -- GitLab
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor