mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 22:31:30 +11:00
Add set_cursor_position function
This commit is contained in:
parent
277b66a708
commit
c61c33a833
|
@ -356,6 +356,10 @@ impl Window {
|
||||||
pub fn hidpi_factor(&self) -> f32 {
|
pub fn hidpi_factor(&self) -> f32 {
|
||||||
1.0
|
1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_cursor_position(&self, x: i32, y: i32) -> Result<(), ()> {
|
||||||
|
unimplemented!();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl Send for Window {}
|
unsafe impl Send for Window {}
|
||||||
|
|
|
@ -664,4 +664,8 @@ impl Window {
|
||||||
NSWindow::backingScaleFactor(self.window) as f32
|
NSWindow::backingScaleFactor(self.window) as f32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_cursor_position(&self, x: i32, y: i32) -> Result<(), ()> {
|
||||||
|
unimplemented!();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,6 +255,25 @@ impl Window {
|
||||||
pub fn hidpi_factor(&self) -> f32 {
|
pub fn hidpi_factor(&self) -> f32 {
|
||||||
1.0
|
1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_cursor_position(&self, x: i32, y: i32) -> Result<(), ()> {
|
||||||
|
let mut point = winapi::POINT {
|
||||||
|
x: x,
|
||||||
|
y: y,
|
||||||
|
};
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
if user32::ClientToScreen(self.window.0, &mut point) == 0 {
|
||||||
|
return Err(());
|
||||||
|
}
|
||||||
|
|
||||||
|
if user32::SetCursorPos(point.x, point.y) == 0 {
|
||||||
|
return Err(());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct PollEventsIterator<'a> {
|
pub struct PollEventsIterator<'a> {
|
||||||
|
|
|
@ -409,6 +409,11 @@ impl Window {
|
||||||
pub fn hidpi_factor(&self) -> f32 {
|
pub fn hidpi_factor(&self) -> f32 {
|
||||||
self.window.hidpi_factor()
|
self.window.hidpi_factor()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Changes the position of the cursor in window coordinates.
|
||||||
|
pub fn set_cursor_position(&self, x: i32, y: i32) -> Result<(), ()> {
|
||||||
|
self.window.set_cursor_position(x, y)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl gl_common::GlFunctionsSource for Window {
|
impl gl_common::GlFunctionsSource for Window {
|
||||||
|
|
|
@ -785,4 +785,8 @@ impl Window {
|
||||||
pub fn hidpi_factor(&self) -> f32 {
|
pub fn hidpi_factor(&self) -> f32 {
|
||||||
1.0
|
1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_cursor_position(&self, x: i32, y: i32) -> Result<(), ()> {
|
||||||
|
unimplemented!();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue