1
0
Fork 0

Add error checking on X11 window creation, and fix parented X11 window creation (#113)

This commit is contained in:
Adrien Prokopowicz 2022-02-07 00:55:12 +01:00 committed by GitHub
parent 004065e9a4
commit 89c051cccc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -206,7 +206,7 @@ impl Window {
let window_info = WindowInfo::from_logical_size(options.size, scaling); let window_info = WindowInfo::from_logical_size(options.size, scaling);
let window_id = xcb_connection.conn.generate_id(); let window_id = xcb_connection.conn.generate_id();
xcb::create_window( xcb::create_window_checked(
&xcb_connection.conn, &xcb_connection.conn,
xcb::COPY_FROM_PARENT as u8, xcb::COPY_FROM_PARENT as u8,
window_id, window_id,
@ -217,7 +217,7 @@ impl Window {
window_info.physical_size().height as u16, // window height window_info.physical_size().height as u16, // window height
0, // window border 0, // window border
xcb::WINDOW_CLASS_INPUT_OUTPUT as u16, 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::CW_EVENT_MASK,
xcb::EVENT_MASK_EXPOSURE xcb::EVENT_MASK_EXPOSURE
@ -228,7 +228,7 @@ impl Window {
| xcb::EVENT_MASK_KEY_RELEASE | xcb::EVENT_MASK_KEY_RELEASE
| xcb::EVENT_MASK_STRUCTURE_NOTIFY, | xcb::EVENT_MASK_STRUCTURE_NOTIFY,
)], )],
); ).request_check().unwrap();
xcb::map_window(&xcb_connection.conn, window_id); xcb::map_window(&xcb_connection.conn, window_id);