Skip to content

Commit 89c051c

Browse files
authored
Add error checking on X11 window creation, and fix parented X11 window creation (#113)
1 parent 004065e commit 89c051c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/x11/window.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl Window {
206206
let window_info = WindowInfo::from_logical_size(options.size, scaling);
207207

208208
let window_id = xcb_connection.conn.generate_id();
209-
xcb::create_window(
209+
xcb::create_window_checked(
210210
&xcb_connection.conn,
211211
xcb::COPY_FROM_PARENT as u8,
212212
window_id,
@@ -217,7 +217,7 @@ impl Window {
217217
window_info.physical_size().height as u16, // window height
218218
0, // window border
219219
xcb::WINDOW_CLASS_INPUT_OUTPUT as u16,
220-
screen.root_visual(),
220+
if parent.is_some() { xcb::COPY_FROM_PARENT as u32 } else { screen.root_visual() },
221221
&[(
222222
xcb::CW_EVENT_MASK,
223223
xcb::EVENT_MASK_EXPOSURE
@@ -228,7 +228,7 @@ impl Window {
228228
| xcb::EVENT_MASK_KEY_RELEASE
229229
| xcb::EVENT_MASK_STRUCTURE_NOTIFY,
230230
)],
231-
);
231+
).request_check().unwrap();
232232

233233
xcb::map_window(&xcb_connection.conn, window_id);
234234

0 commit comments

Comments
 (0)