Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

View File

@@ -0,0 +1 @@
{"files":{"CHANGELOG.md":"f9a4dd2b2c3c009f431c1a2994397f74ed7bd62fbfe887233597d6404bc3dc29","Cargo.lock":"562298cf3bb34d74a7d8c16e25bf327cc7b9b932d55b95a890634b10466cd357","Cargo.toml":"ffd9ad3a6a7d3d953c1b48ab80ec864293f2d9ec63889b20ad74f0aa10892aa7","LICENSE-APACHE":"b59affd015e517ed998dd735757f9a3693643cd389609947ed54074234a10784","LICENSE-MIT":"c138726a726ac37bae09d0f8a48e74e8e3aa8a8952fcd10fae0fb224cc1c05f1","LICENSE-ZLIB":"01e533bd94e8f1c32b2c2531e2c398de7d35d7804add3d574b4e1fe581d53537","README.md":"9754d5553f11c4ec7f3ac3282b15518460f86b9048e15a6c323ae35e1d59b5da","rustfmt.toml":"a0b3513964ccc1f72d7671376c1a2f073df01aad4b91bf99f0060fbe9dc88034","src/lib.rs":"2f649887b91d2ea059fcf64ef8512a16c0bde72e38ff0aeb14df0f119a9885cb"},"package":"f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f"}

18
vendor/cursor-icon/CHANGELOG.md vendored Normal file
View File

@@ -0,0 +1,18 @@
# Changelog
All notable changes to cursor-icon are documented in this file.
The sections should follow the order `Packaging`, `Added`, `Changed`, `Fixed` and `Removed`.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased
## 1.2.0
- Implement `Hash` for `ParseError`.
- Add `CursorIcon::DndAsk` and `CursorIcon::AllResize` from the wayland-protocols version 1.42.
## 1.1.0
- Bump MSRV from `1.64` to `1.65`.
- Add access to alternative names for cursor icons through the `CursorIcon::alt_names` method.

304
vendor/cursor-icon/Cargo.lock generated vendored Normal file
View File

@@ -0,0 +1,304 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
[[package]]
name = "cc"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cursor-icon"
version = "1.2.0"
dependencies = [
"serde",
"wayland-client",
"wayland-cursor",
]
[[package]]
name = "dlib"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
dependencies = [
"libloading",
]
[[package]]
name = "downcast-rs"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
[[package]]
name = "libc"
version = "0.2.144"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
[[package]]
name = "libloading"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
dependencies = [
"cfg-if",
"winapi",
]
[[package]]
name = "log"
version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
"cfg-if",
]
[[package]]
name = "memchr"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memoffset"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg",
]
[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "nix"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a"
dependencies = [
"bitflags 1.3.2",
"cfg-if",
"libc",
"memoffset",
"static_assertions",
]
[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
"memchr",
"minimal-lexical",
]
[[package]]
name = "pkg-config"
version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
[[package]]
name = "proc-macro2"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quick-xml"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956"
dependencies = [
"memchr",
]
[[package]]
name = "quote"
version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
dependencies = [
"proc-macro2",
]
[[package]]
name = "scoped-tls"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
[[package]]
name = "serde"
version = "1.0.162"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71b2f6e1ab5c2b98c05f0f35b236b22e8df7ead6ffbf51d7808da7f8817e7ab6"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.162"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2a0814352fd64b58489904a44ea8d90cb1a91dcb6b4f5ebabc32c8318e93cb6"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "smallvec"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "syn"
version = "2.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
[[package]]
name = "wayland-backend"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19152ddd73f45f024ed4534d9ca2594e0ef252c1847695255dae47f34df9fbe4"
dependencies = [
"cc",
"downcast-rs",
"nix",
"scoped-tls",
"smallvec",
"wayland-sys",
]
[[package]]
name = "wayland-client"
version = "0.31.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ca7d52347346f5473bf2f56705f360e8440873052e575e55890c4fa57843ed3"
dependencies = [
"bitflags 2.4.1",
"nix",
"wayland-backend",
"wayland-scanner",
]
[[package]]
name = "wayland-cursor"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a44aa20ae986659d6c77d64d808a046996a932aa763913864dc40c359ef7ad5b"
dependencies = [
"nix",
"wayland-client",
"xcursor",
]
[[package]]
name = "wayland-scanner"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb8e28403665c9f9513202b7e1ed71ec56fde5c107816843fb14057910b2c09c"
dependencies = [
"proc-macro2",
"quick-xml",
"quote",
]
[[package]]
name = "wayland-sys"
version = "0.31.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15a0c8eaff5216d07f226cb7a549159267f3467b289d9a2e52fd3ef5aae2b7af"
dependencies = [
"dlib",
"log",
"pkg-config",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "xcursor"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7"
dependencies = [
"nom",
]

53
vendor/cursor-icon/Cargo.toml vendored Normal file
View File

@@ -0,0 +1,53 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.
[package]
edition = "2021"
rust-version = "1.65.0"
name = "cursor-icon"
version = "1.2.0"
authors = ["Kirill Chibisov <contact@kchibisov.com>"]
build = false
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "Cross platform cursor icon type"
readme = "README.md"
keywords = [
"windowing",
"cursor",
]
categories = ["gui"]
license = "MIT OR Apache-2.0 OR Zlib"
repository = "https://github.com/rust-windowing/cursor-icon"
[features]
alloc = []
default = ["std"]
std = ["alloc"]
[lib]
name = "cursor_icon"
path = "src/lib.rs"
[dependencies.serde]
version = "1.0.162"
features = ["derive"]
optional = true
default-features = false
[dev-dependencies.wayland-client]
version = "0.31.1"
[dev-dependencies.wayland-cursor]
version = "0.31.0"

202
vendor/cursor-icon/LICENSE-APACHE vendored Normal file
View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2023 Kirill Chibisov
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

19
vendor/cursor-icon/LICENSE-MIT vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2023 Kirill Chibisov
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

11
vendor/cursor-icon/LICENSE-ZLIB vendored Normal file
View File

@@ -0,0 +1,11 @@
Copyright (c) 2023 Kirill Chibisov
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

7
vendor/cursor-icon/README.md vendored Normal file
View File

@@ -0,0 +1,7 @@
# `cursor-icon`: A common cursor icon type
This library provides a standard type to work with the cursor icon across
multiple platforms.
The transformation to the actual value used by the platform for this icon is
left to the libraries like https://github.com/rust-windowing/winit.

16
vendor/cursor-icon/rustfmt.toml vendored Normal file
View File

@@ -0,0 +1,16 @@
format_code_in_doc_comments = true
match_block_trailing_comma = true
condense_wildcard_suffixes = true
use_field_init_shorthand = true
normalize_doc_attributes = true
overflow_delimited_expr = true
imports_granularity = "Module"
use_small_heuristics = "Max"
normalize_comments = true
reorder_impl_items = true
use_try_shorthand = true
newline_style = "Unix"
format_strings = true
wrap_comments = true
comment_width = 80
edition = "2021"

460
vendor/cursor-icon/src/lib.rs vendored Normal file
View File

@@ -0,0 +1,460 @@
// SPDX-License-Identifier: MIT OR Apache-2.0 OR Zlib
#![cfg_attr(not(feature = "std"), no_std)]
#![deny(rust_2018_idioms)]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(improper_ctypes, improper_ctypes_definitions)]
#![deny(clippy::all)]
#![deny(missing_debug_implementations)]
#![deny(missing_docs)]
#![forbid(unsafe_code)]
#![cfg_attr(clippy, deny(warnings))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
//! The cross platform cursor icon type.
//!
//! This type is intended to be used as a standard interoperability type between
//! GUI frameworks in order to convey the cursor icon type.
//!
//! # Example
//!
//! ```
//! use cursor_icon::CursorIcon;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Parse a cursor icon from the string that describes it.
//! let cursor_name = "pointer";
//! let cursor_icon: CursorIcon = cursor_name.parse()?;
//! println!("The cursor icon is {:?}", cursor_icon);
//! # Ok(())
//! # }
//! ```
// This file contains a portion of the CSS Basic User Interface Module Level 3
// specification. In particular, the names for the cursor from the #cursor
// section and documentation for some of the variants were taken.
//
// The original document is https://www.w3.org/TR/css-ui-3/#cursor.
// Copyright © 2018 W3C® (MIT, ERCIM, Keio, Beihang)
//
// These documents were used under the terms of the following license. This W3C
// license as well as the W3C short notice apply to the `CursorIcon` enum's
// variants and documentation attached to them.
// --------- BEGINNING OF W3C LICENSE
// --------------------------------------------------------------
//
// License
//
// By obtaining and/or copying this work, you (the licensee) agree that you have
// read, understood, and will comply with the following terms and conditions.
//
// Permission to copy, modify, and distribute this work, with or without
// modification, for any purpose and without fee or royalty is hereby granted,
// provided that you include the following on ALL copies of the work or portions
// thereof, including modifications:
//
// - The full text of this NOTICE in a location viewable to users of the
// redistributed or derivative work.
// - Any pre-existing intellectual property disclaimers, notices, or terms and
// conditions. If none exist, the W3C Software and Document Short Notice
// should be included.
// - Notice of any changes or modifications, through a copyright statement on
// the new code or document such as "This software or document includes
// material copied from or derived from [title and URI of the W3C document].
// Copyright © [YEAR] W3C® (MIT, ERCIM, Keio, Beihang)."
//
// Disclaimers
//
// THIS WORK IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS
// OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES
// OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
// THE SOFTWARE OR DOCUMENT WILL NOT INFRINGE ANY THIRD PARTY PATENTS,
// COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
//
// COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
// CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENT.
//
// The name and trademarks of copyright holders may NOT be used in advertising
// or publicity pertaining to the work without specific, written prior
// permission. Title to copyright in this work will at all times remain with
// copyright holders.
//
// --------- END OF W3C LICENSE
// --------------------------------------------------------------------
// --------- BEGINNING OF W3C SHORT NOTICE
// ---------------------------------------------------------
//
// winit: https://github.com/rust-windowing/cursor-icon
//
// Copyright © 2023 World Wide Web Consortium, (Massachusetts Institute of
// Technology, European Research Consortium for Informatics and Mathematics,
// Keio University, Beihang). All Rights Reserved. This work is distributed
// under the W3C® Software License [1] in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// [1] http://www.w3.org/Consortium/Legal/copyright-software
//
// --------- END OF W3C SHORT NOTICE
// --------------------------------------------------------------
#[cfg(feature = "serde")]
#[macro_use]
extern crate serde;
// XXX for forwards compatibility.
#[cfg(feature = "alloc")]
extern crate alloc as _;
/// Describes the appearance of the (usually mouse) cursor icon.
///
/// The names are taken from the CSS W3C specification:
/// <https://www.w3.org/TR/css-ui-3/#cursor>
///
/// # Examples
///
/// ```
/// use cursor_icon::CursorIcon;
///
/// // Get the cursor icon for the default cursor.
/// let cursor_icon = CursorIcon::Default;
/// ```
#[non_exhaustive]
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum CursorIcon {
/// The platform-dependent default cursor. Often rendered as arrow.
#[default]
Default,
/// A context menu is available for the object under the cursor. Often
/// rendered as an arrow with a small menu-like graphic next to it.
ContextMenu,
/// Help is available for the object under the cursor. Often rendered as a
/// question mark or a balloon.
Help,
/// The cursor is a pointer that indicates a link. Often rendered as the
/// backside of a hand with the index finger extended.
Pointer,
/// A progress indicator. The program is performing some processing, but is
/// different from [`CursorIcon::Wait`] in that the user may still interact
/// with the program.
Progress,
/// Indicates that the program is busy and the user should wait. Often
/// rendered as a watch or hourglass.
Wait,
/// Indicates that a cell or set of cells may be selected. Often rendered as
/// a thick plus-sign with a dot in the middle.
Cell,
/// A simple crosshair (e.g., short line segments resembling a "+" sign).
/// Often used to indicate a two dimensional bitmap selection mode.
Crosshair,
/// Indicates text that may be selected. Often rendered as an I-beam.
Text,
/// Indicates vertical-text that may be selected. Often rendered as a
/// horizontal I-beam.
VerticalText,
/// Indicates an alias of/shortcut to something is to be created. Often
/// rendered as an arrow with a small curved arrow next to it.
Alias,
/// Indicates something is to be copied. Often rendered as an arrow with a
/// small plus sign next to it.
Copy,
/// Indicates something is to be moved.
Move,
/// Indicates that the dragged item cannot be dropped at the current cursor
/// location. Often rendered as a hand or pointer with a small circle with a
/// line through it.
NoDrop,
/// Indicates that the requested action will not be carried out. Often
/// rendered as a circle with a line through it.
NotAllowed,
/// Indicates that something can be grabbed (dragged to be moved). Often
/// rendered as the backside of an open hand.
Grab,
/// Indicates that something is being grabbed (dragged to be moved). Often
/// rendered as the backside of a hand with fingers closed mostly out of
/// view.
Grabbing,
/// The east border to be moved.
EResize,
/// The north border to be moved.
NResize,
/// The north-east corner to be moved.
NeResize,
/// The north-west corner to be moved.
NwResize,
/// The south border to be moved.
SResize,
/// The south-east corner to be moved.
SeResize,
/// The south-west corner to be moved.
SwResize,
/// The west border to be moved.
WResize,
/// The east and west borders to be moved.
EwResize,
/// The south and north borders to be moved.
NsResize,
/// The north-east and south-west corners to be moved.
NeswResize,
/// The north-west and south-east corners to be moved.
NwseResize,
/// Indicates that the item/column can be resized horizontally. Often
/// rendered as arrows pointing left and right with a vertical bar
/// separating them.
ColResize,
/// Indicates that the item/row can be resized vertically. Often rendered as
/// arrows pointing up and down with a horizontal bar separating them.
RowResize,
/// Indicates that the something can be scrolled in any direction. Often
/// rendered as arrows pointing up, down, left, and right with a dot in the
/// middle.
AllScroll,
/// Indicates that something can be zoomed in. Often rendered as a
/// magnifying glass with a "+" in the center of the glass.
ZoomIn,
/// 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 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.
///
/// # Examples
///
/// ```no_run
/// use cursor_icon::CursorIcon;
/// use wayland_cursor::CursorTheme;
///
/// # use wayland_client::Connection;
/// # use wayland_client::protocol::wl_shm::WlShm;
/// # fn test(conn: &Connection, shm: WlShm) -> Result<(), Box<dyn std::error::Error>> {
/// // Choose a cursor to load.
/// let cursor = CursorIcon::Help;
///
/// // Load the Wayland cursor theme.
/// let mut cursor_theme = CursorTheme::load(conn, shm, 32)?;
///
/// // Load the cursor.
/// let cursor = cursor_theme.get_cursor(cursor.name());
/// if let Some(cursor) = cursor {
/// println!("Total number of images: {}", cursor.image_count());
/// }
/// # Ok(())
/// # }
/// ```
pub fn name(&self) -> &'static str {
match self {
CursorIcon::Default => "default",
CursorIcon::ContextMenu => "context-menu",
CursorIcon::Help => "help",
CursorIcon::Pointer => "pointer",
CursorIcon::Progress => "progress",
CursorIcon::Wait => "wait",
CursorIcon::Cell => "cell",
CursorIcon::Crosshair => "crosshair",
CursorIcon::Text => "text",
CursorIcon::VerticalText => "vertical-text",
CursorIcon::Alias => "alias",
CursorIcon::Copy => "copy",
CursorIcon::Move => "move",
CursorIcon::NoDrop => "no-drop",
CursorIcon::NotAllowed => "not-allowed",
CursorIcon::Grab => "grab",
CursorIcon::Grabbing => "grabbing",
CursorIcon::EResize => "e-resize",
CursorIcon::NResize => "n-resize",
CursorIcon::NeResize => "ne-resize",
CursorIcon::NwResize => "nw-resize",
CursorIcon::SResize => "s-resize",
CursorIcon::SeResize => "se-resize",
CursorIcon::SwResize => "sw-resize",
CursorIcon::WResize => "w-resize",
CursorIcon::EwResize => "ew-resize",
CursorIcon::NsResize => "ns-resize",
CursorIcon::NeswResize => "nesw-resize",
CursorIcon::NwseResize => "nwse-resize",
CursorIcon::ColResize => "col-resize",
CursorIcon::RowResize => "row-resize",
CursorIcon::AllScroll => "all-scroll",
CursorIcon::ZoomIn => "zoom-in",
CursorIcon::ZoomOut => "zoom-out",
CursorIcon::DndAsk => "dnd-ask",
CursorIcon::AllResize => "all-resize",
}
}
/// A list of alternative names for the cursor icon as commonly found in
/// legacy Xcursor themes.
///
/// This should only be used as a fallback in case the cursor theme does not
/// adhere to the w3c standard.
pub fn alt_names(&self) -> &[&'static str] {
match self {
CursorIcon::Default => &["left_ptr", "arrow", "top_left_arrow", "left_arrow"],
CursorIcon::ContextMenu => &[],
CursorIcon::Help => &["question_arrow", "whats_this"],
CursorIcon::Pointer => &["hand2", "hand1", "hand", "pointing_hand"],
CursorIcon::Progress => &["left_ptr_watch", "half-busy"],
CursorIcon::Wait => &["watch"],
CursorIcon::Cell => &["plus"],
CursorIcon::Crosshair => &["cross"],
CursorIcon::Text => &["xterm", "ibeam"],
CursorIcon::VerticalText => &[],
CursorIcon::Alias => &["link"],
CursorIcon::Copy => &[],
CursorIcon::Move => &[],
CursorIcon::NoDrop => &["circle"],
CursorIcon::NotAllowed => &["crossed_circle", "forbidden"],
CursorIcon::Grab => &["openhand", "fleur"],
CursorIcon::Grabbing => &["closedhand"],
CursorIcon::EResize => &["right_side"],
CursorIcon::NResize => &["top_side"],
CursorIcon::NeResize => &["top_right_corner"],
CursorIcon::NwResize => &["top_left_corner"],
CursorIcon::SResize => &["bottom_side"],
CursorIcon::SeResize => &["bottom_right_corner"],
CursorIcon::SwResize => &["bottom_left_corner"],
CursorIcon::WResize => &["left_side"],
CursorIcon::EwResize => &["h_double_arrow", "size_hor"],
CursorIcon::NsResize => &["v_double_arrow", "size_ver"],
CursorIcon::NeswResize => &["fd_double_arrow", "size_bdiag"],
CursorIcon::NwseResize => &["bd_double_arrow", "size_fdiag"],
CursorIcon::ColResize => &["split_h", "h_double_arrow", "sb_h_double_arrow"],
CursorIcon::RowResize => &["split_v", "v_double_arrow", "sb_v_double_arrow"],
CursorIcon::AllScroll => &["size_all"],
CursorIcon::ZoomIn => &[],
CursorIcon::ZoomOut => &[],
CursorIcon::DndAsk => &["copy"],
CursorIcon::AllResize => &["move"],
}
}
}
impl core::fmt::Display for CursorIcon {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_str(self.name())
}
}
impl core::str::FromStr for CursorIcon {
type Err = ParseError;
/// Parse a string slice into [`CursorIcon`].
///
/// The `name` is a lower kebab case [`CursorIcon`] variant name, e.g.
/// `nesw-resize`. The set of possible valid `name` values matches exactly
/// the set of [`CursorIcon::name`] outputs.
fn from_str(name: &str) -> Result<Self, Self::Err> {
match name {
"default" => Ok(CursorIcon::Default),
"context-menu" => Ok(CursorIcon::ContextMenu),
"help" => Ok(CursorIcon::Help),
"pointer" => Ok(CursorIcon::Pointer),
"progress" => Ok(CursorIcon::Progress),
"wait" => Ok(CursorIcon::Wait),
"cell" => Ok(CursorIcon::Cell),
"crosshair" => Ok(CursorIcon::Crosshair),
"text" => Ok(CursorIcon::Text),
"vertical-text" => Ok(CursorIcon::VerticalText),
"alias" => Ok(CursorIcon::Alias),
"copy" => Ok(CursorIcon::Copy),
"move" => Ok(CursorIcon::Move),
"no-drop" => Ok(CursorIcon::NoDrop),
"not-allowed" => Ok(CursorIcon::NotAllowed),
"grab" => Ok(CursorIcon::Grab),
"grabbing" => Ok(CursorIcon::Grabbing),
"e-resize" => Ok(CursorIcon::EResize),
"n-resize" => Ok(CursorIcon::NResize),
"ne-resize" => Ok(CursorIcon::NeResize),
"nw-resize" => Ok(CursorIcon::NwResize),
"s-resize" => Ok(CursorIcon::SResize),
"se-resize" => Ok(CursorIcon::SeResize),
"sw-resize" => Ok(CursorIcon::SwResize),
"w-resize" => Ok(CursorIcon::WResize),
"ew-resize" => Ok(CursorIcon::EwResize),
"ns-resize" => Ok(CursorIcon::NsResize),
"nesw-resize" => Ok(CursorIcon::NeswResize),
"nwse-resize" => Ok(CursorIcon::NwseResize),
"col-resize" => Ok(CursorIcon::ColResize),
"row-resize" => Ok(CursorIcon::RowResize),
"all-scroll" => Ok(CursorIcon::AllScroll),
"zoom-in" => Ok(CursorIcon::ZoomIn),
"zoom-out" => Ok(CursorIcon::ZoomOut),
_ => Err(ParseError { _private: () }),
}
}
}
/// An error which could be returned when parsing [`CursorIcon`].
///
/// This occurs when the [`FromStr`] implementation of [`CursorIcon`] fails.
///
/// [`FromStr`]: core::str::FromStr
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct ParseError {
_private: (),
}
impl core::fmt::Display for ParseError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_str("failed to parse cursor icon")
}
}
#[cfg(feature = "std")]
impl std::error::Error for ParseError {}