diff --git a/src/backend/render/clipped_surface.rs b/src/backend/render/clipped_surface.rs index 955972f2..6f2a2d0c 100644 --- a/src/backend/render/clipped_surface.rs +++ b/src/backend/render/clipped_surface.rs @@ -97,10 +97,10 @@ where Uniform::new( "corner_radius", [ - radius[0] as f32, - radius[1] as f32, - radius[2] as f32, radius[3] as f32, + radius[1] as f32, + radius[0] as f32, + radius[2] as f32, ], ), Uniform::new( @@ -142,10 +142,10 @@ where geo: Rectangle, radius: [u8; 4], ) -> [Rectangle; 4] { - let top_left = radius[0] as f64; + let top_left = radius[3] as f64; let top_right = radius[1] as f64; - let bottom_right = radius[2] as f64; - let bottom_left = radius[3] as f64; + let bottom_right = radius[0] as f64; + let bottom_left = radius[2] as f64; [ Rectangle::new(geo.loc, Size::from((top_left, top_left))), diff --git a/src/backend/render/shaders/clipped_surface.frag b/src/backend/render/shaders/clipped_surface.frag index b3dd9c21..dd863d23 100644 --- a/src/backend/render/shaders/clipped_surface.frag +++ b/src/backend/render/shaders/clipped_surface.frag @@ -30,17 +30,17 @@ float rounding_alpha(vec2 coords, vec2 size) { vec2 center; float radius; - if (coords.x < corner_radius.w && coords.y < corner_radius.w) { - radius = corner_radius.w; + if (coords.x < corner_radius.x && coords.y < corner_radius.x) { + radius = corner_radius.x; center = vec2(radius, radius); } else if (size.x - corner_radius.y < coords.x && coords.y < corner_radius.y) { radius = corner_radius.y; center = vec2(size.x - radius, radius); - } else if (size.x - corner_radius.x < coords.x && size.y - corner_radius.x < coords.y) { - radius = corner_radius.x; - center = vec2(size.x - radius, size.y - radius); - } else if (coords.x < corner_radius.z && size.y - corner_radius.z < coords.y) { + } else if (size.x - corner_radius.z < coords.x && size.y - corner_radius.z < coords.y) { radius = corner_radius.z; + center = vec2(size.x - radius, size.y - radius); + } else if (coords.x < corner_radius.w && size.y - corner_radius.w < coords.y) { + radius = corner_radius.w; center = vec2(radius, size.y - radius); } else { return 1.0; diff --git a/src/backend/render/shaders/shadow.frag b/src/backend/render/shaders/shadow.frag index dfe2c15f..fb72349e 100644 --- a/src/backend/render/shaders/shadow.frag +++ b/src/backend/render/shaders/shadow.frag @@ -74,17 +74,17 @@ float rounding_alpha(vec2 coords, vec2 size, vec4 corner_radius) { vec2 center; float radius; - if (coords.x < corner_radius.w && coords.y < corner_radius.w) { - radius = corner_radius.w; + if (coords.x < corner_radius.x && coords.y < corner_radius.x) { + radius = corner_radius.x; center = vec2(radius, radius); } else if (size.x - corner_radius.y < coords.x && coords.y < corner_radius.y) { radius = corner_radius.y; center = vec2(size.x - radius, radius); - } else if (size.x - corner_radius.x < coords.x && size.y - corner_radius.x < coords.y) { - radius = corner_radius.x; - center = vec2(size.x - radius, size.y - radius); - } else if (coords.x < corner_radius.z && size.y - corner_radius.z < coords.y) { + } else if (size.x - corner_radius.z < coords.x && size.y - corner_radius.z < coords.y) { radius = corner_radius.z; + center = vec2(size.x - radius, size.y - radius); + } else if (coords.x < corner_radius.w && size.y - corner_radius.w < coords.y) { + radius = corner_radius.w; center = vec2(radius, size.y - radius); } else { return 1.0; diff --git a/src/backend/render/shadow.rs b/src/backend/render/shadow.rs index 1d8415f1..de1da810 100644 --- a/src/backend/render/shadow.rs +++ b/src/backend/render/shadow.rs @@ -82,6 +82,12 @@ impl ShadowShader { let offset = [0., 5.]; let color = [0., 0., 0., 0.45]; let radius = radius.map(|r| ceil(r as f64)); + let radius = [ + radius[3], // top_left + radius[1], // top_right + radius[0], // bottom_right + radius[2], // bottom_left + ]; let width = softness; let sigma = width / 2.; diff --git a/src/shell/element/window.rs b/src/shell/element/window.rs index 543c7d74..c1f129b2 100644 --- a/src/shell/element/window.rs +++ b/src/shell/element/window.rs @@ -391,12 +391,12 @@ impl CosmicWindow { .map(|x| x.round() as u8); if has_ssd && !clip { // bottom corners - radii[1] = 0; - radii[3] = 0; + radii[0] = 0; + radii[2] = 0; if is_tiled { // top corners - radii[0] = 0; - radii[2] = 0; + radii[1] = 0; + radii[3] = 0; } } @@ -456,12 +456,12 @@ impl CosmicWindow { && !is_maximized; if has_ssd && !clip { // bottom corners - radii[1] = 0; - radii[3] = 0; + radii[0] = 0; + radii[2] = 0; if is_tiled { // top corners - radii[0] = 0; - radii[2] = 0; + radii[1] = 0; + radii[3] = 0; } } @@ -513,8 +513,8 @@ impl CosmicWindow { .into_iter() .map(|elem| { if has_ssd { - radii[0] = 0; - radii[2] = 0; + radii[1] = 0; + radii[3] = 0; } if radii.iter().any(|x| *x != 0) && clip