Skip to content

Commit

Permalink
Merge pull request #733 from Cyres/master
Browse files Browse the repository at this point in the history
Add SDL_GetWindowBordersSize()
  • Loading branch information
Cobrand authored Dec 12, 2017
2 parents 871700e + 9b419fe commit b83be89
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/sdl2/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,23 @@ impl Window {
unsafe { sys::SDL_GetWindowPosition(self.context.raw, &mut x, &mut y) };
(x as i32, y as i32)
}

/// Use this function to get the size of a window's borders (decorations) around the client area.
///
/// # Remarks
/// This function is only supported on X11, otherwise an error is returned.
pub fn border_size(&self) -> Result<(u16, u16, u16, u16), String> {
let mut top: c_int = 0;
let mut left: c_int = 0;
let mut bottom: c_int = 0;
let mut right: c_int = 0;
let result = unsafe { sys::SDL_GetWindowBordersSize(self.context.raw, &mut top, &mut left, &mut bottom, &mut right) };
if result < 0 {
Err(get_error())
} else {
Ok((top as u16, left as u16, bottom as u16, right as u16))
}
}

pub fn set_size(&mut self, width: u32, height: u32)
-> Result<(), IntegerOrSdlError> {
Expand Down

0 comments on commit b83be89

Please sign in to comment.