diff options
| author | srdusr <[email protected]> | 2024-07-10 22:11:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2024-07-10 22:11:00 +0200 |
| commit | 68b645b43e19330474ff106ce5c88dab520d7417 (patch) | |
| tree | 35d0fd75831a0f60a8c120186c2782b081423457 /crates/wayland | |
| parent | d2952af18b907a5b18fccd26468a74aabe49bb2f (diff) | |
| download | srdwm-68b645b43e19330474ff106ce5c88dab520d7417.tar.gz srdwm-68b645b43e19330474ff106ce5c88dab520d7417.zip | |
Fix three pre-existing clippy warnings
- ipc.rs: drop a u64 -> u64 no-op cast (WindowId is a plain u64 alias).
- decoration.rs: draw_line took 8 args; bundle the two endpoints into
(i32, i32) tuples instead of four loose coordinates.
- output_management.rs: collapse a WEnum::Value if-let directly into
the outer SetTransform match arm's pattern.
Diffstat (limited to 'crates/wayland')
| -rw-r--r-- | crates/wayland/src/decoration.rs | 19 | ||||
| -rw-r--r-- | crates/wayland/src/output_management.rs | 6 |
2 files changed, 12 insertions, 13 deletions
diff --git a/crates/wayland/src/decoration.rs b/crates/wayland/src/decoration.rs index 4aa0b2d..2888d69 100644 --- a/crates/wayland/src/decoration.rs +++ b/crates/wayland/src/decoration.rs @@ -426,8 +426,9 @@ fn button_box(width: usize, height: usize, right_offset: usize) -> (i32, i32, i3 } /// Bresenham line, since none of these icons need anything fancier. -fn draw_line(buf: &mut [u8], width: usize, height: usize, x0: i32, y0: i32, x1: i32, y1: i32, color: (u8, u8, u8)) { - let (mut x0, mut y0) = (x0, y0); +fn draw_line(buf: &mut [u8], width: usize, height: usize, from: (i32, i32), to: (i32, i32), color: (u8, u8, u8)) { + let (mut x0, mut y0) = from; + let (x1, y1) = to; let dx = (x1 - x0).abs(); let dy = -(y1 - y0).abs(); let sx = if x0 < x1 { 1 } else { -1 }; @@ -452,21 +453,21 @@ fn draw_line(buf: &mut [u8], width: usize, height: usize, x0: i32, y0: i32, x1: fn draw_close_icon(buf: &mut [u8], width: usize, height: usize, right_offset: usize, color: (u8, u8, u8)) { let (x0, y0, x1, y1) = button_box(width, height, right_offset); - draw_line(buf, width, height, x0, y0, x1, y1, color); - draw_line(buf, width, height, x0, y1, x1, y0, color); + draw_line(buf, width, height, (x0, y0), (x1, y1), color); + draw_line(buf, width, height, (x0, y1), (x1, y0), color); } fn draw_maximize_icon(buf: &mut [u8], width: usize, height: usize, right_offset: usize, color: (u8, u8, u8)) { let (x0, y0, x1, y1) = button_box(width, height, right_offset); - draw_line(buf, width, height, x0, y0, x1, y0, color); - draw_line(buf, width, height, x0, y1, x1, y1, color); - draw_line(buf, width, height, x0, y0, x0, y1, color); - draw_line(buf, width, height, x1, y0, x1, y1, color); + draw_line(buf, width, height, (x0, y0), (x1, y0), color); + draw_line(buf, width, height, (x0, y1), (x1, y1), color); + draw_line(buf, width, height, (x0, y0), (x0, y1), color); + draw_line(buf, width, height, (x1, y0), (x1, y1), color); } fn draw_minimize_icon(buf: &mut [u8], width: usize, height: usize, right_offset: usize, color: (u8, u8, u8)) { let (x0, _, x1, y1) = button_box(width, height, right_offset); - draw_line(buf, width, height, x0, y1, x1, y1, color); + draw_line(buf, width, height, (x0, y1), (x1, y1), color); } #[allow(clippy::too_many_arguments)] diff --git a/crates/wayland/src/output_management.rs b/crates/wayland/src/output_management.rs index 4697a40..7849557 100644 --- a/crates/wayland/src/output_management.rs +++ b/crates/wayland/src/output_management.rs @@ -215,10 +215,8 @@ impl Dispatch<ZwlrOutputConfigurationHeadV1, ConfigurationHeadData> for CompStat match request { zwlr_output_configuration_head_v1::Request::SetPosition { x, y } => *position = Some((x, y)), zwlr_output_configuration_head_v1::Request::SetScale { scale: s } => *scale = Some(s), - zwlr_output_configuration_head_v1::Request::SetTransform { transform: t } => { - if let WEnum::Value(t) = t { - *transform = Some(wl_transform_to_smithay(t)); - } + zwlr_output_configuration_head_v1::Request::SetTransform { transform: WEnum::Value(t) } => { + *transform = Some(wl_transform_to_smithay(t)); } zwlr_output_configuration_head_v1::Request::SetMode { mode: mode_obj } => { if let Some(m) = mode_obj.data::<ModeData>() { |