Add methods to get the position of a window's client area, relative to the desktop (#430)
* Add get_inner_position for windows, prototypes for other platforms * Fix linux builds * Implement get_inner_position for osx * Add get_inner_pos implementations for other platforms * Fixed get_inner_position on macOS * Corrected set_position on macOS * Added CHANGELOG entry
This commit is contained in:
parent
10688915eb
commit
8fd49a4dbe
10 changed files with 93 additions and 23 deletions
|
|
@ -129,6 +129,17 @@ impl Window {
|
|||
Some((rect.left as i32, rect.top as i32))
|
||||
}
|
||||
|
||||
pub fn get_inner_position(&self) -> Option<(i32, i32)> {
|
||||
use std::mem;
|
||||
|
||||
let mut position: POINT = unsafe{ mem::zeroed() };
|
||||
if unsafe{ winuser::ClientToScreen(self.window.0, &mut position) } == 0 {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some((position.x, position.y))
|
||||
}
|
||||
|
||||
/// See the docs in the crate root file.
|
||||
pub fn set_position(&self, x: i32, y: i32) {
|
||||
unsafe {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue