Skip to content

Commit f12d5ba

Browse files
committed
More Mainloop removal, unused signal, collapse timeline handling.
1 parent 2eea94e commit f12d5ba

File tree

3 files changed

+35
-31
lines changed

3 files changed

+35
-31
lines changed

js/ui/expoThumbnail.js

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ var ExpoWindowClone = GObject.registerClass({
220220

221221
destroy() {
222222
this.killUrgencyTimeout();
223-
super.destroy();
224223
this.icon = null;
224+
super.destroy();
225225
}
226226

227227
onPositionChanged() {
@@ -299,7 +299,6 @@ var ExpoWorkspaceThumbnail = GObject.registerClass({
299299
'drag-over': {},
300300
'drag-end': {},
301301
'drag-begin': {},
302-
'remove-workspace': {},
303302
},
304303
}, class ExpoWorkspaceThumbnail extends St.Widget {
305304
_init(metaWorkspace, box) {
@@ -468,13 +467,11 @@ var ExpoWorkspaceThumbnail = GObject.registerClass({
468467
this._slideTimeline.set_progress_mode(mode);
469468
this._slideTimeline.connect('new-frame', () => {
470469
let progress = this._slideTimeline.get_progress();
471-
this._slidePosition = startValue + (target - startValue) * progress;
472-
if (this.box) this.box.queue_relayout();
470+
this.slidePosition = startValue + (target - startValue) * progress;
473471
});
474472
this._slideTimeline.connect('completed', () => {
475-
this._slidePosition = target;
473+
this.slidePosition = target;
476474
this._slideTimeline = null;
477-
if (this.box) this.box.queue_relayout();
478475
if (onComplete) onComplete();
479476
});
480477
this._slideTimeline.start();
@@ -686,8 +683,12 @@ var ExpoWorkspaceThumbnail = GObject.registerClass({
686683
this._slideTimeline.run_dispose();
687684
this._slideTimeline = null;
688685
}
686+
if (this._collapseTimeline) {
687+
this._collapseTimeline.stop();
688+
this._collapseTimeline.run_dispose();
689+
this._collapseTimeline = null;
690+
}
689691
super.destroy();
690-
this.frame.destroy();
691692
}
692693

693694
onDestroy(actor) {
@@ -1076,7 +1077,7 @@ var ExpoThumbnailsBox = GObject.registerClass({
10761077
},
10771078
Signals: {
10781079
'set-overview-mode': { param_types: [GObject.TYPE_BOOLEAN] },
1079-
'sticky-detected': {},
1080+
'sticky-detected': { param_types: [GObject.TYPE_OBJECT] },
10801081
'allocated': {},
10811082
'drag-begin': {},
10821083
'drag-end': {},
@@ -1106,7 +1107,7 @@ var ExpoThumbnailsBox = GObject.registerClass({
11061107
DND.DragMotionResult.MOVE_DROP : DND.DragMotionResult.CONTINUE;
11071108
};
11081109
this.background.acceptDrop = (source, actor, x, y, time) => {
1109-
if (this.background.handleDragOver.apply(this, arguments) === DND.DragMotionResult.MOVE_DROP) {
1110+
if (this.background.handleDragOver(source, actor, x, y, time) === DND.DragMotionResult.MOVE_DROP) {
11101111
let draggable = source._draggable;
11111112
actor.get_parent().remove_actor(actor);
11121113
draggable._dragOrigParent.add_actor(actor);
@@ -1322,14 +1323,14 @@ var ExpoThumbnailsBox = GObject.registerClass({
13221323
overviewTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, timeout, func);
13231324
}
13241325
};
1325-
thumbnail.connect('destroy', (actor) => {
1326+
thumbnail.connect('destroy', () => {
13261327
setOverviewTimeout(0, function() {
13271328
overviewTimeoutId = 0;
13281329
});
13291330
this.remove_child(thumbnail.title);
13301331
this.remove_child(thumbnail.frame);
1331-
this.remove_child(actor);
13321332
thumbnail.title.destroy();
1333+
thumbnail.frame.destroy();
13331334
});
13341335
this.add_child(thumbnail.title);
13351336
this.add_child(thumbnail.frame);
@@ -1364,6 +1365,7 @@ var ExpoThumbnailsBox = GObject.registerClass({
13641365
thumbnail.overviewModeOn();
13651366
}
13661367
overviewTimeoutId = 0;
1368+
return GLib.SOURCE_REMOVE;
13671369
});
13681370
}
13691371
});
@@ -1380,6 +1382,7 @@ var ExpoThumbnailsBox = GObject.registerClass({
13801382
thumbnail.overviewModeOff();
13811383
}
13821384
overviewTimeoutId = 0;
1385+
return GLib.SOURCE_REMOVE;
13831386
});
13841387
}
13851388
});
@@ -1462,9 +1465,10 @@ var ExpoThumbnailsBox = GObject.registerClass({
14621465
function(thumbnail) {
14631466
thumbnail.hide();
14641467
this.setThumbnailState(thumbnail, ThumbnailState.COLLAPSING);
1465-
let collapseTimeline = new Clutter.Timeline({ duration: RESCALE_ANIMATION_TIME });
1466-
collapseTimeline.set_progress_mode(Clutter.AnimationMode.EASE_OUT_QUAD);
1467-
collapseTimeline.connect('completed', () => {
1468+
thumbnail._collapseTimeline = new Clutter.Timeline({ duration: RESCALE_ANIMATION_TIME });
1469+
thumbnail._collapseTimeline.set_progress_mode(Clutter.AnimationMode.EASE_OUT_QUAD);
1470+
thumbnail._collapseTimeline.connect('completed', () => {
1471+
thumbnail._collapseTimeline = null;
14681472
this.stateCounts[thumbnail.state]--;
14691473
thumbnail.state = ThumbnailState.DESTROYED;
14701474

@@ -1481,7 +1485,7 @@ var ExpoThumbnailsBox = GObject.registerClass({
14811485

14821486
this.queueUpdateStates();
14831487
});
1484-
collapseTimeline.start();
1488+
thumbnail._collapseTimeline.start();
14851489
});
14861490

14871491
if (this.pendingScaleUpdate) {

js/ui/workspace.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const Clutter = imports.gi.Clutter;
44
const GLib = imports.gi.GLib;
55
const GObject = imports.gi.GObject;
66
const Gio = imports.gi.Gio;
7-
const Mainloop = imports.mainloop;
7+
88
const Meta = imports.gi.Meta;
99
const Pango = imports.gi.Pango;
1010
const Cinnamon = imports.gi.Cinnamon;
@@ -117,9 +117,9 @@ var WindowClone = GObject.registerClass({
117117
if (win.get_transient_for() === this.metaWindow) {
118118
// use an idle handler to avoid mapping problems -
119119
// see comment in Workspace._windowAdded
120-
Mainloop.idle_add(() => {
120+
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
121121
this.emit('activated', global.get_current_time());
122-
return false;
122+
return GLib.SOURCE_REMOVE;
123123
});
124124
}
125125
});
@@ -327,7 +327,7 @@ var WindowOverlay = GObject.registerClass({
327327

328328
_idleHideCloseButton(timeout) {
329329
if (this._idleToggleCloseId === 0)
330-
this._idleToggleCloseId = Mainloop.timeout_add(timeout, this._idleToggleCloseButton.bind(this));
330+
this._idleToggleCloseId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, timeout, this._idleToggleCloseButton.bind(this));
331331
}
332332

333333
_idleToggleCloseButton() {
@@ -336,12 +336,12 @@ var WindowOverlay = GObject.registerClass({
336336
this._isSelected = false;
337337
this._hideCloseButton();
338338
}
339-
return false;
339+
return GLib.SOURCE_REMOVE;
340340
}
341341

342342
_hideCloseButton() {
343343
if (this._idleToggleCloseId > 0) {
344-
Mainloop.source_remove(this._idleToggleCloseId);
344+
GLib.source_remove(this._idleToggleCloseId);
345345
this._idleToggleCloseId = 0;
346346
}
347347
for (let item of [this.closeButton, this.border]) {
@@ -431,7 +431,7 @@ var WindowOverlay = GObject.registerClass({
431431
_onDestroy() {
432432
if (this._disconnectWindowAdded) {this._disconnectWindowAdded();}
433433
if (this._idleToggleCloseId > 0) {
434-
Mainloop.source_remove(this._idleToggleCloseId);
434+
GLib.source_remove(this._idleToggleCloseId);
435435
this._idleToggleCloseId = 0;
436436
}
437437
global.display.disconnectObject(this);
@@ -894,12 +894,12 @@ var WorkspaceMonitor = GObject.registerClass({
894894
if (!win) {
895895
// Newly-created windows are added to a workspace before
896896
// the compositor finds out about them...
897-
Mainloop.idle_add(() => {
897+
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
898898
if (!this.is_finalized() &&
899899
metaWin.get_compositor_private() &&
900900
metaWin.get_workspace() === this.metaWorkspace)
901901
this._doAddWindow(metaWin);
902-
return false;
902+
return GLib.SOURCE_REMOVE;
903903
});
904904
return;
905905
}
@@ -1270,15 +1270,15 @@ var WindowContextMenu = class WindowContextMenu extends PopupMenu.PopupComboMenu
12701270
if (symbol === Clutter.KEY_space ||
12711271
symbol === Clutter.KEY_Return ||
12721272
symbol === Clutter.KEY_KP_Enter) {
1273-
this.menu.toggle();
1273+
this.toggle();
12741274
return true;
1275-
} else if (symbol === Clutter.KEY_Escape && this.menu.isOpen) {
1276-
this.menu.close();
1275+
} else if (symbol === Clutter.KEY_Escape && this.isOpen) {
1276+
this.close();
12771277
return true;
12781278
} else if (symbol === Clutter.KEY_Down) {
1279-
if (!this.menu.isOpen)
1280-
this.menu.toggle();
1281-
this.menu.actor.navigate_focus(this.actor, Gtk.DirectionType.DOWN, false);
1279+
if (!this.isOpen)
1280+
this.toggle();
1281+
this.actor.navigate_focus(this.actor, Gtk.DirectionType.DOWN, false);
12821282
return true;
12831283
} else
12841284
return false;

js/ui/workspacesView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var SwipeScrollResult = {
2424

2525
var WorkspacesView = GObject.registerClass({
2626
Signals: {
27-
'sticky-detected': {},
27+
'sticky-detected': { param_types: [GObject.TYPE_OBJECT] },
2828
},
2929
}, class WorkspacesView extends St.Widget {
3030
_init(workspaces) {

0 commit comments

Comments
 (0)