Fix clippy warnings in x11.rs
This commit is contained in:
parent
736e258d25
commit
4e276dc7ee
17
src/x11.rs
17
src/x11.rs
@ -94,6 +94,15 @@ impl X11Session {
|
|||||||
self.conn
|
self.conn
|
||||||
.create_pixmap(self.depth, pixmap, self.root, self.width, self.height)?;
|
.create_pixmap(self.depth, pixmap, self.root, self.width, self.height)?;
|
||||||
|
|
||||||
|
let width = u16::try_from(prepared.width)
|
||||||
|
.map_err(|_| anyhow::anyhow!("Image width exceeds X11 limits"))?;
|
||||||
|
let height = u16::try_from(prepared.height)
|
||||||
|
.map_err(|_| anyhow::anyhow!("Image height exceeds X11 limits"))?;
|
||||||
|
let offset_x = i16::try_from(prepared.offset_x)
|
||||||
|
.map_err(|_| anyhow::anyhow!("X offset exceeds X11 limits"))?;
|
||||||
|
let offset_y = i16::try_from(prepared.offset_y)
|
||||||
|
.map_err(|_| anyhow::anyhow!("Y offset exceeds X11 limits"))?;
|
||||||
|
|
||||||
// Create a Graphics Context (GC).
|
// Create a Graphics Context (GC).
|
||||||
// A GC is required by X11 for image uploads, even though most of its
|
// A GC is required by X11 for image uploads, even though most of its
|
||||||
// drawing settings are unused when using put_image.
|
// drawing settings are unused when using put_image.
|
||||||
@ -107,10 +116,10 @@ impl X11Session {
|
|||||||
ImageFormat::Z_PIXMAP,
|
ImageFormat::Z_PIXMAP,
|
||||||
pixmap, // drawable: Destination pixmap (wallpaper image)
|
pixmap, // drawable: Destination pixmap (wallpaper image)
|
||||||
gc, // Graphics Context (required by X11)
|
gc, // Graphics Context (required by X11)
|
||||||
prepared.width as u16,
|
width,
|
||||||
prepared.height as u16, // width/height: size of the uploaded image region in pixels
|
height, // width/height: size of the uploaded image region in pixels
|
||||||
prepared.offset_x as i16,
|
offset_x,
|
||||||
prepared.offset_y as i16, // dst_x/dst_y: Destination offset inside the pixmap (top-left corner)
|
offset_y, // dst_x/dst_y: Destination offset inside the pixmap (top-left corner)
|
||||||
0, // left_pad: legacy bitmap padding, always 0 for modern images
|
0, // left_pad: legacy bitmap padding, always 0 for modern images
|
||||||
self.depth, // depth: must match the root window's depth (usually 24 or 32)
|
self.depth, // depth: must match the root window's depth (usually 24 or 32)
|
||||||
&prepared.pixels, // data: raw BGRA/BGRX pixel buffer
|
&prepared.pixels, // data: raw BGRA/BGRX pixel buffer
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user