mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 07:03:15 -04:00
x11: iterate only visuals from the matching screen
This commit is contained in:
committed by
Kirill Chibisov
parent
9ceb8d4144
commit
b02a70e6bb
@@ -212,13 +212,18 @@ impl UnownedWindow {
|
||||
None => xconn.default_screen_index() as c_int,
|
||||
};
|
||||
|
||||
// An iterator over all of the visuals combined with their depths.
|
||||
let mut all_visuals = xconn
|
||||
.xcb_connection()
|
||||
.setup()
|
||||
.roots
|
||||
let screen = {
|
||||
let screen_id_usize = usize::try_from(screen_id)
|
||||
.map_err(|_| os_error!(OsError::Misc("screen id must be non-negative")))?;
|
||||
xconn.xcb_connection().setup().roots.get(screen_id_usize).ok_or(os_error!(
|
||||
OsError::Misc("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
|
||||
.allowed_depths
|
||||
.iter()
|
||||
.flat_map(|root| &root.allowed_depths)
|
||||
.flat_map(|depth| depth.visuals.iter().map(move |visual| (visual, depth.depth)));
|
||||
|
||||
// creating
|
||||
|
||||
Reference in New Issue
Block a user