Merge branch 'fix-issue-4096' into 'main'

Rounded corners for workspace previews

Closes #4096

See merge request GNOME/gnome-shell!2122
This commit is contained in:
Daniel van Vugt 2024-06-29 09:32:03 +00:00
commit cb23e3e1c5
2 changed files with 10 additions and 4 deletions

View file

@ -1005,8 +1005,12 @@ class WorkspaceBackground extends Shell.WorkspaceBackground {
const cornerRadius = scaleFactor * BACKGROUND_CORNER_RADIUS_PIXELS;
const backgroundContent = this._bgManager.backgroundActor.content;
// Map ControlsState {0, 1, 2} to progress {0.0, 1.0, 1.0}
const roundedCornerProgress =
Math.clamp(this._stateAdjustment.value, 0, 1);
backgroundContent.rounded_clip_radius =
Util.lerp(0, cornerRadius, this._stateAdjustment.value);
Util.lerp(0, cornerRadius, roundedCornerProgress);
}
_updateRoundedClipBounds() {
@ -1048,7 +1052,7 @@ class Workspace extends St.Widget {
// Background
this._background =
new WorkspaceBackground(monitorIndex, layoutManager.stateAdjustment);
new WorkspaceBackground(monitorIndex, overviewAdjustment);
this.add_child(this._background);
// Window previews

View file

@ -70,6 +70,7 @@ shell_workspace_background_allocate (ClutterActor *actor,
int left_offset, right_offset;
int top_offset, bottom_offset;
int scale_factor;
float progress;
scale_factor = st_theme_context_get_scale_factor (context);
@ -81,8 +82,9 @@ shell_workspace_background_allocate (ClutterActor *actor,
scaled_box.y1 = box->y1 + (height - scaled_height) / 2;
clutter_actor_box_set_size (&scaled_box, scaled_width, scaled_height);
clutter_actor_box_interpolate(box, &scaled_box,
self->state_adjustment_value, &my_box);
// Map ControlsState {0, 1, 2} to progress {0.0, 1.0, 0.0}
progress = 1.f - fabs (1.f - self->state_adjustment_value);
clutter_actor_box_interpolate(box, &scaled_box, progress, &my_box);
clutter_actor_set_allocation (actor, &my_box);