Expose public Window::set_mouse_cursor method (#161)
The X11 backend has a full implementation of a `Window::set_mouse_cursor` method, but it isn't exposed via any public interface, which results in a lot of warnings for unused code. Add a public `set_mouse_cursor` method, along with stubbed-out versions in the Windows and macOS backends.
This commit is contained in:
parent
0976a9a6a4
commit
7d14a555e5
|
@ -24,8 +24,8 @@ use raw_window_handle::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Event, EventStatus, Size, WindowEvent, WindowHandler, WindowInfo, WindowOpenOptions,
|
Event, EventStatus, MouseCursor, Size, WindowEvent, WindowHandler, WindowInfo,
|
||||||
WindowScalePolicy,
|
WindowOpenOptions, WindowScalePolicy,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::keyboard::KeyboardState;
|
use super::keyboard::KeyboardState;
|
||||||
|
@ -302,6 +302,10 @@ impl Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_mouse_cursor(&mut self, _mouse_cursor: MouseCursor) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "opengl")]
|
#[cfg(feature = "opengl")]
|
||||||
pub fn gl_context(&self) -> Option<&GlContext> {
|
pub fn gl_context(&self) -> Option<&GlContext> {
|
||||||
self.gl_context.as_ref()
|
self.gl_context.as_ref()
|
||||||
|
|
|
@ -34,7 +34,7 @@ use raw_window_handle::{
|
||||||
const BV_WINDOW_MUST_CLOSE: UINT = WM_USER + 1;
|
const BV_WINDOW_MUST_CLOSE: UINT = WM_USER + 1;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Event, MouseButton, MouseEvent, PhyPoint, PhySize, ScrollDelta, Size, WindowEvent,
|
Event, MouseButton, MouseCursor, MouseEvent, PhyPoint, PhySize, ScrollDelta, Size, WindowEvent,
|
||||||
WindowHandler, WindowInfo, WindowOpenOptions, WindowScalePolicy,
|
WindowHandler, WindowInfo, WindowOpenOptions, WindowScalePolicy,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -765,6 +765,10 @@ impl Window<'_> {
|
||||||
self.state.deferred_tasks.borrow_mut().push_back(task);
|
self.state.deferred_tasks.borrow_mut().push_back(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_mouse_cursor(&mut self, _mouse_cursor: MouseCursor) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "opengl")]
|
#[cfg(feature = "opengl")]
|
||||||
pub fn gl_context(&self) -> Option<&GlContext> {
|
pub fn gl_context(&self) -> Option<&GlContext> {
|
||||||
self.state.gl_context.as_ref()
|
self.state.gl_context.as_ref()
|
||||||
|
|
|
@ -6,7 +6,7 @@ use raw_window_handle::{
|
||||||
|
|
||||||
use crate::event::{Event, EventStatus};
|
use crate::event::{Event, EventStatus};
|
||||||
use crate::window_open_options::WindowOpenOptions;
|
use crate::window_open_options::WindowOpenOptions;
|
||||||
use crate::Size;
|
use crate::{MouseCursor, Size};
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use crate::macos as platform;
|
use crate::macos as platform;
|
||||||
|
@ -101,6 +101,10 @@ impl<'a> Window<'a> {
|
||||||
self.window.resize(size);
|
self.window.resize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_mouse_cursor(&mut self, cursor: MouseCursor) {
|
||||||
|
self.window.set_mouse_cursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
/// If provided, then an OpenGL context will be created for this window. You'll be able to
|
/// If provided, then an OpenGL context will be created for this window. You'll be able to
|
||||||
/// access this context through [crate::Window::gl_context].
|
/// access this context through [crate::Window::gl_context].
|
||||||
#[cfg(feature = "opengl")]
|
#[cfg(feature = "opengl")]
|
||||||
|
|
|
@ -97,7 +97,6 @@ pub struct Window {
|
||||||
window_id: u32,
|
window_id: u32,
|
||||||
window_info: WindowInfo,
|
window_info: WindowInfo,
|
||||||
visual_id: u32,
|
visual_id: u32,
|
||||||
// FIXME: There's all this mouse cursor logic but it's never actually used, is this correct?
|
|
||||||
mouse_cursor: MouseCursor,
|
mouse_cursor: MouseCursor,
|
||||||
|
|
||||||
frame_interval: Duration,
|
frame_interval: Duration,
|
||||||
|
|
|
@ -19,7 +19,6 @@ pub struct XcbConnection {
|
||||||
|
|
||||||
pub(crate) atoms: Atoms,
|
pub(crate) atoms: Atoms,
|
||||||
|
|
||||||
// FIXME: Same here, there's a ton of unused cursor machinery in here
|
|
||||||
pub(super) cursor_cache: HashMap<MouseCursor, u32>,
|
pub(super) cursor_cache: HashMap<MouseCursor, u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue