Skip to content

Commit 831e133

Browse files
committed
Redo layer creation to create a sub layer if needed
1 parent f6bf653 commit 831e133

File tree

7 files changed

+567
-168
lines changed

7 files changed

+567
-168
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
- Make `Layer`'s implementation details private; it is now a struct with `as_ptr` and `is_existing` accessor methods.
44
- Add support for tvOS, watchOS and visionOS.
55
- Use `objc2` internally.
6+
- Move `Layer` constructors to the type itself.
7+
- `appkit::metal_layer_from_ns_view` is now `Layer::from_ns_view`.
8+
- `uikit::metal_layer_from_ui_view` is now `Layer::from_ui_view`.
9+
- Added `Layer::from_layer` to construct a `Layer` from a `CALayer` directly.
10+
- Fixed layers not automatically resizing to match the super layer they were created from.
611

712
# 0.4.0 (2023-10-31)
813
- Update `raw-window-handle` dep to `0.6.0`.

Cargo.toml

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
name = "raw-window-metal"
33
version = "0.4.0"
44
license = "MIT OR Apache-2.0"
5-
authors = ["The Gfx-rs Developers"]
65
edition = "2021"
76
description = "Interop library between Metal and raw-window-handle"
87
documentation = "https://docs.rs/raw-window-metal"
@@ -12,37 +11,31 @@ keywords = ["window", "metal", "graphics"]
1211
categories = ["game-engines", "graphics"]
1312
exclude = [".github/*"]
1413

15-
[dependencies]
16-
raw-window-handle = "0.6.0"
17-
1814
[target.'cfg(target_vendor = "apple")'.dependencies]
1915
objc2 = "0.5.2"
2016
objc2-foundation = { version = "0.2.2", features = [
21-
"NSObjCRuntime",
17+
"NSDictionary",
2218
"NSGeometry",
19+
"NSKeyValueObserving",
20+
"NSObjCRuntime",
21+
"NSString",
22+
"NSThread",
23+
"NSValue",
2324
] }
2425
objc2-quartz-core = { version = "0.2.2", features = [
2526
"CALayer",
2627
"CAMetalLayer",
2728
"objc2-metal",
2829
] }
2930

30-
[target.'cfg(target_os = "macos")'.dependencies]
31-
objc2-app-kit = { version = "0.2.2", features = [
32-
"NSResponder",
33-
"NSView",
34-
"NSWindow",
35-
"objc2-quartz-core",
36-
] }
31+
[dev-dependencies]
32+
raw-window-handle = "0.6.0"
3733

38-
[target.'cfg(all(target_vendor = "apple", not(target_os = "macos")))'.dependencies]
39-
objc2-ui-kit = { version = "0.2.2", features = [
40-
"UIResponder",
41-
"UIView",
42-
"UIWindow",
43-
"UIScreen",
44-
"objc2-quartz-core",
45-
] }
34+
[target.'cfg(target_os = "macos")'.dev-dependencies]
35+
objc2-app-kit = { version = "0.2.2", features = ["NSResponder", "NSView"] }
36+
37+
[target.'cfg(all(target_vendor = "apple", not(target_os = "macos")))'.dev-dependencies]
38+
objc2-ui-kit = { version = "0.2.2", features = ["UIResponder", "UIView"] }
4639

4740
[package.metadata.docs.rs]
4841
targets = [

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ raw-window-metal = "0.4"
3131
`CAMetalLayer` is the common entrypoint for graphics APIs (e.g `gfx` or `MoltenVK`), but the handles provided by window libraries may not include such a layer.
3232
This library may extract either this layer or allocate a new one.
3333

34-
Code is mostly extracted from the `gfx-backend-metal` crate.
35-
3634
## License
3735

3836
Licensed under either of

src/appkit.rs

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)