mirrors, recenter, fix floor

This commit is contained in:
galister
2025-12-11 23:55:18 +09:00
parent 4314610244
commit a5cacc2e70
44 changed files with 218 additions and 19 deletions

View File

@@ -1,10 +1,13 @@
use std::{
sync::Arc,
sync::{
atomic::{AtomicUsize, Ordering},
Arc,
},
task::{Context, Poll},
};
use futures::{Future, FutureExt};
use glam::{Affine2, Affine3A, Vec3};
use glam::{vec3, Affine2, Affine3A, Quat, Vec3};
use wlx_capture::pipewire::{pipewire_select_screen, PipewireCapture, PipewireSelectScreenResult};
use wlx_common::windowing::OverlayWindowState;
@@ -30,6 +33,8 @@ type PinnedSelectorFuture = core::pin::Pin<
Box<dyn Future<Output = Result<PipewireSelectScreenResult, wlx_capture::pipewire::AshpdError>>>,
>;
static MIRROR_COUNTER: AtomicUsize = AtomicUsize::new(1);
pub struct MirrorBackend {
name: Arc<str>,
renderer: Option<ScreenBackend>,
@@ -149,14 +154,24 @@ impl OverlayBackend for MirrorBackend {
}
}
pub fn new_mirror_name() -> Arc<str> {
format!("M-{}", MIRROR_COUNTER.fetch_add(1, Ordering::Relaxed)).into()
}
pub fn new_mirror(name: Arc<str>, session: &AppSession) -> OverlayWindowConfig {
OverlayWindowConfig {
name: name.clone(),
category: OverlayCategory::Mirror,
show_on_spawn: true,
default_state: OverlayWindowState {
interactable: true,
grabbable: true,
transform: Affine3A::from_scale(Vec3::ONE * 0.5 * session.config.desktop_view_scale),
curvature: Some(0.15),
transform: Affine3A::from_scale_rotation_translation(
Vec3::ONE * session.config.desktop_view_scale,
Quat::IDENTITY,
vec3(0.0, 0.2, -0.35),
),
..OverlayWindowState::default()
},
..OverlayWindowConfig::from_backend(Box::new(MirrorBackend::new(name)))