blur enabled event

This commit is contained in:
Ashley Wulber 2026-04-17 13:41:09 -04:00 committed by Ashley Wulber
parent 1bcba7e30c
commit a63d57261f
3 changed files with 21 additions and 20 deletions

View file

@ -46,4 +46,6 @@ pub enum Event {
Subsurface(SubsurfaceEvent), Subsurface(SubsurfaceEvent),
/// Keyboard inhibit shortcuts /// Keyboard inhibit shortcuts
ShortcutsInhibited(bool), ShortcutsInhibited(bool),
/// Blur Support Enabled
BlurEnabled,
} }

View file

@ -1,6 +1,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use cctk::sctk; use cctk::sctk;
use iced_futures::futures::SinkExt;
use iced_runtime::core::Rectangle; use iced_runtime::core::Rectangle;
use iced_runtime::platform_specific::wayland::Action; use iced_runtime::platform_specific::wayland::Action;
use sctk::globals::GlobalData; use sctk::globals::GlobalData;
@ -11,7 +12,7 @@ use wayland_protocols::ext::background_effect::v1::client::ext_background_effect
use wayland_protocols::ext::background_effect::v1::client::ext_background_effect_surface_v1::ExtBackgroundEffectSurfaceV1; use wayland_protocols::ext::background_effect::v1::client::ext_background_effect_surface_v1::ExtBackgroundEffectSurfaceV1;
use crate::event_loop::state::SctkState; use crate::event_loop::state::SctkState;
use crate::window; use crate::{platform_specific, window};
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ExtBackgroundEffectManager { pub struct ExtBackgroundEffectManager {
@ -70,8 +71,15 @@ impl Dispatch<ExtBackgroundEffectManagerV1, GlobalData, SctkState>
state.ext_background_effect_manager.as_mut() state.ext_background_effect_manager.as_mut()
{ {
bg_effect_mgr.capabilities = capability; bg_effect_mgr.capabilities = capability;
queued_actions = if capability.contains(Capability::Blur) {
bg_effect_mgr.queued_blur_actions.drain().collect(); queued_actions = bg_effect_mgr
.queued_blur_actions
.drain()
.collect();
state
.sctk_events
.push(crate::sctk_event::SctkEvent::Blur);
}
} }
for (id, rects) in queued_actions { for (id, rects) in queued_actions {
_ = state.handle_action(Action::BlurSurface(id, rects)); _ = state.handle_action(Action::BlurSurface(id, rects));

View file

@ -68,10 +68,8 @@ use cctk::{
xdg::{popup::PopupConfigure, window::WindowConfigure}, xdg::{popup::PopupConfigure, window::WindowConfigure},
}, },
}, },
wayland_client::protocol::wl_subsurface::WlSubsurface,
}; };
use std::{ use std::{
any::Any,
collections::HashMap, collections::HashMap,
num::NonZeroU32, num::NonZeroU32,
sync::{Arc, Mutex}, sync::{Arc, Mutex},
@ -98,9 +96,7 @@ use super::{
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum SctkEvent { pub enum SctkEvent {
// Blur,
// Input events
//
SeatEvent { SeatEvent {
variant: SeatEventVariant, variant: SeatEventVariant,
id: WlSeat, id: WlSeat,
@ -122,11 +118,6 @@ pub enum SctkEvent {
seat_id: WlSeat, seat_id: WlSeat,
surface: WlSurface, surface: WlSurface,
}, },
// TODO data device & touch
//
// Surface Events
//
WindowEvent { WindowEvent {
variant: WindowEventVariant, variant: WindowEventVariant,
id: WlSurface, id: WlSurface,
@ -167,10 +158,6 @@ pub enum SctkEvent {
}, },
SubsurfaceEvent(SubsurfaceEventVariant), SubsurfaceEvent(SubsurfaceEventVariant),
//
// output events
//
NewOutput { NewOutput {
id: WlOutput, id: WlOutput,
info: Option<OutputInfo>, info: Option<OutputInfo>,
@ -180,9 +167,7 @@ pub enum SctkEvent {
info: OutputInfo, info: OutputInfo,
}, },
RemovedOutput(WlOutput), RemovedOutput(WlOutput),
//
// compositor events
//
ScaleFactorChanged { ScaleFactorChanged {
factor: f64, factor: f64,
id: WlOutput, id: WlOutput,
@ -1738,6 +1723,12 @@ impl SctkEvent {
), ),
), ),
)), )),
SctkEvent::Blur => events.push((
None,
iced_runtime::core::Event::PlatformSpecific(
PlatformSpecific::Wayland(wayland::Event::BlurEnabled),
),
)),
} }
} }
} }