[gnome-shell] [lg] fix queue_relayout warnings
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] [lg] fix queue_relayout warnings
- Date: Mon, 23 Aug 2010 17:05:52 +0000 (UTC)
commit 957b3b69dc1117b45b0d3d406c9ec996ff3db3e4
Author: Dan Winship <danw gnome org>
Date: Wed Jul 21 11:50:58 2010 -0400
[lg] fix queue_relayout warnings
https://bugzilla.gnome.org/show_bug.cgi?id=624940
js/ui/lookingGlass.js | 27 ++++++++++++++++++++-------
1 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 5c350d1..19059da 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -365,17 +365,16 @@ function Inspector() {
Inspector.prototype = {
_init: function() {
- let width = 150;
- let primary = global.get_primary_monitor();
+ let container = new Shell.GenericContainer({ width: 0,
+ height: 0 });
+ container.connect('allocate', Lang.bind(this, this._allocate));
+ Main.uiGroup.add_actor(container);
+
let eventHandler = new St.BoxLayout({ name: 'LookingGlassDialog',
vertical: false,
- y: primary.y + Math.floor(primary.height / 2),
reactive: true });
this._eventHandler = eventHandler;
- eventHandler.connect('notify::allocation', Lang.bind(this, function () {
- eventHandler.x = primary.x + Math.floor((primary.width - eventHandler.width) / 2);
- }));
- Main.uiGroup.add_actor(eventHandler);
+ container.add_actor(eventHandler);
this._displayText = new St.Label();
eventHandler.add(this._displayText, { expand: true });
@@ -398,6 +397,20 @@ Inspector.prototype = {
this._pointerTarget = null;
},
+ _allocate: function(actor, box, flags) {
+ let primary = global.get_primary_monitor();
+
+ let [minWidth, minHeight, natWidth, natHeight] =
+ this._eventHandler.get_preferred_size();
+
+ let childBox = new Clutter.ActorBox();
+ childBox.x1 = primary.x + Math.floor((primary.width - natWidth) / 2);
+ childBox.x2 = childBox.x1 + natWidth;
+ childBox.y1 = primary.y + Math.floor((primary.height - natHeight) / 2);
+ childBox.y2 = childBox.y1 + natHeight;
+ this._eventHandler.allocate(childBox, flags);
+ },
+
_close: function() {
Clutter.ungrab_pointer(this._eventHandler);
Clutter.ungrab_keyboard(this._eventHandler);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]