Skip to content

Commit ef74d19

Browse files
committed
expo: Fix opening transition.
- Adapt to the workspace thumbnails' changing position and size while scaling the monitor clones down to fit. - Use easing with panel enable/disable to keep timing the same with the other transitions. - Don't start allocating the expo view until at least one workspace child has been added. This prevents attempting to allocate the workspace thumbnail actors, close buttons and text entries before they've been parented (and fixes some theme node warnings). - Keep the workspace name entries disabled until they're focused (eliminates another warning)
1 parent 058deaf commit ef74d19

File tree

3 files changed

+60
-29
lines changed

3 files changed

+60
-29
lines changed

js/ui/expo.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,13 @@ Expo.prototype = {
321321
scale_x: activeWorkspaceActor.get_scale()[0] ,
322322
scale_y: activeWorkspaceActor.get_scale()[1],
323323
duration: ANIMATION_TIME,
324-
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
324+
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
325+
onUpdate: (t, timeIndex) => {
326+
clone.get_transition("x")?.set_to(Main.layoutManager.primaryMonitor.x + activeWorkspaceActor.allocation.x1);
327+
clone.get_transition("y")?.set_to(Main.layoutManager.primaryMonitor.y + activeWorkspaceActor.allocation.y1);
328+
clone.get_transition("scale-x")?.set_to(activeWorkspaceActor.get_scale()[0]);
329+
clone.get_transition("scale-y")?.set_to(activeWorkspaceActor.get_scale()[1]);
330+
},
325331
onComplete: () => {
326332
global.overlay_group.remove_actor(clone);
327333
clone.destroy();
@@ -355,6 +361,8 @@ Expo.prototype = {
355361
this._background.dim_factor = 0.4;
356362
}
357363

364+
activeWorkspace.setOverviewMode(true);
365+
358366
this._coverPane.raise_top();
359367
this._coverPane.show();
360368
this.emit('showing');
@@ -367,8 +375,8 @@ Expo.prototype = {
367375
if (!this._shown)
368376
return;
369377

370-
this._shown = false;
371378
this._animateNotVisible(options);
379+
this._shown = false;
372380
this._syncInputMode();
373381
},
374382

js/ui/expoThumbnail.js

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ let MAX_THUMBNAIL_SCALE = 0.9;
2323
const POINTER_LEAVE_MILLISECONDS_GRACE = 500;
2424
const POINTER_ENTER_MILLISECONDS_GRACE = 150;
2525
const RESCALE_ANIMATION_TIME = 0.2;
26-
const SLIDE_ANIMATION_TIME = 0.3;
26+
const SLIDE_ANIMATION_TIME = 300;
2727
const INACTIVE_OPACITY = 120;
28-
const REARRANGE_TIME_ON = 0.1;
29-
const REARRANGE_TIME_OFF = 0.3;
28+
const REARRANGE_TIME_ON = 100;
29+
const REARRANGE_TIME_OFF = 300;
3030
const ICON_OPACITY = Math.round(255 * 0.9);
3131
const ICON_SIZE = 128;
3232
const ICON_OFFSET = -5;
@@ -364,8 +364,10 @@ ExpoWorkspaceThumbnail.prototype = {
364364
can_focus: true });
365365
this.title._spacing = 0;
366366
this.titleText = this.title.clutter_text;
367+
this.titleText.editable = false;
367368
this.titleText.connect('key-press-event', Lang.bind(this, this.onTitleKeyPressEvent));
368369
this.titleText.connect('key-focus-in', Lang.bind(this, function() {
370+
this.titleText.editable = true;
369371
this.origTitle = Main.getWorkspaceName(this.metaWorkspace.index());
370372
}));
371373
this.titleText.connect('key-focus-out', Lang.bind(this, function() {
@@ -774,7 +776,13 @@ ExpoWorkspaceThumbnail.prototype = {
774776
windows.push(window);
775777
}
776778
else {
777-
Tweener.addTween(window.actor, {scale_x: 0, scale_y: 0, time: REARRANGE_TIME_ON, transition: 'easeOutQuad', onComplete: window.actor.hide});
779+
window.actor.ease({
780+
scale_x: 0,
781+
scale_y: 0,
782+
duration: REARRANGE_TIME_ON,
783+
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
784+
onComplete: () => window.actor.hide()
785+
});
778786
}
779787
}, this);
780788

@@ -812,14 +820,18 @@ ExpoWorkspaceThumbnail.prototype = {
812820
window.icon.set_scale(iconScale, iconScale);
813821
let [iconX, iconY] = [ICON_OFFSET / this.box.scale/scale, ICON_OFFSET / this.box.scale/scale];
814822
window.icon.set_position(iconX, iconY);
815-
Tweener.addTween(window.actor, {
816-
x: x, y: y, scale_x: scale, scale_y: scale,
823+
window.actor.ease({
824+
x: x,
825+
y: y,
826+
scale_x: scale,
827+
scale_y: scale,
817828
opacity: 255,
818-
time: REARRANGE_TIME_ON, transition: 'easeOutQuad',
819-
onComplete: function() {
829+
duration: REARRANGE_TIME_ON,
830+
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
831+
onComplete: () => {
820832
window.actor.show();
821833
window.icon.show();
822-
}
834+
}
823835
});
824836
col++;
825837
if (col > nCols){
@@ -851,12 +863,13 @@ ExpoWorkspaceThumbnail.prototype = {
851863
window.showUrgencyState();
852864
window.icon.hide();
853865
window.actor.show();
854-
Tweener.addTween(window.actor, {
866+
window.actor.ease({
855867
x: window.origX,
856868
y: window.origY,
857869
scale_x: 1, scale_y: 1,
858870
opacity: window.metaWindow.showing_on_its_workspace() ? 255 : 127,
859-
time: rearrangeTime, transition: 'easeOutQuad'
871+
duration: rearrangeTime,
872+
mode: Clutter.AnimationMode.EASE_OUT_QUAD
860873
});
861874
}, this);
862875
}, this);
@@ -889,12 +902,21 @@ ExpoWorkspaceThumbnail.prototype = {
889902
},
890903

891904
shade : function (force){
892-
if (!this.isSelected || force)
893-
Tweener.addTween(this.shader, {opacity: INACTIVE_OPACITY, time: SLIDE_ANIMATION_TIME, transition: 'easeOutQuad'});
905+
if (!this.isSelected || force) {
906+
this.shader.ease({
907+
opacity: INACTIVE_OPACITY,
908+
duration: SLIDE_ANIMATION_TIME,
909+
mode: Clutter.AnimationMode.EASE_OUT_QUAD
910+
});
911+
}
894912
},
895913

896914
highlight : function (){
897-
Tweener.addTween(this.shader, {opacity: 0, time: SLIDE_ANIMATION_TIME, transition: 'easeOutQuad'});
915+
this.shader.ease({
916+
opacity: 0,
917+
duration: SLIDE_ANIMATION_TIME,
918+
mode: Clutter.AnimationMode.EASE_OUT_QUAD
919+
});
898920
},
899921

900922
remove : function (){
@@ -1028,7 +1050,6 @@ ExpoThumbnailsBox.prototype = {
10281050
request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT });
10291051
this.actor.connect('get-preferred-width', Lang.bind(this, this.getPreferredWidth));
10301052
this.actor.connect('get-preferred-height', Lang.bind(this, this.getPreferredHeight));
1031-
this.actor.connect('allocate', Lang.bind(this, this.allocate));
10321053

10331054
// When we animate the scale, we don't animate the requested size of the thumbnails, rather
10341055
// we ask for our final size and then animate within that size. This slightly simplifies the
@@ -1142,6 +1163,8 @@ ExpoThumbnailsBox.prototype = {
11421163
this.stateCounts[ThumbnailState[key]] = 0;
11431164

11441165
this.addThumbnails(0, global.workspace_manager.n_workspaces);
1166+
this.actor.connect('allocate', Lang.bind(this, this.allocate));
1167+
11451168
this.button.raise_top();
11461169

11471170
global.stage.set_key_focus(this.actor);
@@ -1389,7 +1412,7 @@ ExpoThumbnailsBox.prototype = {
13891412

13901413
Tweener.addTween(thumbnail,
13911414
{ slidePosition: 1,
1392-
time: SLIDE_ANIMATION_TIME,
1415+
time: SLIDE_ANIMATION_TIME / 1000,
13931416
transition: 'linear',
13941417
onComplete: function() {
13951418
this.setThumbnailState(thumbnail, ThumbnailState.ANIMATED_OUT);
@@ -1448,7 +1471,7 @@ ExpoThumbnailsBox.prototype = {
14481471
this.setThumbnailState(thumbnail, ThumbnailState.ANIMATING_IN);
14491472
Tweener.addTween(thumbnail,
14501473
{ slidePosition: 0,
1451-
time: SLIDE_ANIMATION_TIME,
1474+
time: SLIDE_ANIMATION_TIME / 1000,
14521475
transition: 'easeOutQuad',
14531476
onComplete: function() {
14541477
this.setThumbnailState(thumbnail, ThumbnailState.NORMAL);
@@ -1698,9 +1721,7 @@ ExpoThumbnailsBox.prototype = {
16981721

16991722
this.button.allocate(childBox, flags);
17001723

1701-
if (this.targetScale === this._scale) {
1702-
this.emit('allocated');
1703-
}
1724+
this.emit('allocated');
17041725
},
17051726

17061727
activeWorkspaceChanged: function(wm, from, to, direction) {

js/ui/panel.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3682,11 +3682,13 @@ Panel.prototype = {
36823682
disable: function() {
36833683
this._disabled = true;
36843684
this._leavePanel();
3685-
Tweener.addTween(this.actor, {
3685+
this.actor.ease({
36863686
opacity: 0,
3687-
time: AUTOHIDE_ANIMATION_TIME,
3688-
transition: 'easeOutQuad',
3689-
onComplete: this.actor.hide
3687+
duration: AUTOHIDE_ANIMATION_TIME * 1000,
3688+
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
3689+
onComplete: () => {
3690+
this.actor.hide();
3691+
}
36903692
});
36913693
},
36923694

@@ -3698,10 +3700,10 @@ Panel.prototype = {
36983700
enable: function() {
36993701
this._disabled = false;
37003702
this.actor.show();
3701-
Tweener.addTween(this.actor, {
3703+
this.actor.ease({
37023704
opacity: 255,
3703-
time: AUTOHIDE_ANIMATION_TIME,
3704-
transition: 'easeOutQuad'
3705+
duration: AUTOHIDE_ANIMATION_TIME * 1000,
3706+
mode: Clutter.AnimationMode.EASE_OUT_QUAD
37053707
});
37063708
},
37073709

0 commit comments

Comments
 (0)