1
0
Fork 0
forked from wry/wry

Format again...

This commit is contained in:
entailz 2026-05-03 02:23:20 -07:00
parent 0701c4e4cf
commit fa0ab2f1fa
13 changed files with 41 additions and 79 deletions

View file

@ -3544,9 +3544,7 @@ impl ConfigProxyHandler {
fn handle_trigger_global_shortcut(&self, app_id: &str, id: &str) {
let key = (app_id.to_string(), id.to_string());
let Some(shortcut) = self.state.hyprland_global_shortcuts.get(&key) else {
log::debug!(
"no client has registered hyprland global shortcut {app_id:?}:{id:?}"
);
log::debug!("no client has registered hyprland global shortcut {app_id:?}:{id:?}");
return;
};
shortcut.send_pressed_now();

View file

@ -153,8 +153,7 @@ impl VulkanRenderer {
let passes = passes.clamp(1, 6) as u32;
let format = target.format.vk_format;
let mut levels: Vec<Rc<VulkanImage>> =
Vec::with_capacity(passes as usize + 1);
let mut levels: Vec<Rc<VulkanImage>> = Vec::with_capacity(passes as usize + 1);
levels.push(self.acquire_blur_scratch(w, h, format)?);
let mut cw = w;
let mut ch = h;
@ -389,9 +388,7 @@ impl VulkanRenderer {
let pipeline = self.get_or_create_blur_composite_pipeline(target.format.vk_format)?;
let target_render_view = target
.render_view
.unwrap_or(target.texture_view);
let target_render_view = target.render_view.unwrap_or(target.texture_view);
let color_attachment = RenderingAttachmentInfo::default()
.image_view(target_render_view)
.image_layout(ImageLayout::COLOR_ATTACHMENT_OPTIMAL)
@ -425,12 +422,7 @@ impl VulkanRenderer {
};
// Identity uv across blurred level 0 (full image is the blurred rect).
let blurred_tc: [[f32; 2]; 4] = [
[1.0, 0.0],
[0.0, 0.0],
[1.0, 1.0],
[0.0, 1.0],
];
let blurred_tc: [[f32; 2]; 4] = [[1.0, 0.0], [0.0, 0.0], [1.0, 1.0], [0.0, 1.0]];
let push = BlurCompositePushConstants {
pos: mask.target_points,
blurred_tex_pos: blurred_tc,

View file

@ -840,8 +840,8 @@ impl VulkanRenderer {
.src_alpha_blend_factor(BlendFactor::ONE)
.dst_alpha_blend_factor(BlendFactor::ONE_MINUS_SRC_ALPHA)
.alpha_blend_op(BlendOp::ADD);
let color_blend_state = PipelineColorBlendStateCreateInfo::default()
.attachments(slice::from_ref(&blending));
let color_blend_state =
PipelineColorBlendStateCreateInfo::default().attachments(slice::from_ref(&blending));
let dynamic_states = [DynamicState::VIEWPORT, DynamicState::SCISSOR];
let dynamic_state =
PipelineDynamicStateCreateInfo::default().dynamic_states(&dynamic_states);
@ -1398,13 +1398,11 @@ impl VulkanRenderer {
} else {
None
};
memory.ops[RenderPass::FrameBuffer].push(VulkanOp::BlurBarrier(
VulkanBlurOp {
rect: b.rect,
passes: b.passes,
mask,
},
));
memory.ops[RenderPass::FrameBuffer].push(VulkanOp::BlurBarrier(VulkanBlurOp {
rect: b.rect,
passes: b.passes,
mask,
}));
}
}
}
@ -2122,19 +2120,18 @@ impl VulkanRenderer {
unsafe {
dev.cmd_end_rendering(buf);
}
let pix = blur
.rect
.to_rect(target.width as f32, target.height as f32);
let pix = blur.rect.to_rect(target.width as f32, target.height as f32);
let rect_arr = [pix.x1(), pix.y1(), pix.x2(), pix.y2()];
let mask_record = blur.mask.as_ref().map(|m| {
crate::gfx_apis::vulkan::blur::BlurMaskRecord {
mask_view: m.tex.texture_view,
mask_source_points: m.source.to_points(),
target_points: blur.rect.to_points(),
threshold: m.threshold,
_phantom: std::marker::PhantomData,
}
});
let mask_record =
blur.mask
.as_ref()
.map(|m| crate::gfx_apis::vulkan::blur::BlurMaskRecord {
mask_view: m.tex.texture_view,
mask_source_points: m.source.to_points(),
target_points: blur.rect.to_points(),
threshold: m.threshold,
_phantom: std::marker::PhantomData,
});
self.record_blur(
buf,
target,

View file

@ -30,6 +30,7 @@ use {
wl_output::WlOutputGlobal,
wl_registry::WlRegistry,
wl_seat::{
WlSeatGlobal,
ext_transient_seat_manager_v1::ExtTransientSeatManagerV1Global,
tablet::zwp_tablet_manager_v2::ZwpTabletManagerV2Global,
text_input::{
@ -41,7 +42,6 @@ use {
zwp_pointer_gestures_v1::ZwpPointerGesturesV1Global,
zwp_relative_pointer_manager_v1::ZwpRelativePointerManagerV1Global,
zwp_virtual_keyboard_manager_v1::ZwpVirtualKeyboardManagerV1Global,
WlSeatGlobal,
},
wl_shm::WlShmGlobal,
wl_subcompositor::WlSubcompositorGlobal,

View file

@ -55,11 +55,7 @@ impl HyprlandGlobalShortcutsManagerV1RequestHandler for HyprlandGlobalShortcutsM
Ok(())
}
fn register_shortcut(
&self,
req: RegisterShortcut,
_slf: &Rc<Self>,
) -> Result<(), Self::Error> {
fn register_shortcut(&self, req: RegisterShortcut, _slf: &Rc<Self>) -> Result<(), Self::Error> {
let shortcut_id = req.id.to_string();
let app_id = req.app_id.to_string();
let key = (app_id.clone(), shortcut_id.clone());

View file

@ -418,10 +418,7 @@ impl Node for XdgPopup {
}
fn node_render(&self, renderer: &mut Renderer, x: i32, y: i32, bounds: Option<&Rect>) {
let settings = self
.parent
.get()
.and_then(|p| p.layer_blur_settings());
let settings = self.parent.get().and_then(|p| p.layer_blur_settings());
if let Some(s) = settings {
if s.blur {
let extents = self.xdg.surface.extents.get();

View file

@ -825,10 +825,7 @@ impl XdgPopupParent for Popup {
if !blur && ignore_alpha.is_none() {
return None;
}
Some(crate::ifs::wl_surface::xdg_surface::xdg_popup::LayerPopupBlur {
blur,
ignore_alpha,
})
Some(crate::ifs::wl_surface::xdg_surface::xdg_popup::LayerPopupBlur { blur, ignore_alpha })
}
}

View file

@ -303,8 +303,7 @@ pub struct State {
pub bo_drop_queue: Rc<ObjectDropQueue<Rc<dyn BufferObject>>>,
pub virtual_outputs: VirtualOutputs,
pub clean_logs_older_than: Cell<Option<SystemTime>>,
pub hyprland_global_shortcuts:
CopyHashMap<(String, String), Rc<HyprlandGlobalShortcutV1>>,
pub hyprland_global_shortcuts: CopyHashMap<(String, String), Rc<HyprlandGlobalShortcutV1>>,
pub layer_rules: RefCell<Vec<jay_config::_private::LayerRuleIpc>>,
pub blur_config: Cell<jay_config::_private::BlurConfigIpc>,
}

View file

@ -521,22 +521,13 @@ impl ActionParser<'_> {
})
}
fn parse_global_shortcut(
&mut self,
span: Span,
ext: &mut Extractor<'_>,
) -> ParseResult<Self> {
let (name_opt, app_id_opt, id_opt) = ext.extract((
opt(str("name")),
opt(str("app_id")),
opt(str("id")),
))?;
fn parse_global_shortcut(&mut self, span: Span, ext: &mut Extractor<'_>) -> ParseResult<Self> {
let (name_opt, app_id_opt, id_opt) =
ext.extract((opt(str("name")), opt(str("app_id")), opt(str("id"))))?;
let (app_id, id) = match (app_id_opt, id_opt, name_opt) {
(Some(a), Some(i), _) => (a.value.to_string(), i.value.to_string()),
(None, None, Some(n)) => match n.value.split_once(':') {
Some((a, i)) if !a.is_empty() && !i.is_empty() => {
(a.to_string(), i.to_string())
}
Some((a, i)) if !a.is_empty() && !i.is_empty() => (a.to_string(), i.to_string()),
_ => {
return Err(
ActionParserError::GlobalShortcutBadName(n.value.to_string())

View file

@ -36,8 +36,7 @@ impl Parser for BlurConfigParser<'_> {
table: &IndexMap<Spanned<String>, Spanned<Value>>,
) -> ParseResult<Self> {
let mut ext = Extractor::new(self.0, span, table);
let (passes_val, size_val) =
ext.extract((opt(int("passes")), opt(fltorint("size"))))?;
let (passes_val, size_val) = ext.extract((opt(int("passes")), opt(fltorint("size"))))?;
let passes = passes_val.despan().and_then(|v| u8::try_from(v).ok());
let size = size_val.despan().map(|v| v as f32);
Ok(BlurConfig { passes, size })

View file

@ -8,6 +8,7 @@ use {
parsers::{
action::ActionParser,
actions::ActionsParser,
blur::BlurConfigParser,
clean_logs_older_than::CleanLogsOlderThanParser,
client_rule::ClientRulesParser,
color_management::ColorManagementParser,
@ -23,7 +24,6 @@ use {
input::InputsParser,
input_mode::InputModesParser,
keymap::KeymapParser,
blur::BlurConfigParser,
layer_rule::LayerRulesParser,
libei::LibeiParser,
log_level::LogLevelParser,

View file

@ -49,7 +49,7 @@ impl Parser for ModifiedKeysymParser {
}
let Some(new) = Keysym::from_str(part) else {
return Err(
ModifiedKeysymParserError::UnknownKeysym(part.to_string()).spanned(span),
ModifiedKeysymParserError::UnknownKeysym(part.to_string()).spanned(span)
);
};
let new = KeySym(new.0);

View file

@ -13,9 +13,8 @@ mod toml;
use {
crate::{
config::{
Action, ClientRule, Config, ConfigConnector, ConfigDrmDevice, ConfigKeymap,
BlurConfig, ConnectorMatch, DrmDeviceMatch, Exec, Input, InputMatch, LayerKind,
LayerRule, Output,
Action, BlurConfig, ClientRule, Config, ConfigConnector, ConfigDrmDevice, ConfigKeymap,
ConnectorMatch, DrmDeviceMatch, Exec, Input, InputMatch, LayerKind, LayerRule, Output,
OutputMatch, SimpleCommand, Status, Theme, WindowRule, parse_config,
},
rules::{MatcherTemp, RuleMapper},
@ -24,7 +23,8 @@ use {
ahash::{AHashMap, AHashSet},
error_reporter::Report,
jay_config::{
Axis,
_private::{BlurConfigIpc, LayerKindIpc, LayerMatchIpc, LayerRuleIpc},
_set_blur_config, _set_layer_rules, Axis,
client::Client,
config, config_dir,
exec::{Command, set_env, unset_env},
@ -38,8 +38,6 @@ use {
is_reload,
keyboard::Keymap,
logging::{clean_logs_older_than, set_log_level},
_set_blur_config, _set_layer_rules,
_private::{BlurConfigIpc, LayerKindIpc, LayerMatchIpc, LayerRuleIpc},
on_devices_enumerated, on_idle, on_unload, quit, reload, set_autotile,
set_color_management_enabled, set_corner_radius, set_default_workspace_capture,
set_explicit_sync_enabled, set_float_above_fullscreen, set_floating_titles, set_idle,
@ -511,11 +509,9 @@ impl Action {
Action::Resize { dx1, dy1, dx2, dy2 } => {
window_or_seat!(s, s.resize(dx1, dy1, dx2, dy2))
}
Action::TriggerGlobalShortcut { app_id, id } => {
b.new(move || {
jay_config::trigger_global_shortcut(&app_id, &id);
})
}
Action::TriggerGlobalShortcut { app_id, id } => b.new(move || {
jay_config::trigger_global_shortcut(&app_id, &id);
}),
}
}
}