|
|
58a5c8 |
From c6d579383b1e3f092cc289291d8f701011d37a67 Mon Sep 17 00:00:00 2001
|
|
|
71b11d |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
71b11d |
Date: Thu, 17 Mar 2016 17:15:38 +0100
|
|
|
71b11d |
Subject: [PATCH] apps-menu: Explicitly set label_actor
|
|
|
71b11d |
|
|
|
71b11d |
For some reason orca fails to pick up the label of category items,
|
|
|
71b11d |
so set the label_actor explicitly as workaround.
|
|
|
71b11d |
---
|
|
|
71b11d |
extensions/apps-menu/extension.js | 8 ++++++--
|
|
|
71b11d |
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
71b11d |
|
|
|
71b11d |
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
|
|
|
58a5c8 |
index 5067b63..49a05c7 100644
|
|
|
71b11d |
--- a/extensions/apps-menu/extension.js
|
|
|
71b11d |
+++ b/extensions/apps-menu/extension.js
|
|
|
58a5c8 |
@@ -7,61 +7,63 @@ const Shell = imports.gi.Shell;
|
|
|
58a5c8 |
const St = imports.gi.St;
|
|
|
58a5c8 |
const Clutter = imports.gi.Clutter;
|
|
|
58a5c8 |
const Main = imports.ui.main;
|
|
|
58a5c8 |
const Meta = imports.gi.Meta;
|
|
|
58a5c8 |
const PanelMenu = imports.ui.panelMenu;
|
|
|
58a5c8 |
const PopupMenu = imports.ui.popupMenu;
|
|
|
58a5c8 |
const Gtk = imports.gi.Gtk;
|
|
|
58a5c8 |
const GLib = imports.gi.GLib;
|
|
|
58a5c8 |
const Gio = imports.gi.Gio;
|
|
|
58a5c8 |
const Signals = imports.signals;
|
|
|
58a5c8 |
const Pango = imports.gi.Pango;
|
|
|
58a5c8 |
|
|
|
58a5c8 |
const Gettext = imports.gettext.domain('gnome-shell-extensions');
|
|
|
58a5c8 |
const _ = Gettext.gettext;
|
|
|
58a5c8 |
|
|
|
58a5c8 |
const ExtensionUtils = imports.misc.extensionUtils;
|
|
|
58a5c8 |
const Me = ExtensionUtils.getCurrentExtension();
|
|
|
58a5c8 |
const Convenience = Me.imports.convenience;
|
|
|
58a5c8 |
|
|
|
58a5c8 |
const appSys = Shell.AppSystem.get_default();
|
|
|
58a5c8 |
|
|
|
58a5c8 |
const APPLICATION_ICON_SIZE = 32;
|
|
|
58a5c8 |
const HORIZ_FACTOR = 5;
|
|
|
58a5c8 |
const MENU_HEIGHT_OFFSET = 132;
|
|
|
58a5c8 |
const NAVIGATION_REGION_OVERSHOOT = 50;
|
|
|
58a5c8 |
|
|
|
58a5c8 |
class ActivitiesMenuItem extends PopupMenu.PopupBaseMenuItem {
|
|
|
58a5c8 |
constructor(button) {
|
|
|
58a5c8 |
super();
|
|
|
71b11d |
this._button = button;
|
|
|
71b11d |
- this.actor.add_child(new St.Label({ text: _("Activities Overview") }));
|
|
|
71b11d |
+ let label = new St.Label({ text: _("Activities Overview") });
|
|
|
71b11d |
+ this.actor.add_child(label);
|
|
|
71b11d |
+ this.actor.label_actor = label;
|
|
|
58a5c8 |
}
|
|
|
58a5c8 |
|
|
|
58a5c8 |
activate(event) {
|
|
|
58a5c8 |
this._button.menu.toggle();
|
|
|
58a5c8 |
Main.overview.toggle();
|
|
|
58a5c8 |
super.activate(event);
|
|
|
58a5c8 |
}
|
|
|
58a5c8 |
};
|
|
|
58a5c8 |
|
|
|
58a5c8 |
class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem {
|
|
|
58a5c8 |
constructor(button, app) {
|
|
|
58a5c8 |
super();
|
|
|
58a5c8 |
this._app = app;
|
|
|
58a5c8 |
this._button = button;
|
|
|
58a5c8 |
|
|
|
58a5c8 |
this._iconBin = new St.Bin();
|
|
|
58a5c8 |
this.actor.add_child(this._iconBin);
|
|
|
58a5c8 |
|
|
|
58a5c8 |
let appLabel = new St.Label({ text: app.get_name(), y_expand: true,
|
|
|
58a5c8 |
y_align: Clutter.ActorAlign.CENTER });
|
|
|
58a5c8 |
this.actor.add_child(appLabel);
|
|
|
58a5c8 |
this.actor.label_actor = appLabel;
|
|
|
58a5c8 |
|
|
|
58a5c8 |
let textureCache = St.TextureCache.get_default();
|
|
|
58a5c8 |
let iconThemeChangedId = textureCache.connect('icon-theme-changed',
|
|
|
58a5c8 |
this._updateIcon.bind(this));
|
|
|
58a5c8 |
this.actor.connect('destroy', () => {
|
|
|
58a5c8 |
textureCache.disconnect(iconThemeChangedId);
|
|
|
58a5c8 |
});
|
|
|
58a5c8 |
this._updateIcon();
|
|
|
58a5c8 |
@@ -102,61 +104,63 @@ class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem {
|
|
|
58a5c8 |
}
|
|
|
58a5c8 |
|
|
|
58a5c8 |
getDragActor() {
|
|
|
58a5c8 |
return this._app.create_icon_texture(APPLICATION_ICON_SIZE);
|
|
|
58a5c8 |
}
|
|
|
71b11d |
|
|
|
58a5c8 |
getDragActorSource() {
|
|
|
58a5c8 |
return this._iconBin;
|
|
|
58a5c8 |
}
|
|
|
58a5c8 |
|
|
|
58a5c8 |
_updateIcon() {
|
|
|
58a5c8 |
this._iconBin.set_child(this.getDragActor());
|
|
|
58a5c8 |
}
|
|
|
58a5c8 |
};
|
|
|
58a5c8 |
|
|
|
58a5c8 |
class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem {
|
|
|
58a5c8 |
constructor(button, category) {
|
|
|
58a5c8 |
super();
|
|
|
58a5c8 |
this._category = category;
|
|
|
58a5c8 |
this._button = button;
|
|
|
58a5c8 |
|
|
|
58a5c8 |
this._oldX = -1;
|
|
|
58a5c8 |
this._oldY = -1;
|
|
|
58a5c8 |
|
|
|
58a5c8 |
let name;
|
|
|
58a5c8 |
if (this._category)
|
|
|
58a5c8 |
name = this._category.get_name();
|
|
|
71b11d |
else
|
|
|
71b11d |
name = _("Favorites");
|
|
|
71b11d |
|
|
|
71b11d |
- this.actor.add_child(new St.Label({ text: name }));
|
|
|
71b11d |
+ let label = new St.Label({ text: name });
|
|
|
71b11d |
+ this.actor.add_child(label);
|
|
|
71b11d |
+ this.actor.label_actor = label;
|
|
|
58a5c8 |
this.actor.connect('motion-event', this._onMotionEvent.bind(this));
|
|
|
58a5c8 |
}
|
|
|
58a5c8 |
|
|
|
58a5c8 |
activate(event) {
|
|
|
58a5c8 |
this._button.selectCategory(this._category, this);
|
|
|
58a5c8 |
this._button.scrollToCatButton(this);
|
|
|
58a5c8 |
super.activate(event);
|
|
|
58a5c8 |
}
|
|
|
58a5c8 |
|
|
|
58a5c8 |
_isNavigatingSubmenu([x, y]) {
|
|
|
58a5c8 |
let [posX, posY] = this.actor.get_transformed_position();
|
|
|
58a5c8 |
|
|
|
58a5c8 |
if (this._oldX == -1) {
|
|
|
58a5c8 |
this._oldX = x;
|
|
|
58a5c8 |
this._oldY = y;
|
|
|
58a5c8 |
return true;
|
|
|
58a5c8 |
}
|
|
|
58a5c8 |
|
|
|
58a5c8 |
let deltaX = Math.abs(x - this._oldX);
|
|
|
58a5c8 |
let deltaY = Math.abs(y - this._oldY);
|
|
|
58a5c8 |
|
|
|
58a5c8 |
this._oldX = x;
|
|
|
58a5c8 |
this._oldY = y;
|
|
|
58a5c8 |
|
|
|
58a5c8 |
// If it lies outside the x-coordinates then it is definitely outside.
|
|
|
58a5c8 |
if (posX > x || posX + this.actor.width < x)
|
|
|
58a5c8 |
return false;
|
|
|
71b11d |
|
|
|
58a5c8 |
// If it lies inside the menu item then it is definitely inside.
|
|
|
58a5c8 |
if (posY <= y && posY + this.actor.height >= y)
|
|
|
71b11d |
--
|
|
|
58a5c8 |
2.17.1
|
|
|
71b11d |
|