From 00b5161b42128e1485f3cea865b981bd77e794fc Mon Sep 17 00:00:00 2001 From: Joonas Henriksson Date: Tue, 23 Mar 2021 06:32:51 +0200 Subject: [PATCH] WorkspaceBackground: Stop hardcoding corner radius Set corner radius based on the border-radius value from the theme, instead of using a hardcoded value that has to be kept in sync with the theme stylesheet. Part-of: --- data/theme/gnome-shell-sass/widgets/_window-picker.scss | 1 - js/ui/workspace.js | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/data/theme/gnome-shell-sass/widgets/_window-picker.scss b/data/theme/gnome-shell-sass/widgets/_window-picker.scss index b3b93f291a..cf0b8b8414 100644 --- a/data/theme/gnome-shell-sass/widgets/_window-picker.scss +++ b/data/theme/gnome-shell-sass/widgets/_window-picker.scss @@ -46,7 +46,6 @@ $window_close_button_padding: 3px; } .workspace-background { - // keep in sync with BACKGROUND_CORNER_RADIUS_PIXELS in workspace.js border-radius: 30px; background-color: $osd_bg_color; box-shadow: 0 4px 16px 4px transparentize(darken($osd_bg_color, 30%), 0.7); diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 1a5bd02271..61af83a3b3 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -23,7 +23,6 @@ var WINDOW_REPOSITIONING_DELAY = 750; var LAYOUT_SCALE_WEIGHT = 1; var LAYOUT_SPACE_WEIGHT = 0.1; -const BACKGROUND_CORNER_RADIUS_PIXELS = 30; const BACKGROUND_MARGIN = 12; // Window Thumbnail Layout Algorithm @@ -919,8 +918,8 @@ class WorkspaceBackground extends St.Widget { } _updateBorderRadius() { - const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage); - const cornerRadius = scaleFactor * BACKGROUND_CORNER_RADIUS_PIXELS; + const themeNode = this.get_theme_node(); + const cornerRadius = themeNode.get_border_radius(St.Corner.TOPLEFT); const backgroundContent = this._bgManager.backgroundActor.content; backgroundContent.rounded_clip_radius = -- GitLab