create actor at the right place, so there is no more clipping-out-of-screen problem

https://bugzilla.gnome.org/show_bug.cgi?id=664318
This commit is contained in:
Bastien Durel
2012-05-07 16:10:06 +02:00
committed by Giovanni Campagna
parent e00a73b88a
commit c5fd578214
+24 -1
View File
@@ -384,7 +384,9 @@ const Dock = new Lang.Class({
this._nicons = 0;
this._selectEffectFunctions(this._settings.get_enum(DOCK_EFFECTHIDE_KEY));
this.actor = new St.BoxLayout({ name: 'dock', vertical: true, reactive: true });
let [_x, _y, _w, _h] = this.get_start_position();
this.actor = new St.BoxLayout({ name: 'dock', vertical: true, reactive: true,
x: _x, y: _y, width: _w, height: _h });
this._grid = new Shell.GenericContainer();
this.actor.add(this._grid, { expand: true, y_align: St.Align.START });
@@ -464,6 +466,27 @@ const Dock = new Lang.Class({
this._hideDock();
},
get_start_position: function() {
let item_size = this._settings.get_int(DOCK_SIZE_KEY);
let monitor = Main.layoutManager.primaryMonitor;
if (this._displayMonitor > -1 && this._displayMonitor < Main.layoutManager.monitors.length) {
monitor = Main.layoutManager.monitors[this._displayMonitor];
}
let position_x = monitor.x;
let width = item_size + 4 * this._spacing;
switch (this._settings.get_enum(DOCK_POSITION_KEY)) {
case PositionMode.LEFT:
position_x=monitor.x - 2 * this._spacing;
break;
case PositionMode.RIGHT:
default:
position_x=monitor.x + (monitor.width - item_size - 2 * this._spacing);
}
return [ position_x, monitor.y, width, monitor.height ];
},
destroy: function() {
if (this._installedChangedId) {
this._appSystem.disconnect(this._installedChangedId);