windowManager: Use Sets to track ongoing effects
We only care whether an effect is ongoing for an actor, not about any particular order. Sets are more convenient than arrays in that case, so use them instead. https://gitlab.gnome.org/GNOME/mutter/issues/655 https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/815
This commit is contained in:
parent
f5996a9232
commit
cb7374b1ec
@ -699,16 +699,16 @@ var WindowManager = class {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this._shellwm = global.window_manager;
|
this._shellwm = global.window_manager;
|
||||||
|
|
||||||
this._minimizing = [];
|
this._minimizing = new Set();
|
||||||
this._unminimizing = [];
|
this._unminimizing = new Set();
|
||||||
this._mapping = [];
|
this._mapping = new Set();
|
||||||
this._resizing = [];
|
this._resizing = new Set();
|
||||||
this._destroying = [];
|
this._destroying = new Set();
|
||||||
this._movingWindow = null;
|
this._movingWindow = null;
|
||||||
|
|
||||||
this._dimmedWindows = [];
|
this._dimmedWindows = [];
|
||||||
|
|
||||||
this._skippedActors = [];
|
this._skippedActors = new Set();
|
||||||
|
|
||||||
this._allowedKeybindings = {};
|
this._allowedKeybindings = {};
|
||||||
|
|
||||||
@ -1256,7 +1256,7 @@ var WindowManager = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
skipNextEffect(actor) {
|
skipNextEffect(actor) {
|
||||||
this._skippedActors.push(actor);
|
this._skippedActors.add(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
setCustomKeybindingHandler(name, modes, handler) {
|
setCustomKeybindingHandler(name, modes, handler) {
|
||||||
@ -1285,7 +1285,7 @@ var WindowManager = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_shouldAnimateActor(actor, types) {
|
_shouldAnimateActor(actor, types) {
|
||||||
if (this._removeEffect(this._skippedActors, actor))
|
if (this._skippedActors.delete(actor))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!this._shouldAnimate())
|
if (!this._shouldAnimate())
|
||||||
@ -1298,15 +1298,6 @@ var WindowManager = class {
|
|||||||
return types.includes(type);
|
return types.includes(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
_removeEffect(list, actor) {
|
|
||||||
let idx = list.indexOf(actor);
|
|
||||||
if (idx != -1) {
|
|
||||||
list.splice(idx, 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_minimizeWindow(shellwm, actor) {
|
_minimizeWindow(shellwm, actor) {
|
||||||
let types = [Meta.WindowType.NORMAL,
|
let types = [Meta.WindowType.NORMAL,
|
||||||
Meta.WindowType.MODAL_DIALOG,
|
Meta.WindowType.MODAL_DIALOG,
|
||||||
@ -1318,7 +1309,7 @@ var WindowManager = class {
|
|||||||
|
|
||||||
actor.set_scale(1.0, 1.0);
|
actor.set_scale(1.0, 1.0);
|
||||||
|
|
||||||
this._minimizing.push(actor);
|
this._minimizing.add(actor);
|
||||||
|
|
||||||
if (actor.meta_window.is_monitor_sized()) {
|
if (actor.meta_window.is_monitor_sized()) {
|
||||||
actor.ease({
|
actor.ease({
|
||||||
@ -1367,7 +1358,7 @@ var WindowManager = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_minimizeWindowDone(shellwm, actor) {
|
_minimizeWindowDone(shellwm, actor) {
|
||||||
if (this._removeEffect(this._minimizing, actor)) {
|
if (this._minimizing.delete(actor)) {
|
||||||
actor.remove_all_transitions();
|
actor.remove_all_transitions();
|
||||||
actor.set_scale(1.0, 1.0);
|
actor.set_scale(1.0, 1.0);
|
||||||
actor.set_opacity(255);
|
actor.set_opacity(255);
|
||||||
@ -1386,7 +1377,7 @@ var WindowManager = class {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._unminimizing.push(actor);
|
this._unminimizing.add(actor);
|
||||||
|
|
||||||
if (actor.meta_window.is_monitor_sized()) {
|
if (actor.meta_window.is_monitor_sized()) {
|
||||||
actor.opacity = 0;
|
actor.opacity = 0;
|
||||||
@ -1433,7 +1424,7 @@ var WindowManager = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_unminimizeWindowDone(shellwm, actor) {
|
_unminimizeWindowDone(shellwm, actor) {
|
||||||
if (this._removeEffect(this._unminimizing, actor)) {
|
if (this._unminimizing.delete(actor)) {
|
||||||
actor.remove_all_transitions();
|
actor.remove_all_transitions();
|
||||||
actor.set_scale(1.0, 1.0);
|
actor.set_scale(1.0, 1.0);
|
||||||
actor.set_opacity(255);
|
actor.set_opacity(255);
|
||||||
@ -1481,7 +1472,7 @@ var WindowManager = class {
|
|||||||
_sizeChangedWindow(shellwm, actor) {
|
_sizeChangedWindow(shellwm, actor) {
|
||||||
if (!actor.__animationInfo)
|
if (!actor.__animationInfo)
|
||||||
return;
|
return;
|
||||||
if (this._resizing.includes(actor))
|
if (this._resizing.has(actor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let actorClone = actor.__animationInfo.clone;
|
let actorClone = actor.__animationInfo.clone;
|
||||||
@ -1491,7 +1482,7 @@ var WindowManager = class {
|
|||||||
let scaleX = targetRect.width / sourceRect.width;
|
let scaleX = targetRect.width / sourceRect.width;
|
||||||
let scaleY = targetRect.height / sourceRect.height;
|
let scaleY = targetRect.height / sourceRect.height;
|
||||||
|
|
||||||
this._resizing.push(actor);
|
this._resizing.add(actor);
|
||||||
|
|
||||||
// Now scale and fade out the clone
|
// Now scale and fade out the clone
|
||||||
actorClone.ease({
|
actorClone.ease({
|
||||||
@ -1539,7 +1530,7 @@ var WindowManager = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_sizeChangeWindowDone(shellwm, actor) {
|
_sizeChangeWindowDone(shellwm, actor) {
|
||||||
if (this._removeEffect(this._resizing, actor)) {
|
if (this._resizing.delete(actor)) {
|
||||||
actor.remove_all_transitions();
|
actor.remove_all_transitions();
|
||||||
actor.scale_x = 1.0;
|
actor.scale_x = 1.0;
|
||||||
actor.scale_y = 1.0;
|
actor.scale_y = 1.0;
|
||||||
@ -1638,7 +1629,7 @@ var WindowManager = class {
|
|||||||
actor.scale_y = 0.05;
|
actor.scale_y = 0.05;
|
||||||
actor.opacity = 0;
|
actor.opacity = 0;
|
||||||
actor.show();
|
actor.show();
|
||||||
this._mapping.push(actor);
|
this._mapping.add(actor);
|
||||||
|
|
||||||
actor.ease({
|
actor.ease({
|
||||||
opacity: 255,
|
opacity: 255,
|
||||||
@ -1655,7 +1646,7 @@ var WindowManager = class {
|
|||||||
actor.scale_y = 0;
|
actor.scale_y = 0;
|
||||||
actor.opacity = 0;
|
actor.opacity = 0;
|
||||||
actor.show();
|
actor.show();
|
||||||
this._mapping.push(actor);
|
this._mapping.add(actor);
|
||||||
|
|
||||||
actor.ease({
|
actor.ease({
|
||||||
opacity: 255,
|
opacity: 255,
|
||||||
@ -1672,7 +1663,7 @@ var WindowManager = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_mapWindowDone(shellwm, actor) {
|
_mapWindowDone(shellwm, actor) {
|
||||||
if (this._removeEffect(this._mapping, actor)) {
|
if (this._mapping.delete(actor)) {
|
||||||
actor.remove_all_transitions();
|
actor.remove_all_transitions();
|
||||||
actor.opacity = 255;
|
actor.opacity = 255;
|
||||||
actor.set_pivot_point(0, 0);
|
actor.set_pivot_point(0, 0);
|
||||||
@ -1709,7 +1700,7 @@ var WindowManager = class {
|
|||||||
switch (actor.meta_window.window_type) {
|
switch (actor.meta_window.window_type) {
|
||||||
case Meta.WindowType.NORMAL:
|
case Meta.WindowType.NORMAL:
|
||||||
actor.set_pivot_point(0.5, 0.5);
|
actor.set_pivot_point(0.5, 0.5);
|
||||||
this._destroying.push(actor);
|
this._destroying.add(actor);
|
||||||
|
|
||||||
actor.ease({
|
actor.ease({
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
@ -1723,7 +1714,7 @@ var WindowManager = class {
|
|||||||
case Meta.WindowType.MODAL_DIALOG:
|
case Meta.WindowType.MODAL_DIALOG:
|
||||||
case Meta.WindowType.DIALOG:
|
case Meta.WindowType.DIALOG:
|
||||||
actor.set_pivot_point(0.5, 0.5);
|
actor.set_pivot_point(0.5, 0.5);
|
||||||
this._destroying.push(actor);
|
this._destroying.add(actor);
|
||||||
|
|
||||||
if (window.is_attached_dialog()) {
|
if (window.is_attached_dialog()) {
|
||||||
let parent = window.get_transient_for();
|
let parent = window.get_transient_for();
|
||||||
@ -1746,7 +1737,7 @@ var WindowManager = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_destroyWindowDone(shellwm, actor) {
|
_destroyWindowDone(shellwm, actor) {
|
||||||
if (this._removeEffect(this._destroying, actor)) {
|
if (this._destroying.delete(actor)) {
|
||||||
let parent = actor.get_meta_window().get_transient_for();
|
let parent = actor.get_meta_window().get_transient_for();
|
||||||
if (parent && actor._parentDestroyId) {
|
if (parent && actor._parentDestroyId) {
|
||||||
parent.disconnect(actor._parentDestroyId);
|
parent.disconnect(actor._parentDestroyId);
|
||||||
|
Loading…
Reference in New Issue
Block a user