render: Respect scale for indicator thickness

This commit is contained in:
Victoria Brekenfeld 2023-08-31 18:17:37 +02:00
parent d394240fe6
commit 380b00e083
4 changed files with 18 additions and 2 deletions

View file

@ -155,6 +155,7 @@ impl IndicatorShader {
key: impl Into<Key>,
mut element_geo: Rectangle<i32, Logical>,
thickness: u8,
scale: f64,
alpha: f32,
) -> PixelShaderElement {
let t = thickness as i32;
@ -168,6 +169,7 @@ impl IndicatorShader {
thickness,
thickness * 2,
alpha,
scale,
FOCUS_INDICATOR_COLOR,
)
}
@ -179,8 +181,11 @@ impl IndicatorShader {
thickness: u8,
radius: u8,
alpha: f32,
scale: f64,
color: [f32; 3],
) -> PixelShaderElement {
let thickness = (thickness as f64 * scale).round() as u8;
let settings = IndicatorSettings {
thickness,
radius,

View file

@ -32,7 +32,7 @@ use smithay::{
},
output::Output,
reexports::wayland_server::protocol::wl_surface::WlSurface,
utils::{IsAlive, Logical, Point, Rectangle, Serial},
utils::{IsAlive, Logical, Point, Rectangle, Scale, Serial},
wayland::compositor::SurfaceData,
};
use std::{
@ -83,7 +83,7 @@ impl MoveGrabState {
return Vec::new();
}
let output_scale = output.current_scale().fractional_scale().into();
let output_scale: Scale<f64> = output.current_scale().fractional_scale().into();
let scaling_offset =
self.window_offset - self.window_offset.to_f64().upscale(scale).to_i32_round();
let render_location =
@ -104,6 +104,7 @@ impl MoveGrabState {
.to_i32_round(),
),
self.indicator_thickness,
output_scale.x,
1.0,
))
.into(),

View file

@ -517,6 +517,7 @@ impl FloatingLayout {
elem.clone(),
indicator_geometry,
indicator_thickness,
output_scale,
alpha,
);
window_elements.push(element.into());

View file

@ -2319,6 +2319,7 @@ impl TilingLayout {
None,
1.0,
overview.alpha().unwrap(),
1.0,
placeholder_id,
Some(None),
)
@ -2984,6 +2985,7 @@ impl TilingLayout {
// but for that we have to associate focus with a tree (and animate focus changes properly)
1.0 - transition,
transition,
output_scale,
&self.placeholder_id,
is_mouse_tiling,
)
@ -3017,6 +3019,7 @@ impl TilingLayout {
seat,
transition,
transition,
output_scale,
&self.placeholder_id,
is_mouse_tiling,
)
@ -3072,6 +3075,7 @@ fn geometries_for_groupview<'a, R>(
seat: Option<&Seat<State>>,
alpha: f32,
transition: f32,
output_scale: f64,
placeholder_id: &Id,
mouse_tiling: Option<Option<&TargetZone>>,
) -> Option<(
@ -3238,6 +3242,7 @@ where
4,
if render_active_child { 16 } else { 8 },
alpha * if render_potential_group { 0.40 } else { 1.0 },
output_scale,
GROUP_COLOR,
)
.into(),
@ -3255,6 +3260,7 @@ where
4,
8,
alpha * 0.40,
output_scale,
GROUP_COLOR,
)
.into(),
@ -3321,6 +3327,7 @@ where
4,
8,
alpha * 0.15,
output_scale,
GROUP_COLOR,
)
.into(),
@ -3520,6 +3527,7 @@ where
4,
8,
alpha * 0.40,
output_scale,
GROUP_COLOR,
)
.into(),
@ -3913,6 +3921,7 @@ where
} else {
indicator_thickness
},
output_scale,
1.0,
));
}