[gnome-shell] popupMenu: Fix algorithm for separator visibility to work with sections
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] popupMenu: Fix algorithm for separator visibility to work with sections
- Date: Tue, 10 Sep 2013 14:24:02 +0000 (UTC)
commit 660f0fec1633d27cfcef5709e66320bf2c854fb8
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Aug 28 10:50:07 2013 -0400
popupMenu: Fix algorithm for separator visibility to work with sections
Before, separators naively checked whether their siblings were visible
using actor visibility. However, if section actors are visible but have
no visible children, this will fail. Special-case separators when doing
visiblity checks.
https://bugzilla.gnome.org/show_bug.cgi?id=707801
js/ui/popupMenu.js | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index e720c67..adff1c6 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -35,6 +35,13 @@ function _ensureStyle(actor) {
actor.ensure_style();
}
+function isPopupMenuItemVisible(child) {
+ if (child._delegate instanceof PopupMenuSection)
+ if (child._delegate.isEmpty())
+ return false;
+ return child.visible;
+}
+
const PopupBaseMenuItem = new Lang.Class({
Name: 'PopupBaseMenuItem',
@@ -437,7 +444,7 @@ const PopupMenuBase = new Lang.Class({
let hasVisibleChildren = this.box.get_children().some(function(child) {
if (child._delegate instanceof PopupSeparatorMenuItem)
return false;
- return child.visible;
+ return isPopupMenuItemVisible(child);
});
return !hasVisibleChildren;
@@ -518,7 +525,7 @@ const PopupMenuBase = new Lang.Class({
let childBeforeIndex = index - 1;
- while (childBeforeIndex >= 0 && !children[childBeforeIndex].visible)
+ while (childBeforeIndex >= 0 && !isPopupMenuItemVisible(children[childBeforeIndex]))
childBeforeIndex--;
if (childBeforeIndex < 0
@@ -529,7 +536,7 @@ const PopupMenuBase = new Lang.Class({
let childAfterIndex = index + 1;
- while (childAfterIndex < children.length && !children[childAfterIndex].visible)
+ while (childAfterIndex < children.length && !isPopupMenuItemVisible(children[childAfterIndex]))
childAfterIndex++;
if (childAfterIndex >= children.length
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]