mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 06:11:30 +11:00
fix: distinguish grab and grabbing cursors (#1154)
On macOS, there is a difference between a "grab" cursor and a "grabbing" cursor, where "grab" is an open-hand cursor used during a hover, and "grabbing" is a closed-hand cursor used on a click. These, and other native MacOS cursors, can be seen at the [NSCursor documentation](https://developer.apple.com/documentation/appkit/nscursor?language=objc). See https://github.com/hecrj/iced/issues/9 for the motivation for this PR.
This commit is contained in:
parent
b6de19e92e
commit
36f4eccb5c
|
@ -6,6 +6,7 @@
|
||||||
- On iOS, fix improper `msg_send` usage that was UB and/or would break if `!` is stabilized.
|
- On iOS, fix improper `msg_send` usage that was UB and/or would break if `!` is stabilized.
|
||||||
- On Windows, unset `maximized` when manually changing the window's position or size.
|
- On Windows, unset `maximized` when manually changing the window's position or size.
|
||||||
- On Windows, add touch pressure information for touch events.
|
- On Windows, add touch pressure information for touch events.
|
||||||
|
- On macOS, differentiate between `CursorIcon::Grab` and `CursorIcon::Grabbing`.
|
||||||
- On Wayland, fix event processing sometimes stalling when using OpenGL with vsync.
|
- On Wayland, fix event processing sometimes stalling when using OpenGL with vsync.
|
||||||
|
|
||||||
# 0.20.0 Alpha 3 (2019-08-14)
|
# 0.20.0 Alpha 3 (2019-08-14)
|
||||||
|
|
|
@ -15,10 +15,12 @@ pub enum Cursor {
|
||||||
|
|
||||||
impl From<CursorIcon> for Cursor {
|
impl From<CursorIcon> for Cursor {
|
||||||
fn from(cursor: CursorIcon) -> Self {
|
fn from(cursor: CursorIcon) -> Self {
|
||||||
|
// See native cursors at https://developer.apple.com/documentation/appkit/nscursor?language=objc.
|
||||||
match cursor {
|
match cursor {
|
||||||
CursorIcon::Arrow | CursorIcon::Default => Cursor::Native("arrowCursor"),
|
CursorIcon::Arrow | CursorIcon::Default => Cursor::Native("arrowCursor"),
|
||||||
CursorIcon::Hand => Cursor::Native("pointingHandCursor"),
|
CursorIcon::Hand => Cursor::Native("pointingHandCursor"),
|
||||||
CursorIcon::Grabbing | CursorIcon::Grab => Cursor::Native("closedHandCursor"),
|
CursorIcon::Grab => Cursor::Native("openHandCursor"),
|
||||||
|
CursorIcon::Grabbing => Cursor::Native("closedHandCursor"),
|
||||||
CursorIcon::Text => Cursor::Native("IBeamCursor"),
|
CursorIcon::Text => Cursor::Native("IBeamCursor"),
|
||||||
CursorIcon::VerticalText => Cursor::Native("IBeamCursorForVerticalLayout"),
|
CursorIcon::VerticalText => Cursor::Native("IBeamCursorForVerticalLayout"),
|
||||||
CursorIcon::Copy => Cursor::Native("dragCopyCursor"),
|
CursorIcon::Copy => Cursor::Native("dragCopyCursor"),
|
||||||
|
|
|
@ -760,7 +760,9 @@ pub enum CursorIcon {
|
||||||
Alias,
|
Alias,
|
||||||
Copy,
|
Copy,
|
||||||
NoDrop,
|
NoDrop,
|
||||||
|
/// Indicates something can be grabbed.
|
||||||
Grab,
|
Grab,
|
||||||
|
/// Indicates something is grabbed.
|
||||||
Grabbing,
|
Grabbing,
|
||||||
AllScroll,
|
AllScroll,
|
||||||
ZoomIn,
|
ZoomIn,
|
||||||
|
|
Loading…
Reference in a new issue