Skip to content
Draft
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
26 changes: 26 additions & 0 deletions src/sdl2/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,14 @@ impl Window {
//pub fn SDL_GetWindowData(window: *SDL_Window, name: *c_char) -> *c_void;

pub fn set_position(&mut self, x: WindowPos, y: WindowPos) {
if cfg!(target_os="macos") {
let _x = to_ll_windowpos(x);
let _y = to_ll_windowpos(y);
assert!(
_x >= -16_000 && _x <= 16_000 && _y >= 16_000 && _y <= 16_000,
"the window server limits window position coordinates to ±16,000."
);
}
unsafe {
sys::SDL_SetWindowPosition(
self.context.raw, to_ll_windowpos(x), to_ll_windowpos(y)
Expand Down Expand Up @@ -1286,6 +1294,12 @@ impl Window {
-> Result<(), IntegerOrSdlError> {
let w = r#try!(validate_int(width, "width"));
let h = r#try!(validate_int(height, "height"));
if cfg!(target_os="macos") {
assert!(
w <= 10_000 && h <= 10_000,
"the window server limits window sizes to 10,000."
);
}
Ok(unsafe {
sys::SDL_SetWindowSize(self.context.raw, w, h)
})
Expand Down Expand Up @@ -1316,6 +1330,12 @@ impl Window {
-> Result<(), IntegerOrSdlError> {
let w = r#try!(validate_int(width, "width"));
let h = r#try!(validate_int(height, "height"));
if cfg!(target_os="macos") {
assert!(
w <= 10_000 && h <= 10_000,
"the window server limits window sizes to 10,000."
);
}
Ok(unsafe {
sys::SDL_SetWindowMinimumSize(self.context.raw, w, h)
})
Expand All @@ -1332,6 +1352,12 @@ impl Window {
-> Result<(), IntegerOrSdlError> {
let w = r#try!(validate_int(width, "width"));
let h = r#try!(validate_int(height, "height"));
if cfg!(target_os="macos") {
assert!(
w <= 10_000 && h <= 10_000,
"the window server limits window sizes to 10,000."
);
}
Ok(unsafe {
sys::SDL_SetWindowMaximumSize(self.context.raw, w, h)
})
Expand Down