[gnome-shell] boxpointer: reposition after a size change
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] boxpointer: reposition after a size change
- Date: Fri, 25 Mar 2011 22:56:25 +0000 (UTC)
commit 475161f7163055ac0d10393daa3ffc6e0725414e
Author: Dan Winship <danw gnome org>
Date: Fri Mar 25 10:04:28 2011 -0400
boxpointer: reposition after a size change
If the BoxPointer changes size (eg, when opening the "More" section of
the network menu), reposition it to make sure it's still aligned
correctly and still completely on-screen.
This is not the right fix for this problem (and causes the menu to be
drawn in the wrong position for one frame). The right fix would
involve a ClutterConstraint, but that would be more invasive, and can
happen post-3.0.0.
https://bugzilla.gnome.org/show_bug.cgi?id=645647
js/ui/boxpointer.js | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js
index 99de6f1..619e0c5 100644
--- a/js/ui/boxpointer.js
+++ b/js/ui/boxpointer.js
@@ -2,6 +2,7 @@
const Clutter = imports.gi.Clutter;
const Lang = imports.lang;
+const Meta = imports.gi.Meta;
const St = imports.gi.St;
const Shell = imports.gi.Shell;
@@ -176,6 +177,18 @@ BoxPointer.prototype = {
break;
}
this.bin.allocate(childBox, flags);
+
+ if (this._sourceActor) {
+ Meta.later_add (Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
+ function () {
+ // This won't cause a loop if _allocate() was
+ // called as a result of repositioning, because in
+ // that case _reposition() will set the same
+ // coordinates again, which Clutter will just
+ // ignore.
+ this._reposition(this._sourceActor, this._gap, this._alignment);
+ }));
+ }
},
_drawBorder: function(area) {
@@ -306,6 +319,14 @@ BoxPointer.prototype = {
// so that we can query the correct size.
this.actor.show();
+ this._sourceActor = sourceActor;
+ this._gap = gap;
+ this._alignment = alignment;
+
+ this._reposition(sourceActor, gap, alignment);
+ },
+
+ _reposition: function(sourceActor, gap, alignment) {
// Position correctly relative to the sourceActor
let sourceNode = sourceActor.get_theme_node();
let sourceContentBox = sourceNode.get_content_box(sourceActor.get_allocation_box());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]