Skip to content

Commit

Permalink
Apply @notgull's suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
strohel authored and notgull committed Oct 30, 2024
1 parent 9d347b7 commit d3207a8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/platform_impl/linux/x11/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,13 @@ impl UnownedWindow {
None => xconn.default_screen_index() as c_int,
};

let screen_id_usize = usize::try_from(screen_id)
.map_err(|_| NotSupportedError::new("screen id must be non-negative"))?;
let screen = xconn.xcb_connection().setup().roots.get(screen_id_usize).ok_or(
NotSupportedError::new("requested screen id not present in server's response"),
)?;
let screen = {
let screen_id_usize = usize::try_from(screen_id)
.map_err(|_| NotSupportedError::new("screen id must be non-negative"))?;
xconn.xcb_connection().setup().roots.get(screen_id_usize).ok_or(
NotSupportedError::new("requested screen id not present in server's response"),
)?
};

// An iterator over the visuals matching screen id combined with their depths.
let mut all_visuals = screen
Expand Down

0 comments on commit d3207a8

Please sign in to comment.