This commit is contained in:
galister
2025-12-12 20:44:06 +09:00
parent e1b209410e
commit 8b4e60e221
53 changed files with 206 additions and 215 deletions

View File

@@ -18,8 +18,8 @@ use wlx_common::timestep::Timestep;
use crate::{
assets, settings,
tab::{
apps::TabApps, games::TabGames, home::TabHome, monado::TabMonado, processes::TabProcesses, settings::TabSettings,
Tab, TabParams, TabType,
Tab, TabParams, TabType, apps::TabApps, games::TabGames, home::TabHome, monado::TabMonado, processes::TabProcesses,
settings::TabSettings,
},
task::Tasks,
util::{

View File

@@ -1,26 +1,26 @@
use glam::{vec2, Vec2};
use glam::{Vec2, vec2};
use std::sync::Arc;
use testbed::{testbed_any::TestbedAny, Testbed};
use testbed::{Testbed, testbed_any::TestbedAny};
use timestep::Timestep;
use tracing_subscriber::EnvFilter;
use tracing_subscriber::filter::LevelFilter;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
use tracing_subscriber::EnvFilter;
use vulkan::init_window;
use vulkano::{
Validated, VulkanError,
command_buffer::CommandBufferUsage,
format::Format,
image::{view::ImageView, ImageUsage},
image::{ImageUsage, view::ImageView},
swapchain::{
acquire_next_image, CompositeAlpha, PresentMode, Surface, SurfaceInfo, Swapchain,
SwapchainCreateInfo, SwapchainPresentInfo,
CompositeAlpha, PresentMode, Surface, SurfaceInfo, Swapchain, SwapchainCreateInfo,
SwapchainPresentInfo, acquire_next_image,
},
sync::GpuFuture,
Validated, VulkanError,
};
use wgui::{
event::{MouseButtonIndex, MouseDownEvent, MouseMotionEvent, MouseUpEvent, MouseWheelEvent},
gfx::{cmd::WGfxClearMode, WGfx},
gfx::{WGfx, cmd::WGfxClearMode},
renderer_vk::{self},
};
use winit::{
@@ -32,7 +32,7 @@ use winit::{
use crate::{
rate_limiter::RateLimiter,
testbed::{
testbed_dashboard::TestbedDashboard, testbed_generic::TestbedGeneric, TestbedUpdateParams,
TestbedUpdateParams, testbed_dashboard::TestbedDashboard, testbed_generic::TestbedGeneric,
},
};
@@ -419,7 +419,9 @@ fn swapchain_create_info(
composite_alpha = Some(c);
break;
}
log::warn!("GPU driver doesn't support {c:?} compositeAlpha! Desktop window will be blended using a fallback method and may look different than in VR.");
log::warn!(
"GPU driver doesn't support {c:?} compositeAlpha! Desktop window will be blended using a fallback method and may look different than in VR."
);
}
let composite_alpha = composite_alpha
.expect("GPU driver issue: VkSurfaceCapabilitiesKHR has empty supportedCompositeAlpha.");
@@ -436,7 +438,9 @@ fn swapchain_create_info(
present_mode = Some(pm);
break;
}
log::warn!("GPU driver doesn't support {pm:?} presentMode! Desktop window may have a higher latency and/or glitch during grab/resize.");
log::warn!(
"GPU driver doesn't support {pm:?} presentMode! Desktop window may have a higher latency and/or glitch during grab/resize."
);
}
let present_mode = present_mode.expect("GPU driver issue: VkPresentModeKHR FIFO is not supported even though it's required by Vulkan spec.");

View File

@@ -8,9 +8,9 @@ use glam::Vec2;
use wgui::{
assets::AssetPath,
components::{
Component,
button::{ButtonClickCallback, ComponentButton},
checkbox::ComponentCheckbox,
Component,
},
drawing::Color,
event::StyleSetRequest,

View File

@@ -1,8 +1,8 @@
use std::sync::{Arc, OnceLock};
use vulkano::{
device::{
physical::{PhysicalDevice, PhysicalDeviceType},
Device, DeviceCreateInfo, DeviceExtensions, DeviceFeatures, Queue, QueueCreateInfo, QueueFlags,
physical::{PhysicalDevice, PhysicalDeviceType},
},
instance::{Instance, InstanceCreateInfo},
};

View File

@@ -7,26 +7,26 @@ use std::{marker::PhantomData, slice::Iter, sync::Arc};
use cmd::{GfxCommandBuffer, XferCommandBuffer};
use pipeline::WGfxPipeline;
use vulkano::{
DeviceSize,
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, IndexBuffer, Subbuffer},
command_buffer::{
allocator::{StandardCommandBufferAllocator, StandardCommandBufferAllocatorCreateInfo},
AutoCommandBufferBuilder, CommandBufferUsage,
allocator::{StandardCommandBufferAllocator, StandardCommandBufferAllocatorCreateInfo},
},
descriptor_set::allocator::{StandardDescriptorSetAllocator, StandardDescriptorSetAllocatorCreateInfo},
device::{Device, Queue},
format::Format,
image::{sampler::Filter, Image, ImageCreateInfo, ImageType, ImageUsage},
image::{Image, ImageCreateInfo, ImageType, ImageUsage, sampler::Filter},
instance::Instance,
memory::{
allocator::{AllocationCreateInfo, GenericMemoryAllocatorCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
MemoryPropertyFlags,
allocator::{AllocationCreateInfo, GenericMemoryAllocatorCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
},
pipeline::graphics::{
color_blend::{AttachmentBlend, BlendFactor, BlendOp},
vertex_input::Vertex,
},
shader::ShaderModule,
DeviceSize,
};
use crate::gfx::pipeline::WPipelineCreateInfo;

View File

@@ -13,12 +13,12 @@ use vulkano::{
view::ImageView,
},
pipeline::{
graphics::{self, vertex_input::Vertex, viewport::Viewport},
Pipeline, PipelineBindPoint,
graphics::{self, vertex_input::Vertex, viewport::Viewport},
},
};
use super::{pipeline::WGfxPipeline, WGfx};
use super::{WGfx, pipeline::WGfxPipeline};
pub struct WGfxPass<V> {
pub command_buffer: Arc<SecondaryAutoCommandBuffer>,

View File

@@ -1,7 +1,7 @@
use crate::{
components::{slider, Component},
components::{Component, slider},
layout::WidgetID,
parser::{parse_check_f32, process_component, style::parse_style, AttribPair, ParserContext},
parser::{AttribPair, ParserContext, parse_check_f32, process_component, style::parse_style},
widget::ConstructEssentials,
};

View File

@@ -2,21 +2,21 @@ use std::{cell::RefCell, rc::Rc, sync::Arc};
use cosmic_text::Buffer;
use glam::{Mat4, Vec2, Vec3};
use slotmap::{new_key_type, SlotMap};
use slotmap::{SlotMap, new_key_type};
use vulkano::pipeline::graphics::viewport;
use crate::{
drawing::{self},
font_config,
gfx::{cmd::GfxCommandBuffer, WGfx},
gfx::{WGfx, cmd::GfxCommandBuffer},
};
use super::{
rect::{RectPipeline, RectRenderer},
text::{
DEFAULT_METRICS, SWASH_CACHE, TextArea, TextBounds,
text_atlas::{TextAtlas, TextPipeline},
text_renderer::TextRenderer,
TextArea, TextBounds, DEFAULT_METRICS, SWASH_CACHE,
},
viewport::Viewport,
};

View File

@@ -10,10 +10,10 @@ use vulkano::{
use crate::{
drawing::{Boundary, Rectangle},
gfx::{
BLEND_ALPHA, WGfx,
cmd::GfxCommandBuffer,
pass::WGfxPass,
pipeline::{WGfxPipeline, WPipelineCreateInfo},
WGfx, BLEND_ALPHA,
},
renderer_vk::model_buffer::ModelBuffer,
};

View File

@@ -29,10 +29,7 @@ impl Viewport {
projection: WMat4::default(),
};
let params_buffer = gfx.new_buffer(
BufferUsage::UNIFORM_BUFFER | BufferUsage::TRANSFER_DST,
[params].iter(),
)?;
let params_buffer = gfx.new_buffer(BufferUsage::UNIFORM_BUFFER | BufferUsage::TRANSFER_DST, [params].iter())?;
Ok(Self {
params,
@@ -46,10 +43,7 @@ impl Viewport {
self
.text_descriptor
.get_or_insert_with(|| {
pipeline
.inner
.buffer(2, self.params_buffer.clone())
.unwrap() // safe unwrap
pipeline.inner.buffer(2, self.params_buffer.clone()).unwrap() // safe unwrap
})
.clone()
}
@@ -58,21 +52,13 @@ impl Viewport {
self
.rect_descriptor
.get_or_insert_with(|| {
pipeline
.color_rect
.buffer(0, self.params_buffer.clone())
.unwrap() // safe unwrap
pipeline.color_rect.buffer(0, self.params_buffer.clone()).unwrap() // safe unwrap
})
.clone()
}
/// Updates the `Viewport` with the given `resolution` and `projection`.
pub fn update(
&mut self,
resolution: [u32; 2],
projection: &glam::Mat4,
pixel_scale: f32,
) -> anyhow::Result<()> {
pub fn update(&mut self, resolution: [u32; 2], projection: &glam::Mat4, pixel_scale: f32) -> anyhow::Result<()> {
if self.params.screen_resolution == resolution
&& self.params.projection.0 == *projection.as_ref()
&& self.params.pixel_scale == pixel_scale

View File

@@ -19,15 +19,15 @@ use smithay_client_toolkit::reexports::{
pub use wayland_client;
use wayland_client::{
Connection, Dispatch, EventQueue, Proxy, QueueHandle,
backend::WaylandError,
globals::{registry_queue_init, GlobalList, GlobalListContents},
globals::{GlobalList, GlobalListContents, registry_queue_init},
protocol::{
wl_output::{self, Transform, WlOutput},
wl_registry::{self, WlRegistry},
wl_seat::WlSeat,
wl_shm::WlShm,
},
Connection, Dispatch, EventQueue, Proxy, QueueHandle,
};
use crate::frame;

View File

@@ -10,19 +10,19 @@ use std::{
thread::JoinHandle,
};
use wayland_client::{
protocol::{wl_buffer::WlBuffer, wl_shm::Format, wl_shm_pool::WlShmPool},
Connection, Dispatch, Proxy, QueueHandle, WEnum,
protocol::{wl_buffer::WlBuffer, wl_shm::Format, wl_shm_pool::WlShmPool},
};
use smithay_client_toolkit::reexports::protocols_wlr::screencopy::v1::client::zwlr_screencopy_frame_v1::{ZwlrScreencopyFrameV1, self};
use crate::{
WlxCapture,
frame::{
DrmFormat, FourCC, FrameFormat, FramePlane, MemFdFrame, WlxFrame, DRM_FORMAT_ARGB8888,
DRM_FORMAT_XRGB8888,
DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888, DrmFormat, FourCC, FrameFormat, FramePlane,
MemFdFrame, WlxFrame,
},
wayland::WlxClient,
WlxCapture,
};
struct BufData {

View File

@@ -2,69 +2,69 @@ use std::{sync::LazyLock, time::Instant};
static TIME_START: LazyLock<Instant> = LazyLock::new(Instant::now);
pub fn get_micros() -> u64 {
TIME_START.elapsed().as_micros() as u64
TIME_START.elapsed().as_micros() as u64
}
#[derive(Default)]
pub struct Timestep {
current_time_us: u64,
accumulator: f32,
time_micros: u64,
ticks: u32,
speed: f32,
pub alpha: f32,
delta: f32,
loopnum: u8,
current_time_us: u64,
accumulator: f32,
time_micros: u64,
ticks: u32,
speed: f32,
pub alpha: f32,
delta: f32,
loopnum: u8,
}
impl Timestep {
pub fn new() -> Self {
let mut timestep = Self {
speed: 1.0,
..Default::default()
};
pub fn new() -> Self {
let mut timestep = Self {
speed: 1.0,
..Default::default()
};
timestep.reset();
timestep
}
timestep.reset();
timestep
}
fn calculate_alpha(&mut self) {
self.alpha = (self.accumulator / self.delta).clamp(0.0, 1.0);
}
fn calculate_alpha(&mut self) {
self.alpha = (self.accumulator / self.delta).clamp(0.0, 1.0);
}
pub fn set_tps(&mut self, tps: f32) {
self.delta = 1000.0 / tps;
}
pub fn set_tps(&mut self, tps: f32) {
self.delta = 1000.0 / tps;
}
pub fn reset(&mut self) {
self.current_time_us = get_micros();
self.accumulator = 0.0;
}
pub fn reset(&mut self) {
self.current_time_us = get_micros();
self.accumulator = 0.0;
}
pub fn on_tick(&mut self) -> bool {
let newtime = get_micros();
let frametime = newtime - self.current_time_us;
self.time_micros += frametime;
self.current_time_us = newtime;
self.accumulator += frametime as f32 * self.speed / 1000.0;
self.calculate_alpha();
pub fn on_tick(&mut self) -> bool {
let newtime = get_micros();
let frametime = newtime - self.current_time_us;
self.time_micros += frametime;
self.current_time_us = newtime;
self.accumulator += frametime as f32 * self.speed / 1000.0;
self.calculate_alpha();
if self.accumulator >= self.delta {
self.accumulator -= self.delta;
self.loopnum += 1;
self.ticks += 1;
if self.accumulator >= self.delta {
self.accumulator -= self.delta;
self.loopnum += 1;
self.ticks += 1;
if self.loopnum > 5 {
// cannot keep up!
self.loopnum = 0;
self.accumulator = 0.0;
return false;
}
if self.loopnum > 5 {
// cannot keep up!
self.loopnum = 0;
self.accumulator = 0.0;
return false;
}
true
} else {
self.loopnum = 0;
false
}
}
true
} else {
self.loopnum = 0;
false
}
}
}

View File

@@ -5,7 +5,7 @@ use std::{collections::VecDeque, time::Instant};
use glam::{Affine3A, Vec2, Vec3A, Vec3Swizzles};
use idmap_derive::IntegerId;
use smallvec::{smallvec, SmallVec};
use smallvec::{SmallVec, smallvec};
use wlx_common::common::LeftRight;
use wlx_common::windowing::{OverlayWindowState, Positioning};
@@ -16,7 +16,7 @@ use crate::state::{AppSession, AppState};
use crate::subsystem::hid::WheelDelta;
use crate::subsystem::input::KeyboardFocus;
use crate::windowing::manager::OverlayWindowManager;
use crate::windowing::window::{self, realign, OverlayWindowData};
use crate::windowing::window::{self, OverlayWindowData, realign};
use crate::windowing::{OverlayID, OverlaySelector};
use super::task::TaskType;

View File

@@ -2,13 +2,13 @@ use std::{array, fs::File, io::Write, time::Duration};
use anyhow::bail;
use ovr_overlay::{
TrackedDeviceIndex,
input::{ActionHandle, ActionSetHandle, ActiveActionSet, InputManager, InputValueHandle},
sys::{
ETrackedControllerRole, ETrackedDeviceClass, ETrackedDeviceProperty,
ETrackingUniverseOrigin,
},
system::SystemManager,
TrackedDeviceIndex,
};
use crate::{

View File

@@ -1,6 +1,6 @@
use std::f32::consts::PI;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use ash::vk::SubmitInfo;
use glam::{Affine3A, Vec3, Vec3A, Vec4};
@@ -8,6 +8,7 @@ use idmap::IdMap;
use ovr_overlay::overlay::OverlayManager;
use ovr_overlay::sys::ETrackingUniverseOrigin;
use vulkano::{
VulkanObject,
command_buffer::{
CommandBufferBeginInfo, CommandBufferLevel, CommandBufferUsage, RecordingCommandBuffer,
},
@@ -15,21 +16,20 @@ use vulkano::{
image::view::ImageView,
image::{Image, ImageLayout},
sync::{
fence::{Fence, FenceCreateInfo},
AccessFlags, DependencyInfo, ImageMemoryBarrier, PipelineStages,
fence::{Fence, FenceCreateInfo},
},
VulkanObject,
};
use wgui::gfx::WGfx;
use crate::backend::input::{HoverResult, PointerHit};
use crate::state::AppState;
use crate::subsystem::hid::WheelDelta;
use crate::windowing::Z_ORDER_LINES;
use crate::windowing::backend::{
FrameMeta, OverlayBackend, OverlayEventData, RenderResources, ShouldRender,
};
use crate::windowing::window::{OverlayWindowConfig, OverlayWindowData};
use crate::windowing::Z_ORDER_LINES;
use super::overlay::OpenVrOverlayData;

View File

@@ -1,6 +1,6 @@
use std::{fs::File, io::Read};
use anyhow::{bail, Context};
use anyhow::{Context, bail};
use json::{array, object};
use ovr_overlay::applications::ApplicationsManager;

View File

@@ -5,32 +5,33 @@ use std::{
time::{Duration, Instant},
};
use anyhow::{anyhow, Result};
use anyhow::{Result, anyhow};
use ovr_overlay::{
sys::{ETrackedDeviceProperty, EVRApplicationType, EVREventType},
TrackedDeviceIndex,
sys::{ETrackedDeviceProperty, EVRApplicationType, EVREventType},
};
use vulkano::{device::physical::PhysicalDevice, Handle, VulkanObject};
use vulkano::{Handle, VulkanObject, device::physical::PhysicalDevice};
use wlx_common::overlays::ToastTopic;
use crate::{
RUNNING,
backend::{
BackendError,
input::interact,
openvr::{
helpers::adjust_gain,
input::{set_action_manifest, OpenVrInputSource},
input::{OpenVrInputSource, set_action_manifest},
lines::LinePool,
manifest::{install_manifest, uninstall_manifest},
overlay::OpenVrOverlayData,
},
task::{OpenVrTask, OverlayTask, TaskType},
BackendError,
},
config::save_state,
graphics::{init_openvr_graphics, GpuFutures},
graphics::{GpuFutures, init_openvr_graphics},
overlays::{
toast::Toast,
watch::{watch_fade, WATCH_NAME},
watch::{WATCH_NAME, watch_fade},
},
state::AppState,
subsystem::notifications::NotificationManager,
@@ -38,7 +39,6 @@ use crate::{
backend::{RenderResources, ShouldRender},
manager::OverlayWindowManager,
},
RUNNING,
};
#[cfg(feature = "wayvr")]

View File

@@ -8,8 +8,8 @@ use ovr_overlay::{
sys::{ETrackingUniverseOrigin, VRVulkanTextureData_t},
};
use vulkano::{
image::{view::ImageView, ImageUsage},
Handle, VulkanObject,
image::{ImageUsage, view::ImageView},
};
use wgui::gfx::WGfx;

View File

@@ -4,7 +4,7 @@ use std::{
time::{Duration, Instant},
};
use glam::{bool, Affine3A, Quat, Vec3};
use glam::{Affine3A, Quat, Vec3, bool};
use libmonado as mnd;
use openxr::{self as xr, Quaternionf, Vector2f, Vector3f};
use serde::{Deserialize, Serialize};
@@ -15,7 +15,7 @@ use crate::{
state::{AppSession, AppState},
};
use super::{helpers::posef_to_transform, XrState};
use super::{XrState, helpers::posef_to_transform};
static CLICK_TIMES: [Duration; 3] = [
Duration::ZERO,

View File

@@ -4,16 +4,16 @@ use openxr as xr;
use std::{
f32::consts::PI,
sync::{
atomic::{AtomicUsize, Ordering},
Arc,
atomic::{AtomicUsize, Ordering},
},
};
use wgui::gfx::{
WGfx,
cmd::WGfxClearMode,
pass::WGfxPass,
pipeline::{WGfxPipeline, WPipelineCreateInfo},
WGfx,
};
use crate::{
@@ -27,8 +27,8 @@ use vulkano::{
};
use super::{
swapchain::{create_swapchain, SwapchainOpts, WlxSwapchain},
CompositionLayer, XrState,
swapchain::{SwapchainOpts, WlxSwapchain, create_swapchain},
};
static LINE_AUTO_INCREMENT: AtomicUsize = AtomicUsize::new(1);

View File

@@ -1,7 +1,7 @@
use std::{
collections::VecDeque,
ops::Add,
sync::{atomic::Ordering, Arc},
sync::{Arc, atomic::Ordering},
time::{Duration, Instant},
};
@@ -14,17 +14,18 @@ use vulkano::{Handle, VulkanObject};
use wlx_common::overlays::ToastTopic;
use crate::{
FRAME_COUNTER, RUNNING,
backend::{
BackendError,
input::interact,
openxr::{lines::LinePool, overlay::OpenXrOverlayData},
task::{OverlayTask, TaskType},
BackendError,
},
config::save_state,
graphics::{init_openxr_graphics, GpuFutures},
graphics::{GpuFutures, init_openxr_graphics},
overlays::{
toast::Toast,
watch::{watch_fade, WATCH_NAME},
watch::{WATCH_NAME, watch_fade},
},
state::AppState,
subsystem::notifications::NotificationManager,
@@ -32,7 +33,6 @@ use crate::{
backend::{RenderResources, ShouldRender},
manager::OverlayWindowManager,
},
FRAME_COUNTER, RUNNING,
};
#[cfg(feature = "wayvr")]

View File

@@ -4,9 +4,9 @@ use std::{f32::consts::PI, sync::Arc};
use vulkano::image::view::ImageView;
use xr::EyeVisibility;
use super::{helpers, swapchain::WlxSwapchain, CompositionLayer, XrState};
use super::{CompositionLayer, XrState, helpers, swapchain::WlxSwapchain};
use crate::{
backend::openxr::swapchain::{create_swapchain, SwapchainOpts},
backend::openxr::swapchain::{SwapchainOpts, create_swapchain},
state::AppState,
windowing::window::OverlayWindowData,
};

View File

@@ -15,13 +15,13 @@ use wgui::gfx::{cmd::WGfxClearMode, pipeline::WPipelineCreateInfo};
use crate::{
backend::openxr::{helpers::translation_rotation_to_posef, swapchain::SwapchainOpts},
config_io,
graphics::{dds::WlxCommandBufferDds, ExtentExt, GpuFutures},
graphics::{ExtentExt, GpuFutures, dds::WlxCommandBufferDds},
state::AppState,
};
use super::{
swapchain::{create_swapchain, WlxSwapchain},
CompositionLayer, XrState,
swapchain::{WlxSwapchain, create_swapchain},
};
pub(super) struct Skybox {

View File

@@ -9,7 +9,7 @@ use serde::Deserialize;
use crate::{
state::AppState,
windowing::{window::OverlayWindowConfig, OverlaySelector},
windowing::{OverlaySelector, window::OverlayWindowConfig},
};
#[cfg(feature = "wayvr")]

View File

@@ -10,8 +10,9 @@ use smithay::{
use crate::backend::wayvr::{ExternalProcessRequest, WayVRTask};
use super::{
ProcessWayVREnv,
comp::{self, ClientState},
display, process, ProcessWayVREnv,
display, process,
};
pub struct WayVRClient {

View File

@@ -21,9 +21,9 @@ use smallvec::SmallVec;
use smithay::{
backend::{
egl,
renderer::{gles::GlesRenderer, ImportDma},
renderer::{ImportDma, gles::GlesRenderer},
},
input::{keyboard::XkbConfig, SeatState},
input::{SeatState, keyboard::XkbConfig},
output::{Mode, Output},
reexports::wayland_server::{self, backend::ClientId},
wayland::{
@@ -45,7 +45,7 @@ use wayvr_ipc::{packet_client, packet_server};
use crate::{
state::AppState,
subsystem::hid::{WheelDelta, MODS_TO_KEYS},
subsystem::hid::{MODS_TO_KEYS, WheelDelta},
};
const STR_INVALID_HANDLE_DISP: &str = "Invalid display handle";

View File

@@ -19,7 +19,7 @@ use crate::{
},
config::load_config_with_conf_d,
config_io,
overlays::wayvr::{executable_exists_in_path, WayVRData},
overlays::wayvr::{WayVRData, executable_exists_in_path},
};
// Flat version of RelativeTo

View File

@@ -1,12 +1,12 @@
use image_dds::{ImageFormat, Surface};
use std::{io::Read, sync::Arc};
use vulkano::{
DeviceSize,
buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::CopyBufferToImageInfo,
format::Format,
image::{Image, ImageCreateInfo, ImageType, ImageUsage},
memory::allocator::{AllocationCreateInfo, MemoryTypeFilter},
DeviceSize,
};
use wgui::gfx::cmd::XferCommandBuffer;
@@ -22,7 +22,9 @@ impl WlxCommandBufferDds for XferCommandBuffer {
R: Read,
{
let Ok(dds) = image_dds::ddsfile::Dds::read(r) else {
anyhow::bail!("Not a valid DDS file.\nSee: https://github.com/galister/wlx-overlay-s/wiki/Custom-Textures");
anyhow::bail!(
"Not a valid DDS file.\nSee: https://github.com/galister/wlx-overlay-s/wiki/Custom-Textures"
);
};
let surface = Surface::from_dds(&dds)?;

View File

@@ -7,21 +7,21 @@ use std::{
use anyhow::Context;
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;

View File

@@ -6,7 +6,7 @@ use std::{
sync::{Arc, OnceLock},
};
use glam::{vec2, Vec2};
use glam::{Vec2, vec2};
use vulkano::{
buffer::{BufferCreateInfo, BufferUsage},
command_buffer::{CommandBufferUsage, PrimaryAutoCommandBuffer, PrimaryCommandBufferAbstract},
@@ -26,11 +26,11 @@ 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},
DeviceCreateInfo, DeviceExtensions, DeviceFeatures, Queue, QueueCreateInfo, QueueFlags,
physical::{PhysicalDevice, PhysicalDeviceType},
},
format::Format,
instance::{Instance, InstanceCreateInfo, InstanceExtensions},
@@ -39,7 +39,6 @@ use vulkano::{
vertex_input::Vertex,
},
shader::ShaderModule,
VulkanObject,
};
use dmabuf::get_drm_formats;

View File

@@ -2,7 +2,7 @@ use std::{
cell::RefCell,
process::{Command, Stdio},
rc::Rc,
sync::{atomic::Ordering, Arc},
sync::{Arc, atomic::Ordering},
time::{Duration, Instant},
};
@@ -18,6 +18,7 @@ use wgui::{
use wlx_common::overlays::ToastTopic;
use crate::{
RUNNING,
backend::task::{OverlayTask, PlayspaceTask, TaskType},
gui::panel::helper::PipeReaderThread,
overlays::{
@@ -26,7 +27,6 @@ use crate::{
},
state::AppState,
windowing::OverlaySelector,
RUNNING,
};
#[cfg(feature = "wayvr")]

View File

@@ -4,8 +4,8 @@ use std::{
io::{BufRead, BufReader, Read},
process::Child,
sync::{
mpsc::{self, Receiver},
Arc, LazyLock,
mpsc::{self, Receiver},
},
thread::JoinHandle,
};

View File

@@ -17,8 +17,8 @@ use wgui::{
event::{self, EventCallback},
i18n::Translation,
layout::Layout,
parser::{parse_color_hex, CustomAttribsInfoOwned},
widget::{label::WidgetLabel, EventResult},
parser::{CustomAttribsInfoOwned, parse_color_hex},
widget::{EventResult, label::WidgetLabel},
};
use crate::{gui::panel::helper::PipeReaderThread, state::AppState};
@@ -210,10 +210,9 @@ fn shell_on_tick(
label.set_text(common, Translation::from_raw_text(&text));
}
if reader.is_finished()
&& !mut_state.reader.take().unwrap().is_success() {
mut_state.next_try = Instant::now() + Duration::from_secs(15);
}
if reader.is_finished() && !mut_state.reader.take().unwrap().is_success() {
mut_state.next_try = Instant::now() + Duration::from_secs(15);
}
return Ok(());
} else if mut_state.next_try > Instant::now() {
return Ok(());
@@ -302,10 +301,9 @@ fn fifo_on_tick(
label.set_text(common, Translation::from_raw_text(&text));
}
if reader.is_finished()
&& !mut_state.reader.take().unwrap().is_success() {
mut_state.next_try = Instant::now() + Duration::from_secs(15);
}
if reader.is_finished() && !mut_state.reader.take().unwrap().is_success() {
mut_state.next_try = Instant::now() + Duration::from_secs(15);
}
}
const BAT_LOW: drawing::Color = drawing::Color::new(0.69, 0.38, 0.38, 1.);

View File

@@ -1,7 +1,7 @@
use std::{cell::RefCell, rc::Rc};
use button::setup_custom_button;
use glam::{vec2, Affine2, Vec2};
use glam::{Affine2, Vec2, vec2};
use label::setup_custom_label;
use wgui::{
assets::AssetPath,
@@ -16,7 +16,7 @@ use wgui::{
layout::{Layout, LayoutParams, WidgetID},
parser::{CustomAttribsInfoOwned, Fetchable, ParserState},
renderer_vk::context::Context as WguiContext,
widget::{label::WidgetLabel, EventResult},
widget::{EventResult, label::WidgetLabel},
};
use wlx_common::timestep::Timestep;
@@ -25,7 +25,7 @@ use crate::{
state::AppState,
subsystem::hid::WheelDelta,
windowing::backend::{
ui_transform, FrameMeta, OverlayBackend, OverlayEventData, RenderResources, ShouldRender,
FrameMeta, OverlayBackend, OverlayEventData, RenderResources, ShouldRender, ui_transform,
},
};

View File

@@ -40,7 +40,7 @@ use clap::Parser;
use subsystem::notifications::DbusNotificationSender;
use sysinfo::Pid;
use tracing::level_filters::LevelFilter;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
use tracing_subscriber::{EnvFilter, layer::SubscriberExt, util::SubscriberInitExt};
pub static FRAME_COUNTER: AtomicUsize = AtomicUsize::new(0);
pub static RUNNING: AtomicBool = AtomicBool::new(true);
@@ -131,7 +131,7 @@ fn auto_run(args: Args) {
#[cfg(feature = "openxr")]
if !args_get_openvr(&args) {
use crate::backend::{openxr::openxr_run, BackendError};
use crate::backend::{BackendError, openxr::openxr_run};
tried_xr = true;
match openxr_run(args.show, args.headless) {
Ok(()) => return,
@@ -145,7 +145,7 @@ fn auto_run(args: Args) {
#[cfg(feature = "openvr")]
if !args_get_openxr(&args) {
use crate::backend::{openvr::openvr_run, BackendError};
use crate::backend::{BackendError, openvr::openvr_run};
tried_vr = true;
match openvr_run(args.show, args.headless) {
Ok(()) => return,

View File

@@ -1,6 +1,6 @@
use std::sync::Arc;
use glam::{vec3, Affine3A, Quat, Vec3};
use glam::{Affine3A, Quat, Vec3, vec3};
use wlx_common::windowing::OverlayWindowState;
use crate::{

View File

@@ -20,16 +20,16 @@ use crate::{
input::HoverResult,
task::{OverlayTask, TaskContainer, TaskType},
},
gui::panel::{button::BUTTON_EVENTS, GuiPanel, NewGuiPanelParams, OnCustomAttribFunc},
gui::panel::{GuiPanel, NewGuiPanelParams, OnCustomAttribFunc, button::BUTTON_EVENTS},
overlays::edit::{
lock::InteractLockHandler, pos::PositioningHandler, tab::ButtonPaneTabSwitcher,
},
state::AppState,
subsystem::hid::WheelDelta,
windowing::{
OverlayID, OverlaySelector,
backend::{DummyBackend, OverlayBackend, OverlayEventData, RenderResources, ShouldRender},
window::OverlayWindowConfig,
OverlayID, OverlaySelector,
},
};

View File

@@ -1,6 +1,6 @@
use std::{collections::HashMap, rc::Rc};
use glam::{vec2, vec3, Affine3A, FloatExt, Mat4, Quat, Vec2, Vec3};
use glam::{Affine3A, FloatExt, Mat4, Quat, Vec2, Vec3, vec2, vec3};
use wgui::{
animation::{Animation, AnimationEasing},
assets::AssetPath,
@@ -11,10 +11,10 @@ use wgui::{
renderer_vk::util,
taffy::{self, prelude::length},
widget::{
EventResult,
div::WidgetDiv,
rectangle::{WidgetRectangle, WidgetRectangleParams},
util::WLength,
EventResult,
},
};
use wlx_common::windowing::{OverlayWindowState, Positioning};
@@ -22,14 +22,14 @@ use wlx_common::windowing::{OverlayWindowState, Positioning};
use crate::{
gui::panel::GuiPanel,
state::AppState,
subsystem::hid::{XkbKeymap, ALT, CTRL, META, SHIFT, SUPER},
subsystem::hid::{ALT, CTRL, META, SHIFT, SUPER, XkbKeymap},
windowing::window::OverlayWindowConfig,
};
use super::{
handle_press, handle_release,
KEYBOARD_NAME, KeyButtonData, KeyState, KeyboardBackend, KeyboardState, handle_press,
handle_release,
layout::{self, AltModifier, KeyCapType},
KeyButtonData, KeyState, KeyboardBackend, KeyboardState, KEYBOARD_NAME,
};
const BACKGROUND_PADDING: f32 = 16.0;

View File

@@ -12,7 +12,7 @@ use crate::{
backend::input::{HoverResult, PointerHit},
gui::panel::GuiPanel,
state::AppState,
subsystem::hid::{KeyModifier, VirtualKey, WheelDelta, ALT, CTRL, META, SHIFT, SUPER},
subsystem::hid::{ALT, CTRL, KeyModifier, META, SHIFT, SUPER, VirtualKey, WheelDelta},
windowing::backend::{
FrameMeta, OverlayBackend, OverlayEventData, RenderResources, ShouldRender,
},

View File

@@ -1,14 +1,14 @@
use std::{
sync::{
atomic::{AtomicUsize, Ordering},
Arc,
atomic::{AtomicUsize, Ordering},
},
task::{Context, Poll},
};
use futures::{Future, FutureExt};
use glam::{vec3, Affine2, Affine3A, Quat, Vec3};
use wlx_capture::pipewire::{pipewire_select_screen, PipewireCapture, PipewireSelectScreenResult};
use glam::{Affine2, Affine3A, Quat, Vec3, vec3};
use wlx_capture::pipewire::{PipewireCapture, PipewireSelectScreenResult, pipewire_select_screen};
use wlx_common::windowing::OverlayWindowState;
use crate::{
@@ -19,12 +19,12 @@ use crate::{
state::{AppSession, AppState},
subsystem::hid::WheelDelta,
windowing::{
OverlaySelector,
backend::{
ui_transform, FrameMeta, OverlayBackend, OverlayEventData, RenderResources,
ShouldRender,
FrameMeta, OverlayBackend, OverlayEventData, RenderResources, ShouldRender,
ui_transform,
},
window::{OverlayCategory, OverlayWindowConfig},
OverlaySelector,
},
};

View File

@@ -1,22 +1,22 @@
use std::{
sync::{atomic::AtomicU64, Arc, LazyLock},
sync::{Arc, LazyLock, atomic::AtomicU64},
time::Instant,
};
use glam::{vec2, Affine2, Vec2};
use wlx_capture::{frame::Transform, WlxCapture};
use glam::{Affine2, Vec2, vec2};
use wlx_capture::{WlxCapture, frame::Transform};
use crate::{
backend::input::{HoverResult, PointerHit, PointerMode},
graphics::ExtentExt,
state::AppState,
subsystem::hid::{WheelDelta, MOUSE_LEFT, MOUSE_MIDDLE, MOUSE_RIGHT},
subsystem::hid::{MOUSE_LEFT, MOUSE_MIDDLE, MOUSE_RIGHT, WheelDelta},
windowing::backend::{
FrameMeta, OverlayBackend, OverlayEventData, RenderResources, ShouldRender,
},
};
use super::capture::{receive_callback, ScreenPipeline, WlxCaptureIn, WlxCaptureOut};
use super::capture::{ScreenPipeline, WlxCaptureIn, WlxCaptureOut, receive_callback};
const CURSOR_SIZE: f32 = 16. / 1440.;

View File

@@ -1,6 +1,6 @@
use std::{f32::consts::PI, sync::Arc};
use glam::{vec3, Affine3A, Quat, Vec3};
use glam::{Affine3A, Quat, Vec3, vec3};
use wlx_capture::frame::Transform;
use wlx_common::windowing::{OverlayWindowState, Positioning};

View File

@@ -5,7 +5,7 @@ use std::{
};
use anyhow::Context;
use glam::{vec3, Affine3A, Quat, Vec3};
use glam::{Affine3A, Quat, Vec3, vec3};
use wgui::{i18n::Translation, widget::label::WidgetLabel};
use wlx_common::{
common::LeftRight,
@@ -18,7 +18,7 @@ use crate::{
gui::panel::{GuiPanel, NewGuiPanelParams, OnCustomIdFunc},
overlays::watch::{WATCH_POS, WATCH_ROT},
state::AppState,
windowing::{window::OverlayWindowConfig, OverlaySelector, Z_ORDER_TOAST},
windowing::{OverlaySelector, Z_ORDER_TOAST, window::OverlayWindowConfig},
};
const FONT_SIZE: isize = 16;

View File

@@ -4,7 +4,7 @@ use std::{
time::{Duration, Instant},
};
use glam::{vec3, Affine3A, Quat, Vec3, Vec3A};
use glam::{Affine3A, Quat, Vec3, Vec3A, vec3};
use idmap::DirectIdMap;
use wgui::{
components::button::ComponentButton,
@@ -14,7 +14,7 @@ use wgui::{
parser::Fetchable,
renderer_vk::text::custom_glyph::CustomGlyphData,
taffy,
widget::{sprite::WidgetSprite, EventResult},
widget::{EventResult, sprite::WidgetSprite},
};
use wlx_common::{
common::LeftRight,
@@ -27,16 +27,16 @@ use crate::{
task::{OverlayTask, TaskType},
},
gui::{
panel::{button::BUTTON_EVENTS, GuiPanel, NewGuiPanelParams, OnCustomAttribFunc},
panel::{GuiPanel, NewGuiPanelParams, OnCustomAttribFunc, button::BUTTON_EVENTS},
timer::GuiTimer,
},
overlays::edit::LongPressButtonState,
state::AppState,
windowing::{
OverlaySelector, Z_ORDER_WATCH,
backend::{OverlayEventData, OverlayMeta},
manager::MAX_OVERLAY_SETS,
window::{OverlayWindowConfig, OverlayWindowData},
OverlaySelector, Z_ORDER_WATCH,
},
};

View File

@@ -1,18 +1,18 @@
use anyhow::Context;
use glam::{vec3, Affine2, Affine3A, Quat, Vec3};
use glam::{Affine2, Affine3A, Quat, Vec3, vec3};
use smallvec::smallvec;
use std::{cell::RefCell, collections::HashMap, rc::Rc, sync::Arc};
use vulkano::{
buffer::{BufferUsage, Subbuffer},
command_buffer::CommandBufferUsage,
format::Format,
image::{view::ImageView, Image, ImageTiling, SubresourceLayout},
image::{Image, ImageTiling, SubresourceLayout, view::ImageView},
};
use wayvr_ipc::packet_server::{self, PacketServer, WvrStateChanged};
use wgui::gfx::{
WGfx,
pass::WGfxPass,
pipeline::{WGfxPipeline, WPipelineCreateInfo},
WGfx,
};
use wlx_capture::frame::{DmabufFrame, FourCC, FrameFormat, FramePlane};
use wlx_common::windowing::OverlayWindowState;
@@ -22,23 +22,22 @@ use crate::{
input::{self, HoverResult},
task::{OverlayTask, TaskType},
wayvr::{
self, display,
self, WayVR, WayVRAction, WayVRDisplayClickAction, display,
server_ipc::{gen_args_vec, gen_env_vec},
WayVR, WayVRAction, WayVRDisplayClickAction,
},
},
config_wayvr,
graphics::{dmabuf::WGfxDmabuf, Vert2Uv},
graphics::{Vert2Uv, dmabuf::WGfxDmabuf},
state::{self, AppState},
subsystem::{hid::WheelDelta, input::KeyboardFocus},
windowing::{
OverlayID, OverlaySelector, Z_ORDER_DASHBOARD,
backend::{
ui_transform, FrameMeta, OverlayBackend, OverlayEventData, RenderResources,
ShouldRender,
FrameMeta, OverlayBackend, OverlayEventData, RenderResources, ShouldRender,
ui_transform,
},
manager::OverlayWindowManager,
window::{OverlayCategory, OverlayWindowConfig, OverlayWindowData},
OverlayID, OverlaySelector, Z_ORDER_DASHBOARD,
},
};

View File

@@ -1,6 +1,6 @@
use glam::Affine3A;
use idmap::IdMap;
use smallvec::{smallvec, SmallVec};
use smallvec::{SmallVec, smallvec};
use std::sync::Arc;
use wgui::{
font_config::WguiFontConfig, gfx::WGfx, globals::WguiGlobals,

View File

@@ -1,5 +1,5 @@
use glam::Vec2;
use idmap::{idmap, IdMap};
use idmap::{IdMap, idmap};
use idmap_derive::IntegerId;
use input_linux::{
AbsoluteAxis, AbsoluteInfo, AbsoluteInfoSetup, EventKind, InputId, Key, RelativeAxis,

View File

@@ -1,12 +1,12 @@
use anyhow::Context;
use wlx_capture::wayland::wayland_client::{
globals::{registry_queue_init, GlobalListContents},
Connection, Dispatch, Proxy, QueueHandle,
globals::{GlobalListContents, registry_queue_init},
protocol::{
wl_keyboard::{self, WlKeyboard},
wl_registry::WlRegistry,
wl_seat::{self, Capability, WlSeat},
},
Connection, Dispatch, Proxy, QueueHandle,
};
use xkbcommon::xkb;

View File

@@ -1,8 +1,8 @@
use xkbcommon::xkb::{
self,
x11::{
MIN_MAJOR_XKB_VERSION, MIN_MINOR_XKB_VERSION, SetupXkbExtensionFlags,
get_core_keyboard_device_id, keymap_new_from_device, setup_xkb_extension,
SetupXkbExtensionFlags, MIN_MAJOR_XKB_VERSION, MIN_MINOR_XKB_VERSION,
},
};

View File

@@ -7,8 +7,8 @@ use vulkano::{
image::view::ImageView,
};
use wgui::gfx::{
cmd::{GfxCommandBuffer, WGfxClearMode},
WGfx,
cmd::{GfxCommandBuffer, WGfxClearMode},
};
use crate::{
@@ -16,7 +16,7 @@ use crate::{
graphics::ExtentExt,
state::AppState,
subsystem::hid::WheelDelta,
windowing::{window::OverlayCategory, OverlayID},
windowing::{OverlayID, window::OverlayCategory},
};
#[derive(Default, Clone, Copy)]

View File

@@ -12,6 +12,7 @@ use wlx_common::{
};
use crate::{
FRAME_COUNTER,
backend::task::OverlayTask,
overlays::{
anchor::create_anchor, edit::EditWrapperManager, keyboard::builder::create_keyboard,
@@ -19,13 +20,12 @@ use crate::{
},
state::AppState,
windowing::{
OverlayID, OverlaySelector,
backend::{OverlayEventData, OverlayMeta},
set::OverlayWindowSet,
snap_upright,
window::{OverlayCategory, OverlayWindowData},
OverlayID, OverlaySelector,
},
FRAME_COUNTER,
};
pub const MAX_OVERLAY_SETS: usize = 7;
@@ -331,7 +331,9 @@ impl<T> OverlayWindowManager<T> {
log::debug!("set {i}: loaded state for {name}");
overlays.insert(id, o.clone());
} else {
log::debug!("set {i} has saved state for {name} which doesn't exist. will apply state once added.");
log::debug!(
"set {i} has saved state for {name} which doesn't exist. will apply state once added."
);
inactive_overlays.arc_set(name.clone(), o.clone());
}
}