Skip to content

Commit 6577feb

Browse files
committed
Use a custom actor for the uiGroup.
This actor is more efficient and idle updates on the uiGroup are significantly reduced. ref: https://gitlab.gnome.org/GNOME/gnome-shell/-/commit/6b924c00c5c171ce11663c855bad2ec3d230f158
1 parent 50a88f5 commit 6577feb

File tree

2 files changed

+18
-24
lines changed

2 files changed

+18
-24
lines changed

js/ui/layout.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
const Clutter = imports.gi.Clutter;
88
const Cinnamon = imports.gi.Cinnamon;
9+
const GObject = imports.gi.GObject;
910
const GLib = imports.gi.GLib;
1011
const Gio = imports.gi.Gio;
1112
const Lang = imports.lang;
@@ -51,6 +52,19 @@ Monitor.prototype = {
5152
}
5253
};
5354

55+
const UiActor = GObject.registerClass(
56+
class UiActor extends St.Widget {
57+
vfunc_get_preferred_width(_forHeight) {
58+
let width = global.stage.width;
59+
return [width, width];
60+
}
61+
62+
vfunc_get_preferred_height(_forWidth) {
63+
let height = global.stage.height;
64+
return [height, height];
65+
}
66+
});
67+
5468
/**
5569
* #LayoutManager
5670
*
@@ -594,7 +608,6 @@ Chrome.prototype = {
594608
visible = false;
595609
else
596610
visible = true;
597-
Main.uiGroup.set_skip_paint(actorData.actor, !visible);
598611
}
599612
this._queueUpdateRegions();
600613
},
@@ -733,8 +746,7 @@ Chrome.prototype = {
733746

734747
if (wantsInputRegion
735748
&& actorData.affectsInputRegion
736-
&& actorData.actor.get_paint_visibility()
737-
&& !Main.uiGroup.get_skip_paint(actorData.actor)) {
749+
&& actorData.actor.get_paint_visibility()) {
738750

739751
let rect = new Meta.Rectangle({ x: x, y: y, width: w, height: h});
740752

js/ui/main.js

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -343,27 +343,9 @@ function start() {
343343
keybindingManager = new Keybindings.KeybindingManager();
344344
deskletContainer = new DeskletManager.DeskletContainer();
345345

346-
// Set up stage hierarchy to group all UI actors under one container.
347-
uiGroup = new Cinnamon.GenericContainer({ name: 'uiGroup' });
348-
// see https://gitlab.gnome.org/GNOME/gnome-shell/-/commit/73d8c82640f6125cfbf80
349-
this.uiGroup.set_flags(Clutter.ActorFlags.NO_LAYOUT);
350-
351-
uiGroup.connect('allocate',
352-
function (actor, box, flags) {
353-
let children = uiGroup.get_children();
354-
for (let i = 0; i < children.length; i++)
355-
children[i].allocate_preferred_size(flags);
356-
});
357-
uiGroup.connect('get-preferred-width',
358-
function(actor, forHeight, alloc) {
359-
let width = global.stage.width;
360-
[alloc.min_size, alloc.natural_size] = [width, width];
361-
});
362-
uiGroup.connect('get-preferred-height',
363-
function(actor, forWidth, alloc) {
364-
let height = global.stage.height;
365-
[alloc.min_size, alloc.natural_size] = [height, height];
366-
});
346+
uiGroup = new Layout.UiActor({ name: 'uiGroup' });
347+
uiGroup.set_flags(Clutter.ActorFlags.NO_LAYOUT);
348+
367349
global.background_actor.hide();
368350
global.reparentActor(global.window_group, uiGroup);
369351
global.reparentActor(global.overlay_group, uiGroup);

0 commit comments

Comments
 (0)