[popupMenu] Fix wrong positioning when showing for the first time

We query the transformed position and size of the popupMenu before actually showing
it which results into wrong positioning, when displaying it for the first time.

In case of the statusMenu this can even result into it being offscreen.

https://bugzilla.gnome.org/show_bug.cgi?id=621385
This commit is contained in:
Adel Gadllah 2010-06-12 18:13:04 +02:00
parent 5616a0ae2a
commit a691192ffa

View File

@ -277,6 +277,10 @@ PopupMenu.prototype = {
let primary = global.get_primary_monitor(); let primary = global.get_primary_monitor();
// We need to show it now to force an allocation,
// so that we can query the correct size.
this.actor.show();
// Position correctly relative to the sourceActor // Position correctly relative to the sourceActor
let [sourceX, sourceY] = this.sourceActor.get_transformed_position(); let [sourceX, sourceY] = this.sourceActor.get_transformed_position();
let [sourceWidth, sourceHeight] = this.sourceActor.get_transformed_size(); let [sourceWidth, sourceHeight] = this.sourceActor.get_transformed_size();
@ -351,7 +355,6 @@ PopupMenu.prototype = {
this.actor.y = Math.floor(menuY); this.actor.y = Math.floor(menuY);
// Now show it // Now show it
this.actor.show();
this.actor.opacity = 0; this.actor.opacity = 0;
this.actor.reactive = true; this.actor.reactive = true;
Tweener.addTween(this.actor, { opacity: 255, Tweener.addTween(this.actor, { opacity: 255,