diff --git a/wlx-capture/Cargo.toml b/wlx-capture/Cargo.toml index 735fbd20..43e2f77c 100644 --- a/wlx-capture/Cargo.toml +++ b/wlx-capture/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wlx-capture" version = "0.5.3" -edition = "2021" +edition = "2024" authors = ["galister"] description = "Screen capture library for Wayland and X11" repository = "https://github.com/galister/wlx-capture" @@ -25,7 +25,7 @@ xshm = ["dep:rxscreen"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ashpd = { version = "0.11.0", default_features = false, features = [ +ashpd = { version = "0.11.0", default-features = false, features = [ "async-std", ], optional = true } drm-fourcc = "2.2.0" diff --git a/wlx-overlay-s/Cargo.toml b/wlx-overlay-s/Cargo.toml index 1a69d3c2..54d61ad6 100644 --- a/wlx-overlay-s/Cargo.toml +++ b/wlx-overlay-s/Cargo.toml @@ -5,12 +5,20 @@ debug = true [package] name = "wlx-overlay-s" version = "25.4.2" -edition = "2021" +edition = "2024" license = "GPL-3.0-only" authors = ["galister"] description = "Access your Wayland/X11 desktop from Monado/WiVRn/SteamVR. Now with Vulkan!" repository = "https://github.com/galister/wlx-overlay-s" -keywords = ["linux", "openvr", "openxr", "x11", "wayland", "openvr-overlay", "openxr-overlay"] +keywords = [ + "linux", + "openvr", + "openxr", + "x11", + "wayland", + "openvr-overlay", + "openxr-overlay", +] categories = ["games"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/wlx-overlay-s/src/backend/openxr/helpers.rs b/wlx-overlay-s/src/backend/openxr/helpers.rs index 86a90b17..ae6ffe64 100644 --- a/wlx-overlay-s/src/backend/openxr/helpers.rs +++ b/wlx-overlay-s/src/backend/openxr/helpers.rs @@ -132,12 +132,8 @@ pub(super) unsafe fn create_overlay_session( system_id: system, }; let mut out = xr::sys::Session::NULL; - let x = (instance.fp().create_session)(instance.as_raw(), &info, &mut out); - if x.into_raw() >= 0 { - Ok(out) - } else { - Err(x) - } + let x = unsafe { (instance.fp().create_session)(instance.as_raw(), &info, &mut out) }; + if x.into_raw() >= 0 { Ok(out) } else { Err(x) } } type Vec3M = mint::Vector3; diff --git a/wlx-overlay-s/src/graphics/dmabuf.rs b/wlx-overlay-s/src/graphics/dmabuf.rs index 458f0f58..1c793235 100644 --- a/wlx-overlay-s/src/graphics/dmabuf.rs +++ b/wlx-overlay-s/src/graphics/dmabuf.rs @@ -6,21 +6,21 @@ use std::{ use smallvec::SmallVec; use vulkano::{ + VulkanError, VulkanObject, device::Device, format::Format, - image::{sys::RawImage, Image, ImageCreateInfo, ImageTiling, ImageUsage, SubresourceLayout}, + image::{Image, ImageCreateInfo, ImageTiling, ImageUsage, SubresourceLayout, sys::RawImage}, memory::{ - allocator::{MemoryAllocator, MemoryTypeFilter}, DedicatedAllocation, DeviceMemory, ExternalMemoryHandleType, ExternalMemoryHandleTypes, MemoryAllocateInfo, MemoryImportInfo, MemoryPropertyFlags, ResourceMemory, + allocator::{MemoryAllocator, MemoryTypeFilter}, }, sync::Sharing, - VulkanError, VulkanObject, }; use wgui::gfx::WGfx; use wlx_capture::frame::{ - DmabufFrame, DrmFormat, FourCC, DRM_FORMAT_ABGR2101010, DRM_FORMAT_ABGR8888, - DRM_FORMAT_ARGB8888, DRM_FORMAT_XBGR2101010, DRM_FORMAT_XBGR8888, DRM_FORMAT_XRGB8888, + DRM_FORMAT_ABGR8888, DRM_FORMAT_ABGR2101010, DRM_FORMAT_ARGB8888, DRM_FORMAT_XBGR8888, + DRM_FORMAT_XBGR2101010, DRM_FORMAT_XRGB8888, DmabufFrame, DrmFormat, FourCC, }; pub const DRM_FORMAT_MOD_INVALID: u64 = 0xff_ffff_ffff_ffff; @@ -284,21 +284,23 @@ pub(super) unsafe fn create_dmabuf_image( create_info_vk.p_next = next as *const _ as *const _; } - let handle = { - let fns = device.fns(); - let mut output = MaybeUninit::uninit(); - (fns.v1_0.create_image)( - device.handle(), - &create_info_vk, - std::ptr::null(), - output.as_mut_ptr(), - ) - .result() - .map_err(VulkanError::from)?; - output.assume_init() - }; + unsafe { + let handle = { + let fns = device.fns(); + let mut output = MaybeUninit::uninit(); + (fns.v1_0.create_image)( + device.handle(), + &create_info_vk, + std::ptr::null(), + output.as_mut_ptr(), + ) + .result() + .map_err(VulkanError::from)?; + output.assume_init() + }; - RawImage::from_handle(device, handle, create_info) + RawImage::from_handle(device, handle, create_info) + } } pub fn get_drm_formats(device: Arc) -> Vec { diff --git a/wlx-overlay-s/src/graphics/mod.rs b/wlx-overlay-s/src/graphics/mod.rs index 1d5125c1..4232e1f3 100644 --- a/wlx-overlay-s/src/graphics/mod.rs +++ b/wlx-overlay-s/src/graphics/mod.rs @@ -6,7 +6,7 @@ use std::{ sync::{Arc, OnceLock}, }; -use glam::{vec2, Vec2}; +use glam::{Vec2, vec2}; use vulkano::{ buffer::{BufferCreateInfo, BufferUsage}, command_buffer::{PrimaryAutoCommandBuffer, PrimaryCommandBufferAbstract}, @@ -26,12 +26,12 @@ use crate::shaders::{frag_color, frag_grid, frag_screen, frag_srgb, vert_quad}; use {ash::vk, std::os::raw::c_void}; use vulkano::{ - self, + self, VulkanObject, buffer::{Buffer, BufferContents, IndexBuffer, Subbuffer}, device::{ - physical::{PhysicalDevice, PhysicalDeviceType}, Device, DeviceCreateInfo, DeviceExtensions, DeviceFeatures, Queue, QueueCreateInfo, QueueFlags, + physical::{PhysicalDevice, PhysicalDeviceType}, }, format::Format, instance::{Instance, InstanceCreateInfo, InstanceExtensions}, @@ -40,7 +40,6 @@ use vulkano::{ vertex_input::Vertex, }, shader::ShaderModule, - VulkanObject, }; use dmabuf::get_drm_formats; @@ -159,7 +158,7 @@ unsafe extern "system" fn get_instance_proc_addr( use vulkano::Handle; let instance = ash::vk::Instance::from_raw(instance as _); let library = get_vulkan_library(); - library.get_instance_proc_addr(instance, name) + unsafe { library.get_instance_proc_addr(instance, name) } } #[cfg(feature = "openxr")] diff --git a/wlx-overlay-s/src/gui/asset.rs b/wlx-overlay-s/src/gui/asset.rs index a18e762e..2ae023e8 100644 --- a/wlx-overlay-s/src/gui/asset.rs +++ b/wlx-overlay-s/src/gui/asset.rs @@ -1,10 +1,10 @@ #[derive(rust_embed::Embed)] -#[folder = "src/gui/assets/"] +#[folder = "src/assets/"] pub struct GuiAsset; impl wgui::assets::AssetProvider for GuiAsset { fn load_from_path(&mut self, path: &str) -> anyhow::Result> { - match GuiAsset::get(path) { + match Self::get(path) { Some(data) => Ok(data.data.to_vec()), None => anyhow::bail!("embedded file {} not found", path), } diff --git a/wlx-overlay-s/src/gui/panel.rs b/wlx-overlay-s/src/gui/panel.rs index 2f9fe93d..d52dc2ad 100644 --- a/wlx-overlay-s/src/gui/panel.rs +++ b/wlx-overlay-s/src/gui/panel.rs @@ -136,7 +136,7 @@ impl OverlayRenderer for GuiPanel { _alpha: f32, ) -> anyhow::Result { self.context.update_viewport(tgt.extent_u32arr(), 1.0)?; - self.layout.update(tgt.extent_vec2(), self.timestep.alpha); + self.layout.update(tgt.extent_vec2(), self.timestep.alpha)?; let mut cmd_buf = app .gfx diff --git a/wlx-overlay-s/src/overlays/keyboard.rs b/wlx-overlay-s/src/overlays/keyboard.rs index c64f7715..bfcd9e1f 100644 --- a/wlx-overlay-s/src/overlays/keyboard.rs +++ b/wlx-overlay-s/src/overlays/keyboard.rs @@ -1,13 +1,13 @@ use std::{ collections::HashMap, - process::{Child, Command}, + process::Child, str::FromStr, sync::{Arc, LazyLock}, }; use crate::{ backend::{ - input::{InteractionHandler, PointerMode}, + input::InteractionHandler, overlay::{ FrameMeta, OverlayBackend, OverlayData, OverlayRenderer, OverlayState, Positioning, ShouldRender, @@ -17,12 +17,12 @@ use crate::{ graphics::CommandBuffers, gui::panel::GuiPanel, hid::{ - get_key_type, KeyModifier, KeyType, VirtualKey, XkbKeymap, ALT, CTRL, KEYS_TO_MODS, META, - NUM_LOCK, SHIFT, SUPER, + ALT, CTRL, KEYS_TO_MODS, KeyModifier, KeyType, META, NUM_LOCK, SHIFT, SUPER, VirtualKey, + XkbKeymap, get_key_type, }, state::{AppState, KeyboardFocus}, }; -use glam::{vec2, vec3a, Affine2, Vec2Swizzles, Vec4}; +use glam::{Affine2, vec2, vec3a}; use regex::Regex; use serde::{Deserialize, Serialize}; use vulkano::image::view::ImageView;