[gnome-shell-extensions] window-list: Replace WorkspaceBackground as well
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions] window-list: Replace WorkspaceBackground as well
- Date: Wed, 24 Feb 2021 00:33:32 +0000 (UTC)
commit f71da9e843004f8196a459a26b0b92a33f21e71d
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Feb 24 00:51:11 2021 +0100
window-list: Replace WorkspaceBackground as well
The shell now scales down the backgrounds and adds a rounded corner
clip. Undo both those changes with another override.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/160>
extensions/window-list/windowPicker.js | 41 ++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
---
diff --git a/extensions/window-list/windowPicker.js b/extensions/window-list/windowPicker.js
index fec9649..a34f731 100644
--- a/extensions/window-list/windowPicker.js
+++ b/extensions/window-list/windowPicker.js
@@ -104,6 +104,42 @@ class MyWorkspace extends Workspace.Workspace {
}
});
+const MyWorkspaceBackground = GObject.registerClass(
+class MyWorkspaceBackground extends Workspace.WorkspaceBackground {
+ _updateBorderRadius() {
+ }
+
+ vfunc_allocate(box) {
+ this.set_allocation(box);
+
+ const themeNode = this.get_theme_node();
+ const contentBox = themeNode.get_content_box(box);
+
+ this._bin.allocate(contentBox);
+
+ const [contentWidth, contentHeight] = contentBox.get_size();
+ const monitor = Main.layoutManager.monitors[this._monitorIndex];
+ const xRatio = contentWidth / this._workarea.width;
+ const yRatio = contentHeight / this._workarea.height;
+
+ const right = area => area.x + area.width;
+ const bottom = area => area.y + area.height;
+
+ const offsets = {
+ left: xRatio * (this._workarea.x - monitor.x),
+ right: xRatio * (right(monitor) - right(this._workarea)),
+ top: yRatio * (this._workarea.y - monitor.y),
+ bottom: yRatio * (bottom(monitor) - bottom(this._workarea)),
+ };
+
+ contentBox.set_origin(-offsets.left, -offsets.top);
+ contentBox.set_size(
+ offsets.left + contentWidth + offsets.right,
+ offsets.top + contentHeight + offsets.bottom);
+ this._backgroundGroup.allocate(contentBox);
+ }
+});
+
var WindowPicker = GObject.registerClass({
Signals: {
'open-state-changed': { param_types: [GObject.TYPE_BOOLEAN] },
@@ -148,8 +184,10 @@ var WindowPicker = GObject.registerClass({
_injectBackgroundShade() {
this._origWorkspace = Workspace.Workspace;
+ this._origWorkspaceBackground = Workspace.WorkspaceBackground;
Workspace.Workspace = MyWorkspace;
+ Workspace.WorkspaceBackground = MyWorkspaceBackground;
}
get visible() {
@@ -254,6 +292,9 @@ var WindowPicker = GObject.registerClass({
if (this._origWorkspace)
Workspace.Workspace = this._origWorkspace;
+ if (this._origWorkspaceBackground)
+ Workspace.WorkspaceBackground = this._origWorkspaceBackground;
+
if (this._monitorsChangedId)
Main.layoutManager.disconnect(this._monitorsChangedId);
this._monitorsChangedId = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]