lookingGlass: fix to not overlap the keyboard
When the keyboard is configured, make lg shorter (if necessary) to avoid overlapping it. Also, make a few simplifications to lg's layout code. In particular, move it into panelBox, to simplify its interactions with the panel. https://bugzilla.gnome.org/show_bug.cgi?id=657986
This commit is contained in:
parent
ef57c9ff83
commit
016e384fa1
@ -6,6 +6,7 @@ const GConf = imports.gi.GConf;
|
|||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const Gtk = imports.gi.Gtk;
|
const Gtk = imports.gi.Gtk;
|
||||||
|
const Meta = imports.gi.Meta;
|
||||||
const Pango = imports.gi.Pango;
|
const Pango = imports.gi.Pango;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
@ -761,9 +762,13 @@ LookingGlass.prototype = {
|
|||||||
Lang.bind(this, this._updateFont));
|
Lang.bind(this, this._updateFont));
|
||||||
this._updateFont();
|
this._updateFont();
|
||||||
|
|
||||||
// we add it to the chrome because we want it to appear to slide
|
// We want it to appear to slide out from underneath the panel
|
||||||
// out from underneath the panel
|
Main.layoutManager.panelBox.add_actor(this.actor);
|
||||||
Main.layoutManager.addChrome(this.actor);
|
this.actor.lower_bottom();
|
||||||
|
Main.layoutManager.panelBox.connect('allocation-changed',
|
||||||
|
Lang.bind(this, this._queueResize));
|
||||||
|
Main.layoutManager.keyboardBox.connect('allocation-changed',
|
||||||
|
Lang.bind(this, this._queueResize));
|
||||||
|
|
||||||
this._objInspector = new ObjInspector();
|
this._objInspector = new ObjInspector();
|
||||||
Main.uiGroup.add_actor(this._objInspector.actor);
|
Main.uiGroup.add_actor(this._objInspector.actor);
|
||||||
@ -844,6 +849,8 @@ LookingGlass.prototype = {
|
|||||||
|
|
||||||
this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY,
|
this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY,
|
||||||
entry: this._entry.clutter_text });
|
entry: this._entry.clutter_text });
|
||||||
|
|
||||||
|
this._resize();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateFont: function() {
|
_updateFont: function() {
|
||||||
@ -918,13 +925,18 @@ LookingGlass.prototype = {
|
|||||||
this.open();
|
this.open();
|
||||||
},
|
},
|
||||||
|
|
||||||
_resizeTo: function(actor) {
|
_queueResize: function() {
|
||||||
|
Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
|
||||||
|
Lang.bind(this, function () { this._resize(); }));
|
||||||
|
},
|
||||||
|
|
||||||
|
_resize: function() {
|
||||||
let primary = Main.layoutManager.primaryMonitor;
|
let primary = Main.layoutManager.primaryMonitor;
|
||||||
let myWidth = primary.width * 0.7;
|
let myWidth = primary.width * 0.7;
|
||||||
let myHeight = primary.height * 0.7;
|
let availableHeight = primary.height - Main.layoutManager.keyboardBox.height;
|
||||||
let [srcX, srcY] = actor.get_transformed_position();
|
let myHeight = Math.min(primary.height * 0.7, availableHeight * 0.9);
|
||||||
this.actor.x = srcX + (primary.width - myWidth) / 2;
|
this.actor.x = (primary.width - myWidth) / 2;
|
||||||
this._hiddenY = srcY + actor.height - myHeight - 4; // -4 to hide the top corners
|
this._hiddenY = this.actor.get_parent().height - myHeight - 4; // -4 to hide the top corners
|
||||||
this._targetY = this._hiddenY + myHeight;
|
this._targetY = this._hiddenY + myHeight;
|
||||||
this.actor.y = this._hiddenY;
|
this.actor.y = this._hiddenY;
|
||||||
this.actor.width = myWidth;
|
this.actor.width = myWidth;
|
||||||
@ -934,14 +946,6 @@ LookingGlass.prototype = {
|
|||||||
this._targetY + Math.floor(myHeight * 0.1));
|
this._targetY + Math.floor(myHeight * 0.1));
|
||||||
},
|
},
|
||||||
|
|
||||||
slaveTo: function(actor) {
|
|
||||||
this._slaveTo = actor;
|
|
||||||
actor.connect('notify::allocation', Lang.bind(this, function () {
|
|
||||||
this._resizeTo(actor);
|
|
||||||
}));
|
|
||||||
this._resizeTo(actor);
|
|
||||||
},
|
|
||||||
|
|
||||||
insertObject: function(obj) {
|
insertObject: function(obj) {
|
||||||
this._pushResult('<insert>', obj);
|
this._pushResult('<insert>', obj);
|
||||||
},
|
},
|
||||||
@ -974,7 +978,6 @@ LookingGlass.prototype = {
|
|||||||
|
|
||||||
this._notebook.selectIndex(0);
|
this._notebook.selectIndex(0);
|
||||||
this.actor.show();
|
this.actor.show();
|
||||||
this.actor.lower(Main.layoutManager.panelBox);
|
|
||||||
this._open = true;
|
this._open = true;
|
||||||
this._history.lastItem();
|
this._history.lastItem();
|
||||||
|
|
||||||
@ -1005,7 +1008,6 @@ LookingGlass.prototype = {
|
|||||||
|
|
||||||
Main.popModal(this._entry);
|
Main.popModal(this._entry);
|
||||||
|
|
||||||
this.actor.lower(Main.layoutManager.panelBox);
|
|
||||||
Tweener.addTween(this.actor, { time: 0.5 / St.get_slow_down_factor(),
|
Tweener.addTween(this.actor, { time: 0.5 / St.get_slow_down_factor(),
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
y: this._hiddenY,
|
y: this._hiddenY,
|
||||||
|
@ -765,7 +765,6 @@ function popModal(actor, timestamp) {
|
|||||||
function createLookingGlass() {
|
function createLookingGlass() {
|
||||||
if (lookingGlass == null) {
|
if (lookingGlass == null) {
|
||||||
lookingGlass = new LookingGlass.LookingGlass();
|
lookingGlass = new LookingGlass.LookingGlass();
|
||||||
lookingGlass.slaveTo(panel.actor);
|
|
||||||
}
|
}
|
||||||
return lookingGlass;
|
return lookingGlass;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user