Skip to content

Commit

Permalink
Fix some outdated multi-threaded code
Browse files Browse the repository at this point in the history
  • Loading branch information
Osspial committed Apr 2, 2018
1 parent f3103ea commit 7a71b84
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/platform/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl Window {
pub fn set_position(&self, x: i32, y: i32) {
unsafe {
winuser::SetWindowPos(self.window.0, ptr::null_mut(), x as raw::c_int, y as raw::c_int,
0, 0, winuser::SWP_ASYNCWINDOWPOS | winuser::SWP_NOZORDER | winuser::SWP_NOSIZE);
0, 0, winuser::SWP_NOZORDER | winuser::SWP_NOSIZE);
winuser::UpdateWindow(self.window.0);
}
}
Expand Down Expand Up @@ -147,16 +147,15 @@ impl Window {
let outer_y = (rect.top - rect.bottom).abs() as raw::c_int;

winuser::SetWindowPos(self.window.0, ptr::null_mut(), 0, 0, outer_x, outer_y,
winuser::SWP_ASYNCWINDOWPOS | winuser::SWP_NOZORDER | winuser::SWP_NOREPOSITION | winuser::SWP_NOMOVE);
winuser::SWP_NOZORDER | winuser::SWP_NOREPOSITION | winuser::SWP_NOMOVE);
winuser::UpdateWindow(self.window.0);
}
}

/// See the docs in the crate root file.
#[inline]
pub fn set_min_dimensions(&self, dimensions: Option<(u32, u32)>) {
let mut window_state = self.window_state.lock().unwrap();
window_state.attributes.min_dimensions = dimensions;
self.window_state.borrow_mut().attributes.min_dimensions = dimensions;

// Make windows re-check the window size bounds.
if let Some(inner_size) = self.get_inner_size() {
Expand All @@ -170,16 +169,15 @@ impl Window {
let outer_y = (rect.top - rect.bottom).abs() as raw::c_int;

winuser::SetWindowPos(self.window.0, ptr::null_mut(), 0, 0, outer_x, outer_y,
winuser::SWP_ASYNCWINDOWPOS | winuser::SWP_NOZORDER | winuser::SWP_NOREPOSITION | winuser::SWP_NOMOVE);
winuser::SWP_NOZORDER | winuser::SWP_NOREPOSITION | winuser::SWP_NOMOVE);
}
}
}

/// See the docs in the crate root file.
#[inline]
pub fn set_max_dimensions(&self, dimensions: Option<(u32, u32)>) {
let mut window_state = self.window_state.lock().unwrap();
window_state.attributes.max_dimensions = dimensions;
self.window_state.borrow_mut().attributes.max_dimensions = dimensions;

// Make windows re-check the window size bounds.
if let Some(inner_size) = self.get_inner_size() {
Expand All @@ -193,7 +191,7 @@ impl Window {
let outer_y = (rect.top - rect.bottom).abs() as raw::c_int;

winuser::SetWindowPos(self.window.0, ptr::null_mut(), 0, 0, outer_x, outer_y,
winuser::SWP_ASYNCWINDOWPOS | winuser::SWP_NOZORDER | winuser::SWP_NOREPOSITION | winuser::SWP_NOMOVE);
winuser::SWP_NOZORDER | winuser::SWP_NOREPOSITION | winuser::SWP_NOMOVE);
}
}
}
Expand Down

0 comments on commit 7a71b84

Please sign in to comment.