From a4ba00b2097b0ba2f0e1996c938a453787851812 Mon Sep 17 00:00:00 2001 From: vemoo Date: Mon, 6 Dec 2021 14:17:01 +0100 Subject: [PATCH] Bump versions (#266) * bump wayland deps * bump xkbcommon-sys * bump raw-window-handle * bump png --- Cargo.toml | 12 ++++++------ examples/image.rs | 14 +++++++++----- src/os/macos/mod.rs | 10 ++++------ src/os/posix/wayland.rs | 8 +++++--- src/os/posix/x11.rs | 8 +++----- src/os/windows/mod.rs | 11 +++++------ 6 files changed, 32 insertions(+), 31 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 65d7ff6..d34ee2f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,13 +20,13 @@ exclude = [ maintenance = {status = "actively-developed"} [dev-dependencies] -png = "0.16" +png = "0.17" [build-dependencies] cc = "1.0" [dependencies] -raw-window-handle = "0.3.3" +raw-window-handle = "0.4" [target.'cfg(windows)'.dependencies.winapi] version = "0.3" @@ -43,12 +43,12 @@ x11 = ["x11-dl", "xkb", "libc"] wayland = ["wayland-client", "wayland-protocols", "wayland-cursor", "tempfile", "xkb", "xkbcommon-sys"] [target.'cfg(not(any(target_os = "macos", target_os = "redox", windows)))'.dependencies] -wayland-client = {version = "0.28", optional = true} -wayland-protocols = { version = "0.28", features = ["client", "unstable_protocols"], optional = true } -wayland-cursor = {version = "0.28", optional = true} +wayland-client = {version = "0.29", optional = true} +wayland-protocols = { version = "0.29", features = ["client", "unstable_protocols"], optional = true } +wayland-cursor = {version = "0.29", optional = true} tempfile = {version = "3.2", optional = true} xkb = {version = "0.2.1", optional = true} -xkbcommon-sys = {version = "0.7.5", optional = true} +xkbcommon-sys = {version = "1.3", optional = true} x11-dl = {version = "2.19.1", optional = true} libc = {version = "0.2.107", optional = true} diff --git a/examples/image.rs b/examples/image.rs index aaf8f8b..31b1ae6 100644 --- a/examples/image.rs +++ b/examples/image.rs @@ -6,9 +6,9 @@ fn main() { // via `Transformations`. The default output transformation is `Transformations::EXPAND // | Transformations::STRIP_ALPHA`. let decoder = png::Decoder::new(File::open("resources/uv.png").unwrap()); - let (info, mut reader) = decoder.read_info().unwrap(); + let mut reader = decoder.read_info().unwrap(); // Allocate the output buffer. - let mut buf = vec![0; info.buffer_size()]; + let mut buf = vec![0; reader.output_buffer_size()]; // Read the next frame. Currently this function should only called once. // The default options reader.next_frame(&mut buf).unwrap(); @@ -21,8 +21,8 @@ fn main() { let mut window = Window::new( "Noise Test - Press ESC to exit", - info.width as usize, - info.height as usize, + reader.info().width as usize, + reader.info().height as usize, WindowOptions { resize: true, scale_mode: ScaleMode::Center, @@ -33,7 +33,11 @@ fn main() { while window.is_open() && !window.is_key_down(Key::Escape) { window - .update_with_buffer(&u32_buffer, info.width as usize, info.height as usize) + .update_with_buffer( + &u32_buffer, + reader.info().width as usize, + reader.info().height as usize, + ) .unwrap(); } } diff --git a/src/os/macos/mod.rs b/src/os/macos/mod.rs index 577260b..b36d7f8 100644 --- a/src/os/macos/mod.rs +++ b/src/os/macos/mod.rs @@ -261,12 +261,10 @@ unsafe extern "C" fn char_callback(window: *mut c_void, code_point: u32) { unsafe impl raw_window_handle::HasRawWindowHandle for Window { fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle { - let handle = raw_window_handle::macos::MacOSHandle { - ns_window: self.window_handle as *mut _, - ns_view: self.view_handle as *mut _, - ..raw_window_handle::macos::MacOSHandle::empty() - }; - raw_window_handle::RawWindowHandle::MacOS(handle) + let mut handle = raw_window_handle::AppKitHandle::empty(); + handle.ns_window = self.window_handle as *mut _; + handle.ns_view = self.view_handle as *mut _; + raw_window_handle::RawWindowHandle::AppKit(handle) } } diff --git a/src/os/posix/wayland.rs b/src/os/posix/wayland.rs index 6394134..b4115e7 100644 --- a/src/os/posix/wayland.rs +++ b/src/os/posix/wayland.rs @@ -1072,12 +1072,14 @@ impl Window { v.set_len(len as usize); file.read_exact(&mut v)?; - let ctx = xkbcommon_sys::xkb_context_new(0); + let ctx = xkbcommon_sys::xkb_context_new( + xkbcommon_sys::xkb_context_flags::XKB_CONTEXT_NO_FLAGS, + ); let kb_map_ptr = xkbcommon_sys::xkb_keymap_new_from_string( ctx, v.as_ptr() as *const _ as *const std::os::raw::c_char, xkbcommon_sys::xkb_keymap_format::XKB_KEYMAP_FORMAT_TEXT_V1, - 0, + xkbcommon_sys::xkb_keymap_compile_flags::XKB_KEYMAP_COMPILE_NO_FLAGS, ); // Wrap keymap @@ -1195,7 +1197,7 @@ impl Window { unsafe impl raw_window_handle::HasRawWindowHandle for Window { fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle { - let mut handle = raw_window_handle::unix::WaylandHandle::empty(); + let mut handle = raw_window_handle::WaylandHandle::empty(); handle.surface = self.display.surface.as_ref().c_ptr() as *mut _ as *mut c_void; handle.display = self .display diff --git a/src/os/posix/x11.rs b/src/os/posix/x11.rs index c412788..cf3e511 100644 --- a/src/os/posix/x11.rs +++ b/src/os/posix/x11.rs @@ -323,11 +323,9 @@ pub struct Window { unsafe impl raw_window_handle::HasRawWindowHandle for Window { fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle { - let handle = raw_window_handle::unix::XlibHandle { - window: self.handle, - display: self.d.display as *mut core::ffi::c_void, - ..raw_window_handle::unix::XlibHandle::empty() - }; + let mut handle = raw_window_handle::XlibHandle::empty(); + handle.window = self.handle; + handle.display = self.d.display as *mut core::ffi::c_void; raw_window_handle::RawWindowHandle::Xlib(handle) } } diff --git a/src/os/windows/mod.rs b/src/os/windows/mod.rs index 4b0d3f6..6e6a135 100644 --- a/src/os/windows/mod.rs +++ b/src/os/windows/mod.rs @@ -454,12 +454,11 @@ pub struct Window { unsafe impl raw_window_handle::HasRawWindowHandle for Window { fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle { - let handle = raw_window_handle::windows::WindowsHandle { - hwnd: self.window.unwrap() as *mut raw::c_void, - hinstance: unsafe { libloaderapi::GetModuleHandleA(ptr::null()) } as *mut raw::c_void, - ..raw_window_handle::windows::WindowsHandle::empty() - }; - raw_window_handle::RawWindowHandle::Windows(handle) + let mut handle = raw_window_handle::Win32Handle::empty(); + handle.hwnd = self.window.unwrap() as *mut raw::c_void; + handle.hinstance = + unsafe { libloaderapi::GetModuleHandleA(ptr::null()) } as *mut raw::c_void; + raw_window_handle::RawWindowHandle::Win32(handle) } }