[lg] fix queue_relayout warnings

https://bugzilla.gnome.org/show_bug.cgi?id=624940
This commit is contained in:
Dan Winship 2010-07-21 11:50:58 -04:00
parent 083b1c9d8b
commit 957b3b69dc

View File

@ -365,17 +365,16 @@ function Inspector() {
Inspector.prototype = { Inspector.prototype = {
_init: function() { _init: function() {
let width = 150; let container = new Shell.GenericContainer({ width: 0,
let primary = global.get_primary_monitor(); height: 0 });
container.connect('allocate', Lang.bind(this, this._allocate));
Main.uiGroup.add_actor(container);
let eventHandler = new St.BoxLayout({ name: 'LookingGlassDialog', let eventHandler = new St.BoxLayout({ name: 'LookingGlassDialog',
vertical: false, vertical: false,
y: primary.y + Math.floor(primary.height / 2),
reactive: true }); reactive: true });
this._eventHandler = eventHandler; this._eventHandler = eventHandler;
eventHandler.connect('notify::allocation', Lang.bind(this, function () { container.add_actor(eventHandler);
eventHandler.x = primary.x + Math.floor((primary.width - eventHandler.width) / 2);
}));
Main.uiGroup.add_actor(eventHandler);
this._displayText = new St.Label(); this._displayText = new St.Label();
eventHandler.add(this._displayText, { expand: true }); eventHandler.add(this._displayText, { expand: true });
@ -398,6 +397,20 @@ Inspector.prototype = {
this._pointerTarget = null; 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() { _close: function() {
Clutter.ungrab_pointer(this._eventHandler); Clutter.ungrab_pointer(this._eventHandler);
Clutter.ungrab_keyboard(this._eventHandler); Clutter.ungrab_keyboard(this._eventHandler);