[gnome-shell] [panel] fix nested-queue_relayout warning in menus
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] [panel] fix nested-queue_relayout warning in menus
- Date: Wed, 19 May 2010 21:07:09 +0000 (UTC)
commit c8f4adde7ff8ff62add862470373eba380a4c6f1
Author: Dan Winship <danw gnome org>
Date: Wed May 19 13:50:39 2010 -0400
[panel] fix nested-queue_relayout warning in menus
We don't need to reposition the menu every time its button is
allocated; we can just stick it in the right place when we pop it up
(which is guaranteed to not be during a layout cycle).
(This means that now we won't reposition the menu if the button
moves/resizes while the menu is already popped up, but it's not clear
that we'd want it to anyway, since that could easily result in the
user selecting the wrong item, etc.)
Also, we don't need to override the menu's width any more, so remove
that.
https://bugzilla.gnome.org/show_bug.cgi?id=619113
js/ui/panel.js | 19 ++-----------------
1 files changed, 2 insertions(+), 17 deletions(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index acf41e3..453ecaa 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -419,14 +419,9 @@ PanelMenuButton.prototype = {
track_hover: true });
this.actor._delegate = this;
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
- // FIXME - this will trigger a warning about a queued allocation from inside
- // allocate; hard to solve without a way to express a high level positioning
- // constraint between actors
- this.actor.connect('notify::allocation', Lang.bind(this, this._repositionMenu));
this._state = this.State.CLOSED;
this.menu = new PanelMenu(this.actor);
this.menu.connect('activate', Lang.bind(this, this._onActivated));
- this.menu.actor.connect('notify::allocation', Lang.bind(this, this._repositionMenuArrow));
Main.chrome.addActor(this.menu.actor, { visibleInOverview: true,
affectsStruts: false });
this.menu.actor.hide();
@@ -460,9 +455,6 @@ PanelMenuButton.prototype = {
let [buttonX, buttonY] = this.actor.get_transformed_position();
let [buttonWidth, buttonHeight] = this.actor.get_transformed_size();
- // We need to reset the size here; otherwise get_preferred_size will
- // just return what we set below
- this.menu.actor.set_size(-1, -1);
let [minWidth, minHeight, natWidth, natHeight] = this.menu.actor.get_preferred_size();
// Adjust X position for alignment
@@ -483,17 +475,10 @@ PanelMenuButton.prototype = {
// Actually set the position
let panelActor = Main.panel.actor;
this.menu.actor.x = stageX;
- this.menu.actor.width = natWidth;
this.menu.actor.y = Math.floor(panelActor.y + panelActor.height);
- // TODO - we could scroll here
- this.menu.actor.height = natHeight;
- },
- _repositionMenuArrow: function() {
- let [buttonX, buttonY] = this.actor.get_transformed_position();
- let [buttonWidth, buttonHeight] = this.actor.get_transformed_size();
- let [menuX, menuY] = this.menu.actor.get_transformed_position();
- this.menu.setArrowOrigin((buttonX - menuX) + Math.floor(buttonWidth / 2));
+ // And adjust the arrow
+ this.menu.setArrowOrigin((buttonX - stageX) + Math.floor(buttonWidth / 2));
},
close: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]