Skip to content

Commit 7a3f2e3

Browse files
authored
api: add new cursors from Wayland spec
1 parent 97f87ed commit 7a3f2e3

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
88
## Unreleased
99

1010
- Implement `Hash` for `ParseError`.
11+
- Add `CursorIcon::DndAsk` and `CursorIcon::AllResize` from the wayland-protocols version 1.42
1112

1213
## 1.1.0
1314

src/lib.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,24 @@ pub enum CursorIcon {
252252
/// Indicates that something can be zoomed in. Often rendered as a
253253
/// magnifying glass with a "-" in the center of the glass.
254254
ZoomOut,
255+
256+
/// Indicates that the user will select the action that will be carried out.
257+
///
258+
/// This is a non-standard extension of the w3c standard used in freedesktop
259+
/// cursor icon themes.
260+
DndAsk,
261+
262+
/// Indicates that something can be moved or resized in any direction.
263+
///
264+
/// This is a non-standard extension of the w3c standard used in freedesktop
265+
/// cursor icon themes.
266+
AllResize,
255267
}
256268

257269
impl CursorIcon {
258-
/// The name of the cursor icon as defined in w3c standard.
270+
/// The name of the cursor icon as defined in the w3c standard.
271+
/// Non-standard cursors such as "DndAsk" and "AllResize" are translated as
272+
/// "dnd-ask" and "all-resize" respectively.
259273
///
260274
/// This name most of the time could be passed as is to cursor loading
261275
/// libraries on X11/Wayland and could be used as-is on web.
@@ -319,6 +333,8 @@ impl CursorIcon {
319333
CursorIcon::AllScroll => "all-scroll",
320334
CursorIcon::ZoomIn => "zoom-in",
321335
CursorIcon::ZoomOut => "zoom-out",
336+
CursorIcon::DndAsk => "dnd-ask",
337+
CursorIcon::AllResize => "all-resize",
322338
}
323339
}
324340

@@ -363,6 +379,8 @@ impl CursorIcon {
363379
CursorIcon::AllScroll => &["size_all"],
364380
CursorIcon::ZoomIn => &[],
365381
CursorIcon::ZoomOut => &[],
382+
CursorIcon::DndAsk => &["copy"],
383+
CursorIcon::AllResize => &["move"],
366384
}
367385
}
368386
}

0 commit comments

Comments
 (0)