Skip to content

add new wayland cursors #17

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased

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

## 1.1.0

Expand Down
20 changes: 19 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,24 @@ pub enum CursorIcon {
/// Indicates that something can be zoomed in. Often rendered as a
/// magnifying glass with a "-" in the center of the glass.
ZoomOut,

/// Indicates that the user will select the action that will be carried out.
///
/// This is a non-standard extension of the w3c standard used in freedesktop
/// cursor icon themes.
DndAsk,

/// Indicates that something can be moved or resized in any direction.
///
/// This is a non-standard extension of the w3c standard used in freedesktop
/// cursor icon themes.
AllResize,
}

impl CursorIcon {
/// The name of the cursor icon as defined in w3c standard.
/// The name of the cursor icon as defined in the w3c standard.
/// Non-standard cursors such as "DndAsk" and "AllResize" are translated as
/// "dnd-ask" and "all-resize" respectively.
///
/// This name most of the time could be passed as is to cursor loading
/// libraries on X11/Wayland and could be used as-is on web.
Expand Down Expand Up @@ -319,6 +333,8 @@ impl CursorIcon {
CursorIcon::AllScroll => "all-scroll",
CursorIcon::ZoomIn => "zoom-in",
CursorIcon::ZoomOut => "zoom-out",
CursorIcon::DndAsk => "dnd-ask",
CursorIcon::AllResize => "all-resize",
}
}

Expand Down Expand Up @@ -363,6 +379,8 @@ impl CursorIcon {
CursorIcon::AllScroll => &["size_all"],
CursorIcon::ZoomIn => &[],
CursorIcon::ZoomOut => &[],
CursorIcon::DndAsk => &["copy"],
CursorIcon::AllResize => &["move"],
}
}
}
Expand Down