Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix x11 window size calculations #402

Merged
merged 1 commit into from
Feb 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/platform/linux/x11/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,17 @@ impl Window2 {
let mut border: libc::c_uint = mem::uninitialized();
let mut depth: libc::c_uint = mem::uninitialized();

// Get non-positioning data from winit window
if (self.x.display.xlib.XGetGeometry)(self.x.display.display, self.x.window,
&mut root, &mut x, &mut y, &mut width, &mut height,
&mut border, &mut depth) == 0
{
return None;
}

let width_out = width;
let height_out = height;
let border_out = border;

// Some window managers like i3wm will actually nest application
// windows (like those opened by winit) within other windows to, for
Expand Down Expand Up @@ -562,7 +573,7 @@ impl Window2 {
return None;
}

Some((x as i32, y as i32, width as u32, height as u32, border as u32))
Some((x as i32, y as i32, width_out as u32, height_out as u32, border_out as u32))
}
}

Expand Down