-
Notifications
You must be signed in to change notification settings - Fork 790
feat(api): expose MouseCursor and set_mouse_cursor in public API #9330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 4 commits
eb0131c
067b9b8
79fa874
5928202
6f6401f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ This module contains types that are public and re-exported in the slint-rs as we | |
| pub use crate::future::*; | ||
| use crate::graphics::{Rgba8Pixel, SharedPixelBuffer}; | ||
| use crate::input::{KeyEventType, MouseEvent}; | ||
| pub use crate::items::MouseCursor; | ||
| use crate::window::{WindowAdapter, WindowInner}; | ||
| use alloc::boxed::Box; | ||
| use alloc::string::String; | ||
|
|
@@ -706,6 +707,11 @@ impl Window { | |
| pub fn take_snapshot(&self) -> Result<SharedPixelBuffer<Rgba8Pixel>, PlatformError> { | ||
| self.0.window_adapter().renderer().take_snapshot() | ||
| } | ||
|
|
||
| /// Sets the mouse cursor for this window. | ||
| pub fn set_mouse_cursor(&self, cursor: crate::items::MouseCursor) { | ||
| self.0.window_adapter().set_mouse_cursor(cursor); | ||
| } | ||
|
Comment on lines
+711
to
+714
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This API shouldn't need to be there. |
||
| } | ||
|
|
||
| pub use crate::SharedString; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,13 @@ | ||
| // Copyright © SixtyFPS GmbH <[email protected]> | ||
| // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 | ||
|
|
||
| use super::{ | ||
| DropEvent, Item, ItemConsts, ItemRc, MouseCursor, PointerEventButton, RenderingResult, | ||
| }; | ||
| use super::{DropEvent, Item, ItemConsts, ItemRc, PointerEventButton, RenderingResult}; | ||
| use crate::input::{ | ||
| FocusEvent, FocusEventResult, InputEventFilterResult, InputEventResult, KeyEvent, | ||
| KeyEventResult, MouseEvent, | ||
| }; | ||
| use crate::item_rendering::{CachedRenderingData, ItemRenderer}; | ||
| use crate::items::MouseCursor; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (a bit inconsistent to have some import through |
||
| use crate::layout::{LayoutInfo, Orientation}; | ||
| use crate::lengths::{LogicalPoint, LogicalRect, LogicalSize}; | ||
| #[cfg(feature = "rtti")] | ||
|
|
@@ -249,9 +248,7 @@ impl Item for DropArea { | |
| let r = Self::FIELD_OFFSETS.can_drop.apply_pin(self).call(&(event.clone(),)); | ||
| if r { | ||
| self.contains_drag.set(true); | ||
| if let Some(window_adapter) = window_adapter.internal(crate::InternalToken) { | ||
| window_adapter.set_mouse_cursor(MouseCursor::Copy); | ||
| } | ||
| window_adapter.set_mouse_cursor(MouseCursor::Copy); | ||
| InputEventResult::EventAccepted | ||
| } else { | ||
| self.contains_drag.set(false); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This didn't need to be moved. Makes the patch harder to review.