From 89c051cccc1dd575479138387f91af556c5d05b7 Mon Sep 17 00:00:00 2001 From: Adrien Prokopowicz <6529475+prokopyl@users.noreply.github.com> Date: Mon, 7 Feb 2022 00:55:12 +0100 Subject: [PATCH] Add error checking on X11 window creation, and fix parented X11 window creation (#113) --- src/x11/window.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/x11/window.rs b/src/x11/window.rs index 5c3b7c7..8d3ba82 100644 --- a/src/x11/window.rs +++ b/src/x11/window.rs @@ -206,7 +206,7 @@ impl Window { let window_info = WindowInfo::from_logical_size(options.size, scaling); let window_id = xcb_connection.conn.generate_id(); - xcb::create_window( + xcb::create_window_checked( &xcb_connection.conn, xcb::COPY_FROM_PARENT as u8, window_id, @@ -217,7 +217,7 @@ impl Window { window_info.physical_size().height as u16, // window height 0, // window border xcb::WINDOW_CLASS_INPUT_OUTPUT as u16, - screen.root_visual(), + if parent.is_some() { xcb::COPY_FROM_PARENT as u32 } else { screen.root_visual() }, &[( xcb::CW_EVENT_MASK, xcb::EVENT_MASK_EXPOSURE @@ -228,7 +228,7 @@ impl Window { | xcb::EVENT_MASK_KEY_RELEASE | xcb::EVENT_MASK_STRUCTURE_NOTIFY, )], - ); + ).request_check().unwrap(); xcb::map_window(&xcb_connection.conn, window_id);