Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 29 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,8 @@ split-debuginfo = "unpacked"
lto = false
incremental = true
opt-level = 0

[patch.crates-io]
wayland-backend = { git = "https://github.com/Smithay/wayland-rs.git", rev = "9de018a", optional = true }
wayland-client = { git = "https://github.com/Smithay/wayland-rs.git", rev = "9de018a", optional = true }
wayland-protocols = { git = "https://github.com/Smithay/wayland-rs.git", rev = "9de018a", optional = true }
4 changes: 0 additions & 4 deletions rio-window/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ wayland = [
"wayland-client",
"wayland-backend",
"wayland-protocols",
"wayland-protocols-plasma",
"sctk",
"ahash",
"memmap2",
Expand Down Expand Up @@ -170,9 +169,6 @@ wayland-client = { version = "0.31.10", optional = true }
wayland-protocols = { version = "0.32.8", features = [
"staging",
], optional = true }
wayland-protocols-plasma = { version = "0.3.8", features = [
"client",
], optional = true }
x11-dl = { version = "2.19.1", optional = true }
x11rb = { version = "0.13.0", default-features = false, features = [
"allow-unsafe-code",
Expand Down
12 changes: 8 additions & 4 deletions rio-window/src/platform_impl/linux/wayland/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::platform_impl::wayland::seat::{
PointerConstraintsState, RelativePointerState, TextInputState, WinitPointerData,
WinitPointerDataExt, WinitSeatState,
};
use crate::platform_impl::wayland::types::kwin_blur::KWinBlurManager;
use crate::platform_impl::wayland::types::ext_background_effect::BackgroundEffectManager;
use crate::platform_impl::wayland::types::wp_fractional_scaling::FractionalScalingManager;
use crate::platform_impl::wayland::types::wp_viewporter::ViewporterState;
use crate::platform_impl::wayland::types::xdg_activation::XdgActivationState;
Expand Down Expand Up @@ -106,8 +106,8 @@ pub struct WinitState {
/// Fractional scaling manager.
pub fractional_scaling_manager: Option<FractionalScalingManager>,

/// KWin blur manager.
pub kwin_blur_manager: Option<KWinBlurManager>,
/// Background effect manager.
pub background_effect_manager: Option<BackgroundEffectManager>,

/// Loop handle to re-register event sources, such as keyboard repeat.
pub loop_handle: LoopHandle<'static, Self>,
Expand Down Expand Up @@ -179,7 +179,11 @@ impl WinitState {
window_events_sink: Default::default(),
viewporter_state,
fractional_scaling_manager,
kwin_blur_manager: KWinBlurManager::new(globals, queue_handle).ok(),
background_effect_manager: BackgroundEffectManager::new(
globals,
queue_handle,
)
.ok(),

seats,
text_input_state: TextInputState::new(globals, queue_handle).ok(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
//! Handling of background effect.

use sctk::reexports::client::globals::{BindError, GlobalList};
use sctk::reexports::client::protocol::wl_surface::WlSurface;
use sctk::reexports::client::{
delegate_dispatch, Connection, Dispatch, Proxy, QueueHandle,
};
use sctk::reexports::protocols::ext::background_effect::v1::client::ext_background_effect_manager_v1::ExtBackgroundEffectManagerV1;
use sctk::reexports::protocols::ext::background_effect::v1::client::ext_background_effect_surface_v1::ExtBackgroundEffectSurfaceV1;

use sctk::globals::GlobalData;

use crate::platform_impl::wayland::state::WinitState;

/// Wayland background effect manager.
#[derive(Debug, Clone)]
pub struct BackgroundEffectManager {
manager: ExtBackgroundEffectManagerV1,
}

impl BackgroundEffectManager {
pub fn new(
globals: &GlobalList,
queue_handle: &QueueHandle<WinitState>,
) -> Result<Self, BindError> {
let manager = globals.bind(queue_handle, 1..=1, GlobalData)?;
Ok(Self { manager })
}

pub fn background_effect(
&self,
surface: &WlSurface,
queue_handle: &QueueHandle<WinitState>,
) -> ExtBackgroundEffectSurfaceV1 {
self.manager
.get_background_effect(surface, queue_handle, ())
}
}

impl Dispatch<ExtBackgroundEffectManagerV1, GlobalData, WinitState>
for BackgroundEffectManager
{
fn event(
_: &mut WinitState,
_: &ExtBackgroundEffectManagerV1,
_: <ExtBackgroundEffectManagerV1 as Proxy>::Event,
_: &GlobalData,
_: &Connection,
_: &QueueHandle<WinitState>,
) {
unreachable!("no events defined for wayland_background_effect_manager");
}
}

impl Dispatch<ExtBackgroundEffectSurfaceV1, (), WinitState> for BackgroundEffectManager {
fn event(
_: &mut WinitState,
_: &ExtBackgroundEffectSurfaceV1,
_: <ExtBackgroundEffectSurfaceV1 as Proxy>::Event,
_: &(),
_: &Connection,
_: &QueueHandle<WinitState>,
) {
unreachable!("no events defined for wayland_background_effect_surface");
}
}

delegate_dispatch!(WinitState: [ExtBackgroundEffectManagerV1: GlobalData] => BackgroundEffectManager);
delegate_dispatch!(WinitState: [ExtBackgroundEffectSurfaceV1: ()] => BackgroundEffectManager);
70 changes: 0 additions & 70 deletions rio-window/src/platform_impl/linux/wayland/types/kwin_blur.rs

This file was deleted.

2 changes: 1 addition & 1 deletion rio-window/src/platform_impl/linux/wayland/types/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Wayland protocol implementation boilerplate.

pub mod cursor;
pub mod kwin_blur;
pub mod ext_background_effect;
pub mod wp_fractional_scaling;
pub mod wp_viewporter;
pub mod xdg_activation;
Loading
Loading