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