Skip to content

Commit

Permalink
fix: Use raw-window-handle 0.6 (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcampbell authored Nov 4, 2023
1 parent 6fbebde commit 3fa69ab
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 24 deletions.
13 changes: 2 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions platforms/winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readme = "README.md"
edition = "2021"

[package.metadata.docs.rs]
features = ["winit/rwh_05", "winit/x11", "winit/wayland"]
features = ["winit/rwh_06", "winit/x11", "winit/wayland"]

[features]
default = ["accesskit_unix", "async-io"]
Expand All @@ -20,8 +20,7 @@ tokio = ["accesskit_unix/tokio"]

[dependencies]
accesskit = { version = "0.12.0", path = "../../common" }
raw-window-handle = "0.5"
winit = { version = "0.29", default-features = false, features = ["rwh_05"] }
winit = { version = "0.29", default-features = false, features = ["rwh_06"] }

[target.'cfg(target_os = "windows")'.dependencies]
accesskit_windows = { version = "0.15.0", path = "../windows" }
Expand All @@ -35,4 +34,4 @@ accesskit_unix = { version = "0.6.0", path = "../unix", optional = true, default
[dev-dependencies.winit]
version = "0.29"
default-features = false
features = ["rwh_05", "x11", "wayland", "wayland-dlopen", "wayland-csd-adwaita"]
features = ["rwh_06", "x11", "wayland", "wayland-dlopen", "wayland-csd-adwaita"]
11 changes: 7 additions & 4 deletions platforms/winit/src/platform_impl/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@

use accesskit::{ActionHandler, TreeUpdate};
use accesskit_macos::SubclassingAdapter;
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
use winit::{event::WindowEvent, window::Window};
use winit::{
event::WindowEvent,
raw_window_handle::{HasWindowHandle, RawWindowHandle},
window::Window,
};

pub type ActionHandlerBox = Box<dyn ActionHandler>;

Expand All @@ -19,8 +22,8 @@ impl Adapter {
source: impl 'static + FnOnce() -> TreeUpdate,
action_handler: ActionHandlerBox,
) -> Self {
let view = match window.raw_window_handle() {
RawWindowHandle::AppKit(handle) => handle.ns_view,
let view = match window.window_handle().unwrap().as_raw() {
RawWindowHandle::AppKit(handle) => handle.ns_view.as_ptr(),
RawWindowHandle::UiKit(_) => unimplemented!(),
_ => unreachable!(),
};
Expand Down
13 changes: 8 additions & 5 deletions platforms/winit/src/platform_impl/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@

use accesskit::{ActionHandler, TreeUpdate};
use accesskit_windows::{SubclassingAdapter, HWND};
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
use winit::{event::WindowEvent, window::Window};
use winit::{
event::WindowEvent,
raw_window_handle::{HasWindowHandle, RawWindowHandle},
window::Window,
};

pub type ActionHandlerBox = Box<dyn ActionHandler + Send>;

Expand All @@ -19,11 +22,11 @@ impl Adapter {
source: impl 'static + FnOnce() -> TreeUpdate,
action_handler: ActionHandlerBox,
) -> Self {
let hwnd = HWND(match window.raw_window_handle() {
RawWindowHandle::Win32(handle) => handle.hwnd as isize,
let hwnd = match window.window_handle().unwrap().as_raw() {
RawWindowHandle::Win32(handle) => HWND(handle.hwnd.get()),
RawWindowHandle::WinRt(_) => unimplemented!(),
_ => unreachable!(),
});
};
let adapter = SubclassingAdapter::new(hwnd, source, action_handler);
Self { adapter }
}
Expand Down

0 comments on commit 3fa69ab

Please sign in to comment.