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::{ use crate::{
assets, settings, assets, settings,
tab::{ tab::{
apps::TabApps, games::TabGames, home::TabHome, monado::TabMonado, processes::TabProcesses, settings::TabSettings, Tab, TabParams, TabType, apps::TabApps, games::TabGames, home::TabHome, monado::TabMonado, processes::TabProcesses,
Tab, TabParams, TabType, settings::TabSettings,
}, },
task::Tasks, task::Tasks,
util::{ util::{

View File

@@ -1,26 +1,26 @@
use glam::{vec2, Vec2}; use glam::{Vec2, vec2};
use std::sync::Arc; use std::sync::Arc;
use testbed::{testbed_any::TestbedAny, Testbed}; use testbed::{Testbed, testbed_any::TestbedAny};
use timestep::Timestep; use timestep::Timestep;
use tracing_subscriber::EnvFilter;
use tracing_subscriber::filter::LevelFilter; use tracing_subscriber::filter::LevelFilter;
use tracing_subscriber::layer::SubscriberExt; use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt; use tracing_subscriber::util::SubscriberInitExt;
use tracing_subscriber::EnvFilter;
use vulkan::init_window; use vulkan::init_window;
use vulkano::{ use vulkano::{
Validated, VulkanError,
command_buffer::CommandBufferUsage, command_buffer::CommandBufferUsage,
format::Format, format::Format,
image::{view::ImageView, ImageUsage}, image::{ImageUsage, view::ImageView},
swapchain::{ swapchain::{
acquire_next_image, CompositeAlpha, PresentMode, Surface, SurfaceInfo, Swapchain, CompositeAlpha, PresentMode, Surface, SurfaceInfo, Swapchain, SwapchainCreateInfo,
SwapchainCreateInfo, SwapchainPresentInfo, SwapchainPresentInfo, acquire_next_image,
}, },
sync::GpuFuture, sync::GpuFuture,
Validated, VulkanError,
}; };
use wgui::{ use wgui::{
event::{MouseButtonIndex, MouseDownEvent, MouseMotionEvent, MouseUpEvent, MouseWheelEvent}, event::{MouseButtonIndex, MouseDownEvent, MouseMotionEvent, MouseUpEvent, MouseWheelEvent},
gfx::{cmd::WGfxClearMode, WGfx}, gfx::{WGfx, cmd::WGfxClearMode},
renderer_vk::{self}, renderer_vk::{self},
}; };
use winit::{ use winit::{
@@ -32,7 +32,7 @@ use winit::{
use crate::{ use crate::{
rate_limiter::RateLimiter, rate_limiter::RateLimiter,
testbed::{ 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); composite_alpha = Some(c);
break; 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 let composite_alpha = composite_alpha
.expect("GPU driver issue: VkSurfaceCapabilitiesKHR has empty supportedCompositeAlpha."); .expect("GPU driver issue: VkSurfaceCapabilitiesKHR has empty supportedCompositeAlpha.");
@@ -436,7 +438,9 @@ fn swapchain_create_info(
present_mode = Some(pm); present_mode = Some(pm);
break; 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."); 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::{ use wgui::{
assets::AssetPath, assets::AssetPath,
components::{ components::{
Component,
button::{ButtonClickCallback, ComponentButton}, button::{ButtonClickCallback, ComponentButton},
checkbox::ComponentCheckbox, checkbox::ComponentCheckbox,
Component,
}, },
drawing::Color, drawing::Color,
event::StyleSetRequest, event::StyleSetRequest,

View File

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

View File

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

View File

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

View File

@@ -48,4 +48,4 @@ pub fn parse_component_checkbox(
process_component(ctx, Component(component), widget.id, attribs); process_component(ctx, Component(component), widget.id, attribs);
Ok(widget.id) Ok(widget.id)
} }

View File

@@ -1,7 +1,7 @@
use crate::{ use crate::{
components::{slider, Component}, components::{Component, slider},
layout::WidgetID, 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, widget::ConstructEssentials,
}; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,12 +1,12 @@
use image_dds::{ImageFormat, Surface}; use image_dds::{ImageFormat, Surface};
use std::{io::Read, sync::Arc}; use std::{io::Read, sync::Arc};
use vulkano::{ use vulkano::{
DeviceSize,
buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer}, buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::CopyBufferToImageInfo, command_buffer::CopyBufferToImageInfo,
format::Format, format::Format,
image::{Image, ImageCreateInfo, ImageType, ImageUsage}, image::{Image, ImageCreateInfo, ImageType, ImageUsage},
memory::allocator::{AllocationCreateInfo, MemoryTypeFilter}, memory::allocator::{AllocationCreateInfo, MemoryTypeFilter},
DeviceSize,
}; };
use wgui::gfx::cmd::XferCommandBuffer; use wgui::gfx::cmd::XferCommandBuffer;
@@ -22,7 +22,9 @@ impl WlxCommandBufferDds for XferCommandBuffer {
R: Read, R: Read,
{ {
let Ok(dds) = image_dds::ddsfile::Dds::read(r) else { 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)?; let surface = Surface::from_dds(&dds)?;

View File

@@ -7,21 +7,21 @@ use std::{
use anyhow::Context; use anyhow::Context;
use smallvec::SmallVec; use smallvec::SmallVec;
use vulkano::{ use vulkano::{
VulkanError, VulkanObject,
device::Device, device::Device,
format::Format, format::Format,
image::{sys::RawImage, Image, ImageCreateInfo, ImageTiling, ImageUsage, SubresourceLayout}, image::{Image, ImageCreateInfo, ImageTiling, ImageUsage, SubresourceLayout, sys::RawImage},
memory::{ memory::{
allocator::{MemoryAllocator, MemoryTypeFilter},
DedicatedAllocation, DeviceMemory, ExternalMemoryHandleType, ExternalMemoryHandleTypes, DedicatedAllocation, DeviceMemory, ExternalMemoryHandleType, ExternalMemoryHandleTypes,
MemoryAllocateInfo, MemoryImportInfo, MemoryPropertyFlags, ResourceMemory, MemoryAllocateInfo, MemoryImportInfo, MemoryPropertyFlags, ResourceMemory,
allocator::{MemoryAllocator, MemoryTypeFilter},
}, },
sync::Sharing, sync::Sharing,
VulkanError, VulkanObject,
}; };
use wgui::gfx::WGfx; use wgui::gfx::WGfx;
use wlx_capture::frame::{ use wlx_capture::frame::{
DmabufFrame, DrmFormat, FourCC, DRM_FORMAT_ABGR2101010, DRM_FORMAT_ABGR8888, DRM_FORMAT_ABGR8888, DRM_FORMAT_ABGR2101010, DRM_FORMAT_ARGB8888, DRM_FORMAT_XBGR8888,
DRM_FORMAT_ARGB8888, DRM_FORMAT_XBGR2101010, DRM_FORMAT_XBGR8888, DRM_FORMAT_XRGB8888, DRM_FORMAT_XBGR2101010, DRM_FORMAT_XRGB8888, DmabufFrame, DrmFormat, FourCC,
}; };
pub const DRM_FORMAT_MOD_INVALID: u64 = 0xff_ffff_ffff_ffff; pub const DRM_FORMAT_MOD_INVALID: u64 = 0xff_ffff_ffff_ffff;

View File

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

View File

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

View File

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

View File

@@ -17,8 +17,8 @@ use wgui::{
event::{self, EventCallback}, event::{self, EventCallback},
i18n::Translation, i18n::Translation,
layout::Layout, layout::Layout,
parser::{parse_color_hex, CustomAttribsInfoOwned}, parser::{CustomAttribsInfoOwned, parse_color_hex},
widget::{label::WidgetLabel, EventResult}, widget::{EventResult, label::WidgetLabel},
}; };
use crate::{gui::panel::helper::PipeReaderThread, state::AppState}; 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)); label.set_text(common, Translation::from_raw_text(&text));
} }
if reader.is_finished() if reader.is_finished() && !mut_state.reader.take().unwrap().is_success() {
&& !mut_state.reader.take().unwrap().is_success() { mut_state.next_try = Instant::now() + Duration::from_secs(15);
mut_state.next_try = Instant::now() + Duration::from_secs(15); }
}
return Ok(()); return Ok(());
} else if mut_state.next_try > Instant::now() { } else if mut_state.next_try > Instant::now() {
return Ok(()); return Ok(());
@@ -302,10 +301,9 @@ fn fifo_on_tick(
label.set_text(common, Translation::from_raw_text(&text)); label.set_text(common, Translation::from_raw_text(&text));
} }
if reader.is_finished() if reader.is_finished() && !mut_state.reader.take().unwrap().is_success() {
&& !mut_state.reader.take().unwrap().is_success() { mut_state.next_try = Instant::now() + Duration::from_secs(15);
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.); 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 std::{cell::RefCell, rc::Rc};
use button::setup_custom_button; use button::setup_custom_button;
use glam::{vec2, Affine2, Vec2}; use glam::{Affine2, Vec2, vec2};
use label::setup_custom_label; use label::setup_custom_label;
use wgui::{ use wgui::{
assets::AssetPath, assets::AssetPath,
@@ -16,7 +16,7 @@ use wgui::{
layout::{Layout, LayoutParams, WidgetID}, layout::{Layout, LayoutParams, WidgetID},
parser::{CustomAttribsInfoOwned, Fetchable, ParserState}, parser::{CustomAttribsInfoOwned, Fetchable, ParserState},
renderer_vk::context::Context as WguiContext, renderer_vk::context::Context as WguiContext,
widget::{label::WidgetLabel, EventResult}, widget::{EventResult, label::WidgetLabel},
}; };
use wlx_common::timestep::Timestep; use wlx_common::timestep::Timestep;
@@ -25,7 +25,7 @@ use crate::{
state::AppState, state::AppState,
subsystem::hid::WheelDelta, subsystem::hid::WheelDelta,
windowing::backend::{ 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 subsystem::notifications::DbusNotificationSender;
use sysinfo::Pid; use sysinfo::Pid;
use tracing::level_filters::LevelFilter; 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 FRAME_COUNTER: AtomicUsize = AtomicUsize::new(0);
pub static RUNNING: AtomicBool = AtomicBool::new(true); pub static RUNNING: AtomicBool = AtomicBool::new(true);
@@ -131,7 +131,7 @@ fn auto_run(args: Args) {
#[cfg(feature = "openxr")] #[cfg(feature = "openxr")]
if !args_get_openvr(&args) { if !args_get_openvr(&args) {
use crate::backend::{openxr::openxr_run, BackendError}; use crate::backend::{BackendError, openxr::openxr_run};
tried_xr = true; tried_xr = true;
match openxr_run(args.show, args.headless) { match openxr_run(args.show, args.headless) {
Ok(()) => return, Ok(()) => return,
@@ -145,7 +145,7 @@ fn auto_run(args: Args) {
#[cfg(feature = "openvr")] #[cfg(feature = "openvr")]
if !args_get_openxr(&args) { if !args_get_openxr(&args) {
use crate::backend::{openvr::openvr_run, BackendError}; use crate::backend::{BackendError, openvr::openvr_run};
tried_vr = true; tried_vr = true;
match openvr_run(args.show, args.headless) { match openvr_run(args.show, args.headless) {
Ok(()) => return, Ok(()) => return,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
use std::{f32::consts::PI, sync::Arc}; 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_capture::frame::Transform;
use wlx_common::windowing::{OverlayWindowState, Positioning}; use wlx_common::windowing::{OverlayWindowState, Positioning};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,8 +1,8 @@
use xkbcommon::xkb::{ use xkbcommon::xkb::{
self, self,
x11::{ x11::{
MIN_MAJOR_XKB_VERSION, MIN_MINOR_XKB_VERSION, SetupXkbExtensionFlags,
get_core_keyboard_device_id, keymap_new_from_device, setup_xkb_extension, 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, image::view::ImageView,
}; };
use wgui::gfx::{ use wgui::gfx::{
cmd::{GfxCommandBuffer, WGfxClearMode},
WGfx, WGfx,
cmd::{GfxCommandBuffer, WGfxClearMode},
}; };
use crate::{ use crate::{
@@ -16,7 +16,7 @@ use crate::{
graphics::ExtentExt, graphics::ExtentExt,
state::AppState, state::AppState,
subsystem::hid::WheelDelta, subsystem::hid::WheelDelta,
windowing::{window::OverlayCategory, OverlayID}, windowing::{OverlayID, window::OverlayCategory},
}; };
#[derive(Default, Clone, Copy)] #[derive(Default, Clone, Copy)]

View File

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