[gnome-shell] workspace: Use set_origin/set_size instead of properties when allocating
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] workspace: Use set_origin/set_size instead of properties when allocating
- Date: Tue, 9 Mar 2021 15:48:59 +0000 (UTC)
commit 3e9a08a2e1e7b644247d4fa01b2ecfe27eae8bbc
Author: Jonas Dreßler <verdre v0yd nl>
Date: Thu Feb 25 11:54:39 2021 +0100
workspace: Use set_origin/set_size instead of properties when allocating
Setting four properties is more expensive than calling two C functions,
so move to set_origin()/set_size() calls for our ClutterActorBox
handling.
This gets us down to an average time of 2.1 ms spent in vfunc_allocate()
with 20 windows
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
js/ui/workspace.js | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 37b13a46b1..3337b2ed06 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -635,10 +635,12 @@ var WorkspaceLayout = GObject.registerClass({
const windowInfo = this._windows.get(child);
if (windowInfo.metaWindow.showing_on_its_workspace()) {
- workspaceBox.x1 = child.boundingBox.x - this._workarea.x;
- workspaceBox.x2 = workspaceBox.x1 + child.boundingBox.width;
- workspaceBox.y1 = child.boundingBox.y - this._workarea.y;
- workspaceBox.y2 = workspaceBox.y1 + child.boundingBox.height;
+ workspaceBox.set_origin(
+ child.boundingBox.x - this._workarea.x,
+ child.boundingBox.y - this._workarea.y);
+ workspaceBox.set_size(
+ child.boundingBox.width,
+ child.boundingBox.height);
} else {
workspaceBox.set_origin(this._workarea.x, this._workarea.y);
workspaceBox.set_size(0, 0);
@@ -659,10 +661,8 @@ var WorkspaceLayout = GObject.registerClass({
Math.max(workspaceBox.get_height(), height));
}
- layoutBox.x1 = x;
- layoutBox.x2 = layoutBox.x1 + width;
- layoutBox.y1 = y;
- layoutBox.y2 = layoutBox.y1 + height;
+ layoutBox.set_origin(x, y);
+ layoutBox.set_size(width, height);
childBox = workspaceBox.interpolate(layoutBox,
this._stateAdjustment.value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]