Skip to content

Commit 1ff4cd5

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

3 files changed

Lines changed: 32 additions & 26 deletions

File tree

js/ui/expoThumbnail.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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) {
@@ -686,8 +685,13 @@ var ExpoWorkspaceThumbnail = GObject.registerClass({
686685
this._slideTimeline.run_dispose();
687686
this._slideTimeline = null;
688687
}
689-
super.destroy();
688+
if (this._collapseTimeline) {
689+
this._collapseTimeline.stop();
690+
this._collapseTimeline.run_dispose();
691+
this._collapseTimeline = null;
692+
}
690693
this.frame.destroy();
694+
super.destroy();
691695
}
692696

693697
onDestroy(actor) {
@@ -1076,7 +1080,7 @@ var ExpoThumbnailsBox = GObject.registerClass({
10761080
},
10771081
Signals: {
10781082
'set-overview-mode': { param_types: [GObject.TYPE_BOOLEAN] },
1079-
'sticky-detected': {},
1083+
'sticky-detected': { param_types: [GObject.TYPE_OBJECT] },
10801084
'allocated': {},
10811085
'drag-begin': {},
10821086
'drag-end': {},
@@ -1106,7 +1110,7 @@ var ExpoThumbnailsBox = GObject.registerClass({
11061110
DND.DragMotionResult.MOVE_DROP : DND.DragMotionResult.CONTINUE;
11071111
};
11081112
this.background.acceptDrop = (source, actor, x, y, time) => {
1109-
if (this.background.handleDragOver.apply(this, arguments) === DND.DragMotionResult.MOVE_DROP) {
1113+
if (this.background.handleDragOver(source, actor, x, y, time) === DND.DragMotionResult.MOVE_DROP) {
11101114
let draggable = source._draggable;
11111115
actor.get_parent().remove_actor(actor);
11121116
draggable._dragOrigParent.add_actor(actor);
@@ -1322,13 +1326,12 @@ var ExpoThumbnailsBox = GObject.registerClass({
13221326
overviewTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, timeout, func);
13231327
}
13241328
};
1325-
thumbnail.connect('destroy', (actor) => {
1329+
thumbnail.connect('destroy', () => {
13261330
setOverviewTimeout(0, function() {
13271331
overviewTimeoutId = 0;
13281332
});
13291333
this.remove_child(thumbnail.title);
13301334
this.remove_child(thumbnail.frame);
1331-
this.remove_child(actor);
13321335
thumbnail.title.destroy();
13331336
});
13341337
this.add_child(thumbnail.title);
@@ -1364,6 +1367,7 @@ var ExpoThumbnailsBox = GObject.registerClass({
13641367
thumbnail.overviewModeOn();
13651368
}
13661369
overviewTimeoutId = 0;
1370+
return GLib.SOURCE_REMOVE;
13671371
});
13681372
}
13691373
});
@@ -1380,6 +1384,7 @@ var ExpoThumbnailsBox = GObject.registerClass({
13801384
thumbnail.overviewModeOff();
13811385
}
13821386
overviewTimeoutId = 0;
1387+
return GLib.SOURCE_REMOVE;
13831388
});
13841389
}
13851390
});
@@ -1462,9 +1467,10 @@ var ExpoThumbnailsBox = GObject.registerClass({
14621467
function(thumbnail) {
14631468
thumbnail.hide();
14641469
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', () => {
1470+
thumbnail._collapseTimeline = new Clutter.Timeline({ duration: RESCALE_ANIMATION_TIME });
1471+
thumbnail._collapseTimeline.set_progress_mode(Clutter.AnimationMode.EASE_OUT_QUAD);
1472+
thumbnail._collapseTimeline.connect('completed', () => {
1473+
thumbnail._collapseTimeline = null;
14681474
this.stateCounts[thumbnail.state]--;
14691475
thumbnail.state = ThumbnailState.DESTROYED;
14701476

@@ -1481,7 +1487,7 @@ var ExpoThumbnailsBox = GObject.registerClass({
14811487

14821488
this.queueUpdateStates();
14831489
});
1484-
collapseTimeline.start();
1490+
thumbnail._collapseTimeline.start();
14851491
});
14861492

14871493
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)