Keyboard: update for the message tray changes

The message tray is now modal and pushes the view up, but the keyboard
is shown below it. Solve this by applying a special styling to the
keyboard and message tray combination, and by not pushing the windows
up when the keyboard is shown.

https://bugzilla.gnome.org/show_bug.cgi?id=683546
This commit is contained in:
Giovanni Campagna 2012-09-08 20:01:30 +02:00 committed by Florian Müllner
parent fee0a8527d
commit fe124e6ab3
3 changed files with 84 additions and 44 deletions

View File

@ -1194,6 +1194,11 @@ StScrollBar StButton#vhandle:active {
height: 72px; height: 72px;
} }
#message-tray:keyboard {
/* Same as the OSK */
background: rgba(0, 0, 0, 0.8);
}
#message-tray:overview { #message-tray:overview {
background: rgba(0, 0, 0, 0.1); background: rgba(0, 0, 0, 0.1);
border-top: 1px solid rgba(128, 128, 128, 0.3); border-top: 1px solid rgba(128, 128, 128, 0.3);

View File

@ -370,7 +370,6 @@ const LayoutManager = new Lang.Class({
}, },
showKeyboard: function () { showKeyboard: function () {
Main.messageTray.hide();
this.keyboardBox.raise_top(); this.keyboardBox.raise_top();
Tweener.addTween(this.keyboardBox, Tweener.addTween(this.keyboardBox,
{ anchor_y: this.keyboardBox.height, { anchor_y: this.keyboardBox.height,
@ -384,6 +383,8 @@ const LayoutManager = new Lang.Class({
time: KEYBOARD_ANIMATION_TIME, time: KEYBOARD_ANIMATION_TIME,
transition: 'easeOutQuad' transition: 'easeOutQuad'
}); });
this.emit('keyboard-visible-changed', true);
}, },
_showKeyboardComplete: function() { _showKeyboardComplete: function() {
@ -398,7 +399,6 @@ const LayoutManager = new Lang.Class({
}, },
hideKeyboard: function (immediate) { hideKeyboard: function (immediate) {
Main.messageTray.hide();
if (this._keyboardHeightNotifyId) { if (this._keyboardHeightNotifyId) {
this.keyboardBox.disconnect(this._keyboardHeightNotifyId); this.keyboardBox.disconnect(this._keyboardHeightNotifyId);
this._keyboardHeightNotifyId = 0; this._keyboardHeightNotifyId = 0;
@ -415,6 +415,8 @@ const LayoutManager = new Lang.Class({
time: immediate ? 0 : KEYBOARD_ANIMATION_TIME, time: immediate ? 0 : KEYBOARD_ANIMATION_TIME,
transition: 'easeOutQuad' transition: 'easeOutQuad'
}); });
this.emit('keyboard-visible-changed', false);
}, },
_hideKeyboardComplete: function() { _hideKeyboardComplete: function() {

View File

@ -1458,6 +1458,7 @@ const MessageTray = new Lang.Class({
this._grabHelper.addActor(Main.panel.statusArea.activities.hotCorner.actor); this._grabHelper.addActor(Main.panel.statusArea.activities.hotCorner.actor);
Main.layoutManager.keyboardBox.connect('notify::hover', Lang.bind(this, this._onKeyboardHoverChanged)); Main.layoutManager.keyboardBox.connect('notify::hover', Lang.bind(this, this._onKeyboardHoverChanged));
Main.layoutManager.connect('keyboard-visible-changed', Lang.bind(this, this._onKeyboardVisibleChanged));
this._trayState = State.HIDDEN; this._trayState = State.HIDDEN;
this._locked = false; this._locked = false;
@ -1466,6 +1467,7 @@ const MessageTray = new Lang.Class({
this._trayLeftTimeoutId = 0; this._trayLeftTimeoutId = 0;
this._pointerInTray = false; this._pointerInTray = false;
this._pointerInKeyboard = false; this._pointerInKeyboard = false;
this._keyboardVisible = false;
this._summaryState = State.HIDDEN; this._summaryState = State.HIDDEN;
this._pointerInSummary = false; this._pointerInSummary = false;
this._notificationClosed = false; this._notificationClosed = false;
@ -1474,11 +1476,13 @@ const MessageTray = new Lang.Class({
this._notificationExpandedId = 0; this._notificationExpandedId = 0;
this._summaryBoxPointerState = State.HIDDEN; this._summaryBoxPointerState = State.HIDDEN;
this._summaryBoxPointerTimeoutId = 0; this._summaryBoxPointerTimeoutId = 0;
this._desktopCloneState = State.HIDDEN;
this._overviewVisible = Main.overview.visible; this._overviewVisible = Main.overview.visible;
this._notificationRemoved = false; this._notificationRemoved = false;
this._reNotifyAfterHideNotification = null; this._reNotifyAfterHideNotification = null;
this._inFullscreen = false; this._inFullscreen = false;
this._desktopClone = null; this._desktopClone = null;
this._inCtrlAltTab = false;
this._lightbox = new Lightbox.Lightbox(global.window_group, this._lightbox = new Lightbox.Lightbox(global.window_group,
{ inhibitEvents: true, { inhibitEvents: true,
@ -1863,6 +1867,17 @@ const MessageTray = new Lang.Class({
this._updateState(); this._updateState();
}, },
_onKeyboardVisibleChanged: function(layoutManager, keyboardVisible) {
this._keyboardVisible = keyboardVisible;
if (keyboardVisible)
this.actor.add_style_pseudo_class('keyboard');
else
this.actor.remove_style_pseudo_class('keyboard');
this._updateState();
},
_onFullscreenChanged: function(obj, state) { _onFullscreenChanged: function(obj, state) {
this._inFullscreen = state; this._inFullscreen = state;
this._updateState(); this._updateState();
@ -2006,6 +2021,19 @@ const MessageTray = new Lang.Class({
this._showTray(); this._showTray();
else if (trayIsVisible && !trayShouldBeVisible) else if (trayIsVisible && !trayShouldBeVisible)
this._hideTray(); this._hideTray();
// Desktop clone
let desktopCloneIsVisible = (this._desktopCloneState == State.SHOWING ||
this._desktopCloneState == State.SHOWN);
let desktopCloneShouldBeVisible = (trayShouldBeVisible &&
!this._overviewVisible &&
!this._keyboardVisible);
if (!desktopCloneIsVisible && desktopCloneShouldBeVisible) {
this._showDesktopClone();
} else if (desktopCloneIsVisible && !desktopCloneShouldBeVisible) {
this._hideDesktopClone (this._keyboardVisible);
}
}, },
_tween: function(actor, statevar, value, params) { _tween: function(actor, statevar, value, params) {
@ -2049,41 +2077,41 @@ const MessageTray = new Lang.Class({
transition: 'easeOutQuad' transition: 'easeOutQuad'
}); });
// Don't move the windows up if we are in the overview,
// but show the tray in the ctrl+alt+tab list.
if (this._overviewVisible) { if (this._overviewVisible) {
Main.ctrlAltTabManager.addGroup(this._summary, _("Message Tray"), 'start-here-symbolic', Main.ctrlAltTabManager.addGroup(this._summary, _("Message Tray"), 'start-here-symbolic',
{ sortGroup: CtrlAltTab.SortGroup.BOTTOM }); { sortGroup: CtrlAltTab.SortGroup.BOTTOM });
return; this._inCtrlAltTab = true;
} else {
this._lightbox.show();
} }
},
_showDesktopClone: function() {
let bottomMonitor = Main.layoutManager.bottomMonitor; let bottomMonitor = Main.layoutManager.bottomMonitor;
let geometry = new Clutter.Geometry({ x: bottomMonitor.x, let geometry = new Clutter.Geometry({ x: bottomMonitor.x,
y: bottomMonitor.y, y: bottomMonitor.y,
width: bottomMonitor.width, width: bottomMonitor.width,
height: bottomMonitor.height height: bottomMonitor.height
}); });
if (this._desktopClone)
this._desktopClone.destroy();
this._desktopClone = new Clutter.Clone({ source: global.window_group, clip: geometry }); this._desktopClone = new Clutter.Clone({ source: global.window_group, clip: geometry });
Main.uiGroup.insert_child_above(this._desktopClone, global.window_group); Main.uiGroup.insert_child_above(this._desktopClone, global.window_group);
this._desktopClone.x = 0; this._desktopClone.x = 0;
this._desktopClone.y = 0; this._desktopClone.y = 0;
this._desktopClone.show(); this._desktopClone.show();
this._lightbox.show(); this._tween(this._desktopClone, '_desktopCloneState', State.SHOWN,
{ y: -this.actor.height,
this._desktopClone._progress = 0;
Tweener.addTween(this._desktopClone,
{ _progress: this.actor.height,
time: ANIMATION_TIME, time: ANIMATION_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onUpdate: Lang.bind(this, function() { onUpdate: function() {
let progress = Math.round(this._desktopClone._progress); let progress = Math.round(-this.y);
this._desktopClone.y = - progress; this.set_clip(geometry.x,
this._desktopClone.set_clip(geometry.x,
geometry.y + progress, geometry.y + progress,
geometry.width, geometry.width,
geometry.height - progress); geometry.height - progress);
}) }
}); });
}, },
@ -2099,34 +2127,39 @@ const MessageTray = new Lang.Class({
// This is a no-op in that case. // This is a no-op in that case.
this._grabHelper.ungrab({ actor: this.actor }); this._grabHelper.ungrab({ actor: this.actor });
// If we are coming back from the overview, there are no windows if (this._inCtrlAltTab) {
// to be moved. Just remove the tray from the ctrl+alt+tab list.
if (!this._desktopClone) {
Main.ctrlAltTabManager.removeGroup(this._summary); Main.ctrlAltTabManager.removeGroup(this._summary);
this._inCtrlAltTab = false;
} else {
this._lightbox.hide();
}
},
_hideDesktopClone: function(now) {
if (now) {
this._desktopClone.destroy();
this._desktopClone = null;
this._desktopCloneState = State.HIDDEN;
return; return;
} }
let geometry = this._desktopClone.clip; let geometry = this._desktopClone.clip;
this._desktopClone._progress = 0; this._tween(this._desktopClone, '_desktopCloneState', State.HIDDEN,
Tweener.addTween(this._desktopClone, { y: 0,
{ _progress: this.actor.height,
time: ANIMATION_TIME, time: ANIMATION_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() { onComplete: Lang.bind(this, function() {
this._desktopClone.destroy(); this._desktopClone.destroy();
this._desktopClone = null; this._desktopClone = null;
}), }),
onUpdate: Lang.bind(this, function() { onUpdate: function() {
let progress = Math.round(this._desktopClone._progress); let progress = Math.round(-this.y);
this._desktopClone.y = progress - this.actor.height; this.set_clip(geometry.x,
this._desktopClone.set_clip(geometry.x,
geometry.y - progress, geometry.y - progress,
geometry.width, geometry.width,
geometry.height + progress); geometry.height + progress);
}) }
}); });
this._lightbox.hide();
}, },
_onIdleMonitorWatch: function(monitor, id, userBecameIdle) { _onIdleMonitorWatch: function(monitor, id, userBecameIdle) {