clippy
This commit is contained in:
@@ -1165,7 +1165,6 @@ pub struct WlxPipelineDynamic {}
|
|||||||
pub struct WlxPipelineLegacy {
|
pub struct WlxPipelineLegacy {
|
||||||
pub render_pass: Arc<RenderPass>,
|
pub render_pass: Arc<RenderPass>,
|
||||||
pub framebuffer: Arc<Framebuffer>,
|
pub framebuffer: Arc<Framebuffer>,
|
||||||
pub view: Arc<ImageView>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct WlxPipeline<D> {
|
pub struct WlxPipeline<D> {
|
||||||
@@ -1399,7 +1398,6 @@ impl WlxPipeline<WlxPipelineLegacy> {
|
|||||||
data: WlxPipelineLegacy {
|
data: WlxPipelineLegacy {
|
||||||
render_pass,
|
render_pass,
|
||||||
framebuffer,
|
framebuffer,
|
||||||
view: render_target,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,21 +120,24 @@ impl<D, S> Control<D, S> {
|
|||||||
self.rect.h,
|
self.rect.h,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let clamped_radius = self.corner_radius.min(self.rect.w / 2.0).min(self.rect.h / 2.0);
|
let clamped_radius = self
|
||||||
|
.corner_radius
|
||||||
|
.min(self.rect.w / 2.0)
|
||||||
|
.min(self.rect.h / 2.0);
|
||||||
|
|
||||||
let skew_radius = vec![
|
let skew_radius = [clamped_radius / self.rect.w, clamped_radius / self.rect.h];
|
||||||
clamped_radius / self.rect.w,
|
|
||||||
clamped_radius / self.rect.h];
|
|
||||||
|
|
||||||
let set0 = canvas
|
let set0 = canvas.pipeline_bg_color.uniform_buffer(
|
||||||
.pipeline_bg_color
|
0,
|
||||||
.uniform_buffer(0, vec![
|
vec![
|
||||||
self.bg_color.x,
|
self.bg_color.x,
|
||||||
self.bg_color.y,
|
self.bg_color.y,
|
||||||
self.bg_color.z,
|
self.bg_color.z,
|
||||||
self.bg_color.w,
|
self.bg_color.w,
|
||||||
skew_radius[0],
|
skew_radius[0],
|
||||||
skew_radius[1]])?;
|
skew_radius[1],
|
||||||
|
],
|
||||||
|
)?;
|
||||||
|
|
||||||
canvas.pipeline_bg_color.create_pass(
|
canvas.pipeline_bg_color.create_pass(
|
||||||
[canvas.width as _, canvas.height as _],
|
[canvas.width as _, canvas.height as _],
|
||||||
@@ -163,21 +166,24 @@ impl<D, S> Control<D, S> {
|
|||||||
self.rect.h,
|
self.rect.h,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let clamped_radius = self.corner_radius.min(self.rect.w / 2.0).min(self.rect.h / 2.0);
|
let clamped_radius = self
|
||||||
|
.corner_radius
|
||||||
|
.min(self.rect.w / 2.0)
|
||||||
|
.min(self.rect.h / 2.0);
|
||||||
|
|
||||||
let skew_radius = vec![
|
let skew_radius = [clamped_radius / self.rect.w, clamped_radius / self.rect.h];
|
||||||
clamped_radius / self.rect.w,
|
|
||||||
clamped_radius / self.rect.h];
|
|
||||||
|
|
||||||
let set0 = canvas
|
let set0 = canvas.pipeline_bg_color.uniform_buffer(
|
||||||
.pipeline_bg_color
|
0,
|
||||||
.uniform_buffer(0, vec![
|
vec![
|
||||||
color.x,
|
color.x,
|
||||||
color.y,
|
color.y,
|
||||||
color.z,
|
color.z,
|
||||||
color.w,
|
color.w,
|
||||||
skew_radius[0],
|
skew_radius[0],
|
||||||
skew_radius[1]])?;
|
skew_radius[1],
|
||||||
|
],
|
||||||
|
)?;
|
||||||
|
|
||||||
let pass = canvas.pipeline_bg_color.create_pass(
|
let pass = canvas.pipeline_bg_color.create_pass(
|
||||||
[canvas.width as _, canvas.height as _],
|
[canvas.width as _, canvas.height as _],
|
||||||
|
|||||||
@@ -533,7 +533,6 @@ pub fn get_key_type(key: VirtualKey) -> KeyType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct XkbKeymap {
|
pub struct XkbKeymap {
|
||||||
pub context: xkb::Context,
|
|
||||||
pub keymap: xkb::Keymap,
|
pub keymap: xkb::Keymap,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ impl Dispatch<WlKeyboard, ()> for WlKeymapHandler {
|
|||||||
|
|
||||||
match maybe_keymap {
|
match maybe_keymap {
|
||||||
Ok(Some(keymap)) => {
|
Ok(Some(keymap)) => {
|
||||||
state.keymap = Some(XkbKeymap { context, keymap });
|
state.keymap = Some(XkbKeymap { keymap });
|
||||||
}
|
}
|
||||||
Ok(None) => {
|
Ok(None) => {
|
||||||
log::error!("Could not load keymap: no keymap");
|
log::error!("Could not load keymap: no keymap");
|
||||||
|
|||||||
@@ -31,5 +31,5 @@ pub fn get_keymap_x11() -> anyhow::Result<XkbKeymap> {
|
|||||||
}
|
}
|
||||||
let keymap = keymap_new_from_device(&context, &conn, device_id, xkb::KEYMAP_COMPILE_NO_FLAGS);
|
let keymap = keymap_new_from_device(&context, &conn, device_id, xkb::KEYMAP_COMPILE_NO_FLAGS);
|
||||||
|
|
||||||
Ok(XkbKeymap { context, keymap })
|
Ok(XkbKeymap { keymap })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,12 @@ use {
|
|||||||
crate::config_io,
|
crate::config_io,
|
||||||
std::error::Error,
|
std::error::Error,
|
||||||
std::{ops::Deref, path::PathBuf},
|
std::{ops::Deref, path::PathBuf},
|
||||||
wlx_capture::pipewire::{pipewire_select_screen, PipewireCapture, PipewireStream},
|
wlx_capture::pipewire::{pipewire_select_screen, PipewireCapture},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(all(feature = "x11", feature = "pipewire"))]
|
||||||
|
use wlx_capture::pipewire::PipewireStream;
|
||||||
|
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
use {
|
use {
|
||||||
crate::config::AStrMapExt,
|
crate::config::AStrMapExt,
|
||||||
@@ -296,7 +299,7 @@ impl ScreenRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
pub fn new_wlr_dmabuf(output: &WlxOutput, config: &GeneralConfig) -> Option<ScreenRenderer> {
|
pub fn new_wlr_dmabuf(output: &WlxOutput) -> Option<ScreenRenderer> {
|
||||||
let client = WlxClient::new()?;
|
let client = WlxClient::new()?;
|
||||||
let capture = WlrDmabufCapture::new(client, output.id);
|
let capture = WlrDmabufCapture::new(client, output.id);
|
||||||
|
|
||||||
@@ -310,10 +313,7 @@ impl ScreenRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
pub fn new_wlr_screencopy(
|
pub fn new_wlr_screencopy(output: &WlxOutput) -> Option<ScreenRenderer> {
|
||||||
output: &WlxOutput,
|
|
||||||
config: &GeneralConfig,
|
|
||||||
) -> Option<ScreenRenderer> {
|
|
||||||
let client = WlxClient::new()?;
|
let client = WlxClient::new()?;
|
||||||
let capture = WlrScreencopyCapture::new(client, output.id);
|
let capture = WlrScreencopyCapture::new(client, output.id);
|
||||||
|
|
||||||
@@ -370,7 +370,7 @@ impl ScreenRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "x11")]
|
#[cfg(feature = "x11")]
|
||||||
pub fn new_xshm(screen: Arc<XshmScreen>, config: &GeneralConfig) -> ScreenRenderer {
|
pub fn new_xshm(screen: Arc<XshmScreen>) -> ScreenRenderer {
|
||||||
let capture = XshmCapture::new(screen.clone());
|
let capture = XshmCapture::new(screen.clone());
|
||||||
|
|
||||||
ScreenRenderer {
|
ScreenRenderer {
|
||||||
@@ -602,12 +602,12 @@ pub fn create_screen_renderer_wl(
|
|||||||
&& has_wlr_dmabuf
|
&& has_wlr_dmabuf
|
||||||
{
|
{
|
||||||
log::info!("{}: Using Wlr DMA-Buf", &output.name);
|
log::info!("{}: Using Wlr DMA-Buf", &output.name);
|
||||||
capture = ScreenRenderer::new_wlr_dmabuf(output, &session.config);
|
capture = ScreenRenderer::new_wlr_dmabuf(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
if &*session.config.capture_method == "screencopy" && has_wlr_screencopy {
|
if &*session.config.capture_method == "screencopy" && has_wlr_screencopy {
|
||||||
log::info!("{}: Using Wlr Screencopy Wl-SHM", &output.name);
|
log::info!("{}: Using Wlr Screencopy Wl-SHM", &output.name);
|
||||||
capture = ScreenRenderer::new_wlr_screencopy(output, &session.config);
|
capture = ScreenRenderer::new_wlr_screencopy(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
if capture.is_none() {
|
if capture.is_none() {
|
||||||
@@ -949,7 +949,7 @@ pub fn create_screens_xshm(app: &mut AppState) -> anyhow::Result<ScreenCreateDat
|
|||||||
|
|
||||||
let size = (s.monitor.width(), s.monitor.height());
|
let size = (s.monitor.width(), s.monitor.height());
|
||||||
let pos = (s.monitor.x(), s.monitor.y());
|
let pos = (s.monitor.x(), s.monitor.y());
|
||||||
let renderer = ScreenRenderer::new_xshm(s.clone(), &app.session.config);
|
let renderer = ScreenRenderer::new_xshm(s.clone());
|
||||||
|
|
||||||
log::info!(
|
log::info!(
|
||||||
"{}: Init X11 screen of res {:?} at {:?}",
|
"{}: Init X11 screen of res {:?} at {:?}",
|
||||||
|
|||||||
31
src/state.rs
31
src/state.rs
@@ -1,7 +1,7 @@
|
|||||||
use std::{io::Cursor, path::PathBuf, sync::Arc};
|
use std::{io::Cursor, sync::Arc};
|
||||||
|
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
use glam::{Affine3A, Vec3};
|
use glam::Affine3A;
|
||||||
use idmap::IdMap;
|
use idmap::IdMap;
|
||||||
use rodio::{Decoder, OutputStream, OutputStreamHandle, Source};
|
use rodio::{Decoder, OutputStream, OutputStreamHandle, Source};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@@ -89,15 +89,9 @@ impl AppState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct AppSession {
|
pub struct AppSession {
|
||||||
pub config_root_path: PathBuf,
|
|
||||||
pub config: GeneralConfig,
|
pub config: GeneralConfig,
|
||||||
|
|
||||||
pub toast_topics: IdMap<ToastTopic, DisplayMethod>,
|
pub toast_topics: IdMap<ToastTopic, DisplayMethod>,
|
||||||
|
|
||||||
pub color_norm: Vec3,
|
|
||||||
pub color_shift: Vec3,
|
|
||||||
pub color_alt: Vec3,
|
|
||||||
pub color_grab: Vec3,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AppSession {
|
impl AppSession {
|
||||||
@@ -116,29 +110,8 @@ impl AppSession {
|
|||||||
});
|
});
|
||||||
|
|
||||||
AppSession {
|
AppSession {
|
||||||
config_root_path,
|
|
||||||
config,
|
config,
|
||||||
toast_topics,
|
toast_topics,
|
||||||
color_norm: Vec3 {
|
|
||||||
x: 0.,
|
|
||||||
y: 1.,
|
|
||||||
z: 1.,
|
|
||||||
},
|
|
||||||
color_shift: Vec3 {
|
|
||||||
x: 1.,
|
|
||||||
y: 1.,
|
|
||||||
z: 0.,
|
|
||||||
},
|
|
||||||
color_alt: Vec3 {
|
|
||||||
x: 1.,
|
|
||||||
y: 0.,
|
|
||||||
z: 1.,
|
|
||||||
},
|
|
||||||
color_grab: Vec3 {
|
|
||||||
x: 1.,
|
|
||||||
y: 0.,
|
|
||||||
z: 0.,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user