srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/wayland/src/decoration.rs
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2024-07-10 22:11:00 +0200
committersrdusr <[email protected]>2024-07-10 22:11:00 +0200
commit68b645b43e19330474ff106ce5c88dab520d7417 (patch)
tree35d0fd75831a0f60a8c120186c2782b081423457 /crates/wayland/src/decoration.rs
parentd2952af18b907a5b18fccd26468a74aabe49bb2f (diff)
downloadsrdwm-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/src/decoration.rs')
-rw-r--r--crates/wayland/src/decoration.rs19
1 files changed, 10 insertions, 9 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)]