Skip to content
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

Upgrade raw-window-handle to 0.5.0 #5

Merged
merged 2 commits into from
Jul 29, 2022
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Unreleased

# 0.3.0 (2022-07-28)
- Update `raw-window-handle` dep to `0.5.0`.

# 0.2.0 (2021-12-02)
- Update `raw-window-handle` dep to `0.4.2`. Rename `macos` -> `appkit` and `ios` -> `uikit` following `raw-window-handle`.

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ categories = ["game-engines", "graphics"]
exclude = [".github/*"]

[dependencies]
raw-window-handle = "0.4.2"
raw-window-handle = "0.5.0"
objc = "0.2"

[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/appkit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use objc::{
msg_send,
runtime::{Object, BOOL, YES},
};
use raw_window_handle::AppKitHandle;
use raw_window_handle::AppKitWindowHandle;

///
pub unsafe fn metal_layer_from_handle(handle: AppKitHandle) -> Layer {
pub unsafe fn metal_layer_from_handle(handle: AppKitWindowHandle) -> Layer {
if !handle.ns_view.is_null() {
metal_layer_from_ns_view(handle.ns_view)
} else if !handle.ns_window.is_null() {
Expand Down
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#![cfg(any(target_os = "macos", target_os = "ios"))]
#![allow(clippy::missing_safety_doc, clippy::let_unit_value)]

#[macro_use]
extern crate objc;

use objc::runtime::Object;

#[cfg(target_os = "macos")]
pub mod appkit;
#[cfg(target_os = "ios")]
pub mod uikit;
Comment on lines -6 to 10
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msiglreith I thought I left a comment here but that was on your 0.4 PR, thoughts?

@msiglreith I've been looking into reviving the related ash-window PR now that raw-window-handle 0.5 is out and used in winit 0.27, and stumbled upon these cfgs. According to https://github.com/rust-windowing/raw-window-handle/pull/70/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759 (surprisingly the author detailed/justified nothing of this in PR/commit messages...) it should be possible to use these across macos and ios now when targeting "Mac Catalyst"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it passes builds I'm happy with it, given these are not strictly iOS/macOS anymore (as it was in the past).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I moved these to the top of the file with #![cfg(any(target_os = "macos", target_os = "ios"))], since it's still all limited to Apple platforms.


pub type CAMetalLayer = *mut Object;
Expand Down
4 changes: 2 additions & 2 deletions src/uikit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use objc::{
msg_send,
runtime::{Object, BOOL, YES},
};
use raw_window_handle::UiKitHandle;
use raw_window_handle::UiKitWindowHandle;
use std::{ffi::c_void, mem};

///
pub unsafe fn metal_layer_from_handle(handle: UiKitHandle) -> Layer {
pub unsafe fn metal_layer_from_handle(handle: UiKitWindowHandle) -> Layer {
if !handle.ui_view.is_null() {
metal_layer_from_ui_view(handle.ui_view)
} else if !handle.ui_window.is_null() {
Expand Down