js: Queue 'later' via MetaLaters
This replaces the meta_later_add() API which used now removed global singletons under the hood. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2557>
This commit is contained in:
parent
387317aadc
commit
8d68bdaaa1
@ -112,7 +112,8 @@ var AuthList = GObject.registerClass({
|
|||||||
|
|
||||||
let focusSet = this.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
|
let focusSet = this.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
|
||||||
if (!focusSet) {
|
if (!focusSet) {
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
this._moveFocusToItems();
|
this._moveFocusToItems();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -191,7 +191,8 @@ var UserList = GObject.registerClass({
|
|||||||
|
|
||||||
let focusSet = this.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
|
let focusSet = this.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
|
||||||
if (!focusSet) {
|
if (!focusSet) {
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
this._moveFocusToItems();
|
this._moveFocusToItems();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -249,7 +249,8 @@ var AppMenu = class AppMenu extends PopupMenu.PopupMenu {
|
|||||||
if (this._updateWindowsLaterId)
|
if (this._updateWindowsLaterId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._updateWindowsLaterId = Meta.later_add(
|
const laters = global.compositor.get_laters();
|
||||||
|
this._updateWindowsLaterId = laters.add(
|
||||||
Meta.LaterType.BEFORE_REDRAW, () => {
|
Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
this._updateWindowsSection();
|
this._updateWindowsSection();
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
@ -257,8 +258,10 @@ var AppMenu = class AppMenu extends PopupMenu.PopupMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_updateWindowsSection() {
|
_updateWindowsSection() {
|
||||||
if (this._updateWindowsLaterId)
|
if (this._updateWindowsLaterId) {
|
||||||
Meta.later_remove(this._updateWindowsLaterId);
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.remove(this._updateWindowsLaterId);
|
||||||
|
}
|
||||||
this._updateWindowsLaterId = 0;
|
this._updateWindowsLaterId = 0;
|
||||||
|
|
||||||
this._windowSection.removeAll();
|
this._windowSection.removeAll();
|
||||||
|
@ -95,7 +95,8 @@ var AudioDeviceSelectionDialog = GObject.registerClass({
|
|||||||
vertical: true,
|
vertical: true,
|
||||||
});
|
});
|
||||||
box.connect('notify::height', () => {
|
box.connect('notify::height', () => {
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
box.width = box.height;
|
box.width = box.height;
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
});
|
});
|
||||||
|
@ -265,7 +265,8 @@ class ShowAppsIcon extends DashItemContainer {
|
|||||||
|
|
||||||
let id = app.get_id();
|
let id = app.get_id();
|
||||||
|
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
AppFavorites.getAppFavorites().removeFavorite(id);
|
AppFavorites.getAppFavorites().removeFavorite(id);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@ -967,7 +968,8 @@ var Dash = GObject.registerClass({
|
|||||||
if (!this._dragPlaceholder)
|
if (!this._dragPlaceholder)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
let appFavorites = AppFavorites.getAppFavorites();
|
let appFavorites = AppFavorites.getAppFavorites();
|
||||||
if (srcIsFavorite)
|
if (srcIsFavorite)
|
||||||
appFavorites.moveFavoriteToPos(id, favPos);
|
appFavorites.moveFavoriteToPos(id, favPos);
|
||||||
|
@ -188,7 +188,8 @@ var MessageDialogContent = GObject.registerClass({
|
|||||||
|
|
||||||
_onDestroy() {
|
_onDestroy() {
|
||||||
if (this._updateTitleStyleLater) {
|
if (this._updateTitleStyleLater) {
|
||||||
Meta.later_remove(this._updateTitleStyleLater);
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.remove(this._updateTitleStyleLater);
|
||||||
delete this._updateTitleStyleLater;
|
delete this._updateTitleStyleLater;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,7 +213,8 @@ var MessageDialogContent = GObject.registerClass({
|
|||||||
if (this._updateTitleStyleLater)
|
if (this._updateTitleStyleLater)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._updateTitleStyleLater = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
const laters = global.compositor.get_laters();
|
||||||
|
this._updateTitleStyleLater = laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
this._updateTitleStyleLater = 0;
|
this._updateTitleStyleLater = 0;
|
||||||
this._title.add_style_class_name('lightweight');
|
this._title.add_style_class_name('lightweight');
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
|
@ -677,7 +677,8 @@ var IconGridLayout = GObject.registerClass({
|
|||||||
|
|
||||||
_onDestroy() {
|
_onDestroy() {
|
||||||
if (this._updateIconSizesLaterId >= 0) {
|
if (this._updateIconSizesLaterId >= 0) {
|
||||||
Meta.later_remove(this._updateIconSizesLaterId);
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.remove(this._updateIconSizesLaterId);
|
||||||
this._updateIconSizesLaterId = 0;
|
this._updateIconSizesLaterId = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -962,8 +963,9 @@ var IconGridLayout = GObject.registerClass({
|
|||||||
this._pageSizeChanged = true;
|
this._pageSizeChanged = true;
|
||||||
|
|
||||||
if (this._updateIconSizesLaterId === 0) {
|
if (this._updateIconSizesLaterId === 0) {
|
||||||
|
const laters = global.compositor.get_laters();
|
||||||
this._updateIconSizesLaterId =
|
this._updateIconSizesLaterId =
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
const iconSize = this._findBestIconSize();
|
const iconSize = this._findBestIconSize();
|
||||||
|
|
||||||
if (this._iconSize !== iconSize) {
|
if (this._iconSize !== iconSize) {
|
||||||
|
@ -982,8 +982,9 @@ var LayoutManager = GObject.registerClass({
|
|||||||
|
|
||||||
_queueUpdateRegions() {
|
_queueUpdateRegions() {
|
||||||
if (!this._updateRegionIdle) {
|
if (!this._updateRegionIdle) {
|
||||||
this._updateRegionIdle = Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
|
const laters = global.compositor.get_laters();
|
||||||
this._updateRegions.bind(this));
|
this._updateRegionIdle = laters.add(
|
||||||
|
Meta.LaterType.BEFORE_REDRAW, this._updateRegions.bind(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1006,7 +1007,8 @@ var LayoutManager = GObject.registerClass({
|
|||||||
|
|
||||||
_updateRegions() {
|
_updateRegions() {
|
||||||
if (this._updateRegionIdle) {
|
if (this._updateRegionIdle) {
|
||||||
Meta.later_remove(this._updateRegionIdle);
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.remove(this._updateRegionIdle);
|
||||||
delete this._updateRegionIdle;
|
delete this._updateRegionIdle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1558,7 +1558,8 @@ class LookingGlass extends St.BoxLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_queueResize() {
|
_queueResize() {
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
this._resize();
|
this._resize();
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
});
|
});
|
||||||
|
@ -814,7 +814,8 @@ function _runBeforeRedrawQueue() {
|
|||||||
function _queueBeforeRedraw(workId) {
|
function _queueBeforeRedraw(workId) {
|
||||||
_beforeRedrawQueue.push(workId);
|
_beforeRedrawQueue.push(workId);
|
||||||
if (_beforeRedrawQueue.length == 1) {
|
if (_beforeRedrawQueue.length == 1) {
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
_runBeforeRedrawQueue();
|
_runBeforeRedrawQueue();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -626,7 +626,8 @@ var QuickSettingsMenu = class extends PopupMenu.PopupMenu {
|
|||||||
|
|
||||||
// Pick up additional spacing from any intermediate actors
|
// Pick up additional spacing from any intermediate actors
|
||||||
const updateOffset = () => {
|
const updateOffset = () => {
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
const offset = this._grid.apply_relative_transform_to_point(
|
const offset = this._grid.apply_relative_transform_to_point(
|
||||||
this._boxPointer, new Graphene.Point3D());
|
this._boxPointer, new Graphene.Point3D());
|
||||||
yConstraint.offset = offset.y;
|
yConstraint.offset = offset.y;
|
||||||
|
@ -678,7 +678,8 @@ var ScreenShield = class extends Signals.EventEmitter {
|
|||||||
let wasLocked = global.get_runtime_state('b', LOCKED_STATE_STR);
|
let wasLocked = global.get_runtime_state('b', LOCKED_STATE_STR);
|
||||||
if (wasLocked === null)
|
if (wasLocked === null)
|
||||||
return;
|
return;
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
this.lock(false);
|
this.lock(false);
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
});
|
});
|
||||||
|
@ -470,7 +470,8 @@ class GridSearchResults extends SearchResultsBase {
|
|||||||
|
|
||||||
_onDestroy() {
|
_onDestroy() {
|
||||||
if (this._updateSearchLater) {
|
if (this._updateSearchLater) {
|
||||||
Meta.later_remove(this._updateSearchLater);
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.remove(this._updateSearchLater);
|
||||||
delete this._updateSearchLater;
|
delete this._updateSearchLater;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +482,8 @@ class GridSearchResults extends SearchResultsBase {
|
|||||||
if (this._notifyAllocationId)
|
if (this._notifyAllocationId)
|
||||||
this.disconnect(this._notifyAllocationId);
|
this.disconnect(this._notifyAllocationId);
|
||||||
if (this._updateSearchLater) {
|
if (this._updateSearchLater) {
|
||||||
Meta.later_remove(this._updateSearchLater);
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.remove(this._updateSearchLater);
|
||||||
delete this._updateSearchLater;
|
delete this._updateSearchLater;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,7 +492,8 @@ class GridSearchResults extends SearchResultsBase {
|
|||||||
this._notifyAllocationId = this.connect('notify::allocation', () => {
|
this._notifyAllocationId = this.connect('notify::allocation', () => {
|
||||||
if (this._updateSearchLater)
|
if (this._updateSearchLater)
|
||||||
return;
|
return;
|
||||||
this._updateSearchLater = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
const laters = global.compositor.get_laters();
|
||||||
|
this._updateSearchLater = laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
delete this._updateSearchLater;
|
delete this._updateSearchLater;
|
||||||
super.updateSearch(...args);
|
super.updateSearch(...args);
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
|
@ -107,7 +107,8 @@ class ScreenshotItem extends QuickSettingsItem {
|
|||||||
|
|
||||||
this.connect('clicked', () => {
|
this.connect('clicked', () => {
|
||||||
const topMenu = Main.panel.statusArea.quickSettings.menu;
|
const topMenu = Main.panel.statusArea.quickSettings.menu;
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
Main.screenshotUI.open().catch(logError);
|
Main.screenshotUI.open().catch(logError);
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
});
|
});
|
||||||
|
@ -327,8 +327,11 @@ var WorkspaceTracker = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_queueCheckWorkspaces() {
|
_queueCheckWorkspaces() {
|
||||||
if (this._checkWorkspacesId == 0)
|
if (this._checkWorkspacesId === 0) {
|
||||||
this._checkWorkspacesId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, this._checkWorkspaces.bind(this));
|
const laters = global.compositor.get_laters();
|
||||||
|
this._checkWorkspacesId =
|
||||||
|
laters.add(Meta.LaterType.BEFORE_REDRAW, this._checkWorkspaces.bind(this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_nWorkspacesChanged() {
|
_nWorkspacesChanged() {
|
||||||
|
@ -527,7 +527,8 @@ var WindowPreview = GObject.registerClass({
|
|||||||
this._delegate = null;
|
this._delegate = null;
|
||||||
|
|
||||||
if (this._longPressLater) {
|
if (this._longPressLater) {
|
||||||
Meta.later_remove(this._longPressLater);
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.remove(this._longPressLater);
|
||||||
delete this._longPressLater;
|
delete this._longPressLater;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,7 +616,8 @@ var WindowPreview = GObject.registerClass({
|
|||||||
|
|
||||||
// A click cancels a long-press before any click handler is
|
// A click cancels a long-press before any click handler is
|
||||||
// run - make sure to not start a drag in that case
|
// run - make sure to not start a drag in that case
|
||||||
this._longPressLater = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
const laters = global.compositor.get_laters();
|
||||||
|
this._longPressLater = laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
delete this._longPressLater;
|
delete this._longPressLater;
|
||||||
if (this._selected) {
|
if (this._selected) {
|
||||||
this._selected = false;
|
this._selected = false;
|
||||||
|
@ -1187,13 +1187,16 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
if (this._updateStateId > 0)
|
if (this._updateStateId > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._updateStateId = Meta.later_add(
|
const laters = global.compositor.get_laters();
|
||||||
|
this._updateStateId = laters.add(
|
||||||
Meta.LaterType.BEFORE_REDRAW, () => this._updateStates());
|
Meta.LaterType.BEFORE_REDRAW, () => this._updateStates());
|
||||||
}
|
}
|
||||||
|
|
||||||
_unqueueUpdateStates() {
|
_unqueueUpdateStates() {
|
||||||
if (this._updateStateId)
|
if (this._updateStateId) {
|
||||||
Meta.later_remove(this._updateStateId);
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.remove(this._updateStateId);
|
||||||
|
}
|
||||||
this._updateStateId = 0;
|
this._updateStateId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1329,7 +1332,8 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
this._dropPlaceholder.allocate_preferred_size(
|
this._dropPlaceholder.allocate_preferred_size(
|
||||||
...this._dropPlaceholder.get_position());
|
...this._dropPlaceholder.get_position());
|
||||||
|
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
this._dropPlaceholder.hide();
|
this._dropPlaceholder.hide();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1359,7 +1363,8 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
|
|
||||||
this._dropPlaceholder.allocate(childBox);
|
this._dropPlaceholder.allocate(childBox);
|
||||||
|
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||||
this._dropPlaceholder.show();
|
this._dropPlaceholder.show();
|
||||||
});
|
});
|
||||||
x += placeholderWidth + spacing;
|
x += placeholderWidth + spacing;
|
||||||
|
@ -860,7 +860,8 @@ class WorkspacesDisplay extends St.Widget {
|
|||||||
|
|
||||||
_onDestroy() {
|
_onDestroy() {
|
||||||
if (this._parentSetLater) {
|
if (this._parentSetLater) {
|
||||||
Meta.later_remove(this._parentSetLater);
|
const laters = global.compositor.get_laters();
|
||||||
|
laters.remove(this._parentSetLater);
|
||||||
this._parentSetLater = 0;
|
this._parentSetLater = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user