From ec028553d3964fc3d389663bb495f48d5b0f33cf Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Mon, 5 Aug 2024 15:04:38 +0200 Subject: [PATCH] accessibility: Set various accessible names For actors that are created by libmutter itself. Although, not sure if such names should be translatable? Part-of: --- clutter/clutter/clutter-scroll-actor.c | 7 +++++-- src/backends/meta-stage.c | 1 + src/compositor/compositor.c | 9 +++++++++ src/compositor/meta-background-actor.c | 1 + src/compositor/meta-background-group.c | 4 +++- src/compositor/meta-dnd-actor.c | 1 + src/compositor/meta-surface-actor-wayland.c | 4 +++- src/compositor/meta-surface-actor-x11.c | 1 + src/compositor/meta-window-actor-wayland.c | 1 + src/compositor/meta-window-drag.c | 2 ++ src/compositor/plugins/default.c | 2 ++ 11 files changed, 29 insertions(+), 4 deletions(-) diff --git a/clutter/clutter/clutter-scroll-actor.c b/clutter/clutter/clutter-scroll-actor.c index 34a6fa6c3..5854569d2 100644 --- a/clutter/clutter/clutter-scroll-actor.c +++ b/clutter/clutter/clutter-scroll-actor.c @@ -21,7 +21,7 @@ /** * ClutterScrollActor: - * + * * An actor for displaying a portion of its children * * #ClutterScrollActor is an actor that can be used to display a portion @@ -266,7 +266,10 @@ clutter_animatable_iface_init (ClutterAnimatableInterface *iface) ClutterActor * clutter_scroll_actor_new (void) { - return g_object_new (CLUTTER_TYPE_SCROLL_ACTOR, NULL); + return g_object_new (CLUTTER_TYPE_SCROLL_ACTOR, + "accessible-name", "Scroll actor", + "accessible-role", ATK_ROLE_SCROLL_PANE, + NULL); } /** diff --git a/src/backends/meta-stage.c b/src/backends/meta-stage.c index 5be38df09..d271ec480 100644 --- a/src/backends/meta-stage.c +++ b/src/backends/meta-stage.c @@ -337,6 +337,7 @@ meta_stage_new (MetaBackend *backend) stage = g_object_new (META_TYPE_STAGE, "context", meta_backend_get_clutter_context (backend), + "accessible-name", "Main stage", NULL); stage->backend = backend; diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index a9ef73691..5411475e3 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -334,8 +334,11 @@ meta_compositor_manage (MetaCompositor *compositor, compositor); priv->window_group = meta_window_group_new (display); + clutter_actor_set_accessible_name (priv->window_group, "Window group"); priv->top_window_group = meta_window_group_new (display); + clutter_actor_set_accessible_name (priv->top_window_group, "Top window group"); priv->feedback_group = meta_window_group_new (display); + clutter_actor_set_accessible_name (priv->feedback_group, "Feedback group"); clutter_actor_add_child (stage, priv->window_group); clutter_actor_add_child (stage, priv->top_window_group); @@ -379,18 +382,21 @@ meta_compositor_add_window (MetaCompositor *compositor, MetaWindowActor *window_actor; ClutterActor *window_group; GType window_actor_type = G_TYPE_INVALID; + const char *accessible_name = NULL; switch (window->client_type) { #ifdef HAVE_X11_CLIENT case META_WINDOW_CLIENT_TYPE_X11: window_actor_type = META_TYPE_WINDOW_ACTOR_X11; + accessible_name = "X11 window"; break; #endif #ifdef HAVE_WAYLAND case META_WINDOW_CLIENT_TYPE_WAYLAND: window_actor_type = META_TYPE_WINDOW_ACTOR_WAYLAND; + accessible_name = "Wayland window"; break; #endif @@ -400,6 +406,7 @@ meta_compositor_add_window (MetaCompositor *compositor, window_actor = g_object_new (window_actor_type, "meta-window", window, + "accessible-name", accessible_name, "show-on-set-parent", FALSE, NULL); @@ -1331,6 +1338,7 @@ meta_compositor_flash_display (MetaCompositor *compositor, clutter_actor_get_size (stage, &width, &height); flash = clutter_actor_new (); + clutter_actor_set_accessible_name (flash, "Flash actor"); clutter_actor_set_background_color (flash, &COGL_COLOR_INIT (0, 0, 0, 255)); clutter_actor_set_size (flash, width, height); clutter_actor_set_opacity (flash, 0); @@ -1370,6 +1378,7 @@ meta_compositor_flash_window (MetaCompositor *compositor, ClutterTransition *transition; flash = clutter_actor_new (); + clutter_actor_set_accessible_name (flash, "Flash actor"); clutter_actor_set_background_color (flash, &COGL_COLOR_INIT (0, 0, 0, 255)); clutter_actor_set_size (flash, window->rect.width, window->rect.height); clutter_actor_set_position (flash, diff --git a/src/compositor/meta-background-actor.c b/src/compositor/meta-background-actor.c index 85c0cba8f..71591a7e0 100644 --- a/src/compositor/meta-background-actor.c +++ b/src/compositor/meta-background-actor.c @@ -157,6 +157,7 @@ meta_background_actor_new (MetaDisplay *display, self = g_object_new (META_TYPE_BACKGROUND_ACTOR, "meta-display", display, "monitor", monitor, + "accessible-name", "Background actor", NULL); return CLUTTER_ACTOR (self); diff --git a/src/compositor/meta-background-group.c b/src/compositor/meta-background-group.c index 0c226ca8b..66606d016 100644 --- a/src/compositor/meta-background-group.c +++ b/src/compositor/meta-background-group.c @@ -60,7 +60,9 @@ meta_background_group_new (void) { MetaBackgroundGroup *background_group; - background_group = g_object_new (META_TYPE_BACKGROUND_GROUP, NULL); + background_group = g_object_new (META_TYPE_BACKGROUND_GROUP, + "accessible-name", "Background group", + NULL); return CLUTTER_ACTOR (background_group); } diff --git a/src/compositor/meta-dnd-actor.c b/src/compositor/meta-dnd-actor.c index af0b640cc..8b6119bf4 100644 --- a/src/compositor/meta-dnd-actor.c +++ b/src/compositor/meta-dnd-actor.c @@ -161,6 +161,7 @@ meta_dnd_actor_new (MetaCompositor *compositor, "drag-origin", drag_origin, "drag-start-x", drag_start_x, "drag-start-y", drag_start_y, + "accessible-name", "Drag and drop actor", NULL); return CLUTTER_ACTOR (self); diff --git a/src/compositor/meta-surface-actor-wayland.c b/src/compositor/meta-surface-actor-wayland.c index d20ed5523..00b64b6ec 100644 --- a/src/compositor/meta-surface-actor-wayland.c +++ b/src/compositor/meta-surface-actor-wayland.c @@ -316,7 +316,9 @@ meta_surface_actor_wayland_init (MetaSurfaceActorWayland *self) MetaSurfaceActor * meta_surface_actor_wayland_new (MetaWaylandSurface *surface) { - MetaSurfaceActorWayland *self = g_object_new (META_TYPE_SURFACE_ACTOR_WAYLAND, NULL); + MetaSurfaceActorWayland *self = g_object_new (META_TYPE_SURFACE_ACTOR_WAYLAND, + "accessible-name", "Wayland surface", + NULL); g_assert (meta_is_wayland_compositor ()); diff --git a/src/compositor/meta-surface-actor-x11.c b/src/compositor/meta-surface-actor-x11.c index 954361316..90d5aaecc 100644 --- a/src/compositor/meta-surface-actor-x11.c +++ b/src/compositor/meta-surface-actor-x11.c @@ -419,6 +419,7 @@ meta_surface_actor_x11_new (MetaWindow *window) sync_unredirected (self); clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); + clutter_actor_set_accessible_name (CLUTTER_ACTOR (self), "X11 surface"); return META_SURFACE_ACTOR (self); } diff --git a/src/compositor/meta-window-actor-wayland.c b/src/compositor/meta-window-actor-wayland.c index d191fe370..2af094e34 100644 --- a/src/compositor/meta-window-actor-wayland.c +++ b/src/compositor/meta-window-actor-wayland.c @@ -74,6 +74,7 @@ surface_container_new (MetaWindowActor *window_actor) MetaSurfaceContainerActorWayland *surface_container; surface_container = g_object_new (META_TYPE_SURFACE_CONTAINER_ACTOR_WAYLAND, + "accessible-name", "Wayland surface container", NULL); surface_container->window_actor = window_actor; diff --git a/src/compositor/meta-window-drag.c b/src/compositor/meta-window-drag.c index 94d7b98b3..4d195437b 100644 --- a/src/compositor/meta-window-drag.c +++ b/src/compositor/meta-window-drag.c @@ -1845,6 +1845,8 @@ meta_window_drag_begin (MetaWindowDrag *window_drag, window_drag->handler = clutter_actor_new (); clutter_actor_set_name (window_drag->handler, "Window drag helper"); + clutter_actor_set_accessible_name (window_drag->handler, + "Window drag helper"); g_signal_connect_swapped (window_drag->handler, "event", G_CALLBACK (on_window_drag_event), window_drag); clutter_actor_add_child (stage, window_drag->handler); diff --git a/src/compositor/plugins/default.c b/src/compositor/plugins/default.c index ee69765f3..2d9b61b58 100644 --- a/src/compositor/plugins/default.c +++ b/src/compositor/plugins/default.c @@ -493,7 +493,9 @@ switch_workspace (MetaPlugin *plugin, &screen_height); workspace1 = clutter_actor_new (); + clutter_actor_set_accessible_name (workspace1, "Workspace 1"); workspace2 = clutter_actor_new (); + clutter_actor_set_accessible_name (workspace2, "Workspace 2"); clutter_actor_set_pivot_point (workspace1, 1.0, 1.0); clutter_actor_set_size (workspace1,