Skip to content

Commit

Permalink
Split dpi module out into a separate crate (#3518)
Browse files Browse the repository at this point in the history
Co-authored-by: John Nunley <dev@notgull.net>
  • Loading branch information
madsmtm and notgull authored Feb 26, 2024
1 parent 7e28d76 commit e41f0ea
Show file tree
Hide file tree
Showing 10 changed files with 253 additions and 206 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Unreleased` header.

# Unreleased

- Move `dpi` types to its own crate, and re-export it from the root crate.
- On Wayland, fix DeviceEvent::Motion not being sent
- On X11, don't require XIM to run.
- On X11, fix xkb state not being updated correctly sometimes leading to wrong input.
Expand Down
35 changes: 23 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name = "winit"
version = "0.29.10"
authors = ["The winit contributors", "Pierre Krieger <pierre.krieger1708@gmail.com>"]
description = "Cross-platform window creation library."
edition = "2021"
keywords = ["windowing"]
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/rust-windowing/winit"
documentation = "https://docs.rs/winit"
categories = ["gui"]
rust-version = "1.70.0"
rust-version.workspace = true
repository.workspace = true
license.workspace = true
edition.workspace = true

[package.metadata.docs.rs]
features = [
Expand All @@ -22,7 +22,6 @@ features = [
# Enabled to get docs to compile
"android-native-activity",
]
default-target = "x86_64-unknown-linux-gnu"
# These are all tested in CI
targets = [
# Windows
Expand Down Expand Up @@ -53,8 +52,8 @@ wayland-csd-adwaita-crossfont = ["sctk-adwaita", "sctk-adwaita/crossfont"]
wayland-csd-adwaita-notitle = ["sctk-adwaita"]
android-native-activity = ["android-activity/native-activity"]
android-game-activity = ["android-activity/game-activity"]
serde = ["dep:serde", "cursor-icon/serde", "smol_str/serde"]
mint = ["dep:mint"]
serde = ["dep:serde", "cursor-icon/serde", "smol_str/serde", "dpi/serde"]
mint = ["dpi/mint"]
rwh_04 = ["dep:rwh_04", "ndk/rwh_04"]
rwh_05 = ["dep:rwh_05", "ndk/rwh_05"]
rwh_06 = ["dep:rwh_06", "ndk/rwh_06"]
Expand All @@ -66,12 +65,12 @@ cfg_aliases = "0.2.0"
bitflags = "2"
cursor-icon = "1.1.0"
log = "0.4"
mint = { version = "0.5.6", optional = true }
rwh_04 = { package = "raw-window-handle", version = "0.4", optional = true }
rwh_05 = { package = "raw-window-handle", version = "0.5.2", features = ["std"], optional = true }
rwh_06 = { package = "raw-window-handle", version = "0.6", features = ["std"], optional = true }
serde = { version = "1", optional = true, features = ["serde_derive"] }
serde = { workspace = true, optional = true }
smol_str = "0.2.0"
dpi = { path = "dpi" }

[dev-dependencies]
image = { version = "0.24.0", default-features = false, features = ["png"] }
Expand Down Expand Up @@ -256,11 +255,23 @@ concurrent-queue = { version = "2", default-features = false }
console_log = "1"
web-sys = { version = "0.3.22", features = ['CanvasRenderingContext2d'] }

[[example]]
doc-scrape-examples = true
name = "window"

[workspace]
resolver = "2"
members = [
"dpi",
"run-wasm",
]

[[example]]
doc-scrape-examples = true
name = "window"
[workspace.package]
rust-version = "1.70.0"
repository = "https://github.com/rust-windowing/winit"
license = "Apache-2.0"
edition = "2021"

[workspace.dependencies]
serde = { version = "1", features = ["serde_derive"] }
mint = "0.5.6"
39 changes: 39 additions & 0 deletions dpi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[package]
name = "dpi"
version = "0.0.0"
description = "Types for handling UI scaling"
keywords = ["DPI", "HiDPI", "scale-factor"]
categories = ["gui"]
rust-version.workspace = true
repository.workspace = true
license.workspace = true
edition.workspace = true

[features]
serde = ["dep:serde"]
mint = ["dep:mint"]

[dependencies]
serde = { workspace = true, optional = true }
mint = { workspace = true, optional = true }

[package.metadata.docs.rs]
features = ["serde", "mint"]
# These are all tested in CI
targets = [
# Windows
"i686-pc-windows-msvc",
"x86_64-pc-windows-msvc",
# macOS
"x86_64-apple-darwin",
# Unix (X11 & Wayland)
"i686-unknown-linux-gnu",
"x86_64-unknown-linux-gnu",
# iOS
"x86_64-apple-ios",
# Android
"aarch64-linux-android",
# Web
"wasm32-unknown-unknown",
]
rustdoc-args = ["--cfg", "docsrs"]
Loading

0 comments on commit e41f0ea

Please sign in to comment.