mirror of
https://github.com/elementary/gala.git
synced 2024-11-24 18:56:15 +01:00
WindowSwitcher: set accessible properties (#2030)
This commit is contained in:
parent
70e4642f89
commit
be8b8a3a60
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -31,7 +31,7 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
apt update
|
||||
apt install -y gettext gnome-settings-daemon-dev gsettings-desktop-schemas-dev libcanberra-dev libclutter-1.0-dev libgee-0.8-dev libglib2.0-dev libgnome-desktop-3-dev libgranite-dev libgtk-3-dev ${{ matrix.mutter_pkg }} libxml2-utils libsqlite3-dev meson valac valadoc
|
||||
apt install -y gettext gsettings-desktop-schemas-dev libatk-bridge2.0-dev libcanberra-dev libclutter-1.0-dev libgee-0.8-dev libglib2.0-dev libgnome-desktop-3-dev libgranite-dev libgtk-3-dev ${{ matrix.mutter_pkg }} libxml2-utils libsqlite3-dev meson valac valadoc
|
||||
- name: Build
|
||||
env:
|
||||
DESTDIR: out
|
||||
|
@ -13,6 +13,7 @@ basic_command = [
|
||||
'--package-version', '0.0.0',
|
||||
'--driver', vala.version(),
|
||||
mutter_packages_command,
|
||||
'--pkg', 'atk-bridge-2.0',
|
||||
'--pkg', 'gnome-desktop-3.0',
|
||||
'--pkg', 'gtk+-3.0',
|
||||
'--pkg', 'gee-0.8',
|
||||
|
@ -79,6 +79,7 @@ add_project_arguments([
|
||||
glib_version_required = '2.74.0'
|
||||
gtk_version_required = '3.10.0'
|
||||
|
||||
atk_bridge_dep = dependency('atk-bridge-2.0')
|
||||
canberra_dep = dependency('libcanberra')
|
||||
glib_dep = dependency('glib-2.0', version: '>= @0@'.format(glib_version_required))
|
||||
gobject_dep = dependency('gobject-2.0', version: '>= @0@'.format(glib_version_required))
|
||||
@ -170,7 +171,7 @@ endif
|
||||
add_project_arguments(vala_flags, language: 'vala')
|
||||
add_project_link_arguments(['-Wl,-rpath,@0@'.format(mutter_typelib_dir)], language: 'c')
|
||||
|
||||
gala_base_dep = [canberra_dep, glib_dep, gobject_dep, gio_dep, gio_unix_dep, gmodule_dep, gee_dep, gtk_dep, mutter_dep, gnome_desktop_dep, m_dep, posix_dep, sqlite3_dep, config_dep]
|
||||
gala_base_dep = [atk_bridge_dep, canberra_dep, glib_dep, gobject_dep, gio_dep, gio_unix_dep, gmodule_dep, gee_dep, gtk_dep, mutter_dep, gnome_desktop_dep, m_dep, posix_dep, sqlite3_dep, config_dep]
|
||||
|
||||
if get_option('systemd')
|
||||
gala_base_dep += systemd_dep
|
||||
|
@ -42,6 +42,7 @@ public class Gala.WindowSwitcher : CanvasActor {
|
||||
_current_icon = value;
|
||||
if (_current_icon != null) {
|
||||
_current_icon.selected = true;
|
||||
_current_icon.grab_key_focus ();
|
||||
}
|
||||
|
||||
update_caption_text ();
|
||||
@ -69,6 +70,9 @@ public class Gala.WindowSwitcher : CanvasActor {
|
||||
#endif
|
||||
};
|
||||
|
||||
get_accessible ().accessible_name = _("Window switcher");
|
||||
container.get_accessible ().accessible_role = LIST;
|
||||
|
||||
caption = new Clutter.Text () {
|
||||
font_name = CAPTION_FONT_NAME,
|
||||
ellipsize = END,
|
||||
@ -78,6 +82,7 @@ public class Gala.WindowSwitcher : CanvasActor {
|
||||
add_child (container);
|
||||
add_child (caption);
|
||||
|
||||
reactive = true;
|
||||
visible = false;
|
||||
opacity = 0;
|
||||
layout_manager = new Clutter.BoxLayout () {
|
||||
@ -355,6 +360,7 @@ public class Gala.WindowSwitcher : CanvasActor {
|
||||
|
||||
private void add_icon (WindowSwitcherIcon icon) {
|
||||
container.add_child (icon);
|
||||
icon.get_accessible ().accessible_parent = container.get_accessible ();
|
||||
|
||||
icon.motion_event.connect ((_icon, event) => {
|
||||
if (current_icon != _icon && !handling_gesture) {
|
||||
@ -404,6 +410,7 @@ public class Gala.WindowSwitcher : CanvasActor {
|
||||
push_modal ();
|
||||
} else {
|
||||
wm.pop_modal (modal_proxy);
|
||||
get_stage ().set_key_focus (null);
|
||||
}
|
||||
|
||||
save_easing_state ();
|
||||
|
@ -40,6 +40,10 @@ public class Gala.WindowSwitcherIcon : CanvasActor {
|
||||
icon.add_constraint (new Clutter.AlignConstraint (this, Clutter.AlignAxis.BOTH, 0.5f));
|
||||
add_child (icon);
|
||||
|
||||
get_accessible ().accessible_name = window.title;
|
||||
get_accessible ().accessible_role = LIST_ITEM;
|
||||
get_accessible ().notify_state_change (Atk.StateType.FOCUSABLE, true);
|
||||
|
||||
reactive = true;
|
||||
|
||||
this.scale_factor = scale_factor;
|
||||
@ -76,5 +80,8 @@ public class Gala.WindowSwitcherIcon : CanvasActor {
|
||||
|
||||
ctx.restore ();
|
||||
}
|
||||
|
||||
get_accessible ().notify_state_change (Atk.StateType.SELECTED, selected);
|
||||
get_accessible ().notify_state_change (Atk.StateType.FOCUSED, selected);
|
||||
}
|
||||
}
|
||||
|
@ -149,6 +149,8 @@ namespace Gala {
|
||||
|
||||
show_stage ();
|
||||
|
||||
init_a11y ();
|
||||
|
||||
AccessDialog.watch_portal ();
|
||||
|
||||
unowned Meta.Display display = get_display ();
|
||||
@ -379,6 +381,15 @@ namespace Gala {
|
||||
});
|
||||
}
|
||||
|
||||
private void init_a11y () {
|
||||
if (!Clutter.get_accessibility_enabled ()) {
|
||||
warning ("Clutter has no accessibility enabled");
|
||||
return;
|
||||
}
|
||||
|
||||
AtkBridge.adaptor_init (0, {});
|
||||
}
|
||||
|
||||
private void update_ui_group_size () {
|
||||
unowned var display = get_display ();
|
||||
|
||||
|
6
vapi/atk-bridge-2.0.vapi
Normal file
6
vapi/atk-bridge-2.0.vapi
Normal file
@ -0,0 +1,6 @@
|
||||
[CCode (lower_case_cprefix = "atk_bridge_")]
|
||||
namespace AtkBridge {
|
||||
public static int adaptor_init (int argc, char[] argv);
|
||||
public static void adaptor_cleanup ();
|
||||
public static void set_event_context (GLib.MainContext cnx);
|
||||
}
|
Loading…
Reference in New Issue
Block a user