forked from rust-windowing/winit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow clients to request blur behind their window, implemented on Wayland for now.
- Loading branch information
Showing
17 changed files
with
167 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
//! Handling of KDE-compatible blur. | ||
use sctk::reexports::client::globals::{BindError, GlobalList}; | ||
use sctk::reexports::client::protocol::wl_surface::WlSurface; | ||
use sctk::reexports::client::Dispatch; | ||
use sctk::reexports::client::{delegate_dispatch, Connection, Proxy, QueueHandle}; | ||
use wayland_protocols_plasma::blur::client::{ | ||
org_kde_kwin_blur::OrgKdeKwinBlur, org_kde_kwin_blur_manager::OrgKdeKwinBlurManager, | ||
}; | ||
|
||
use sctk::globals::GlobalData; | ||
|
||
use crate::platform_impl::wayland::state::WinitState; | ||
|
||
/// KWin blur manager. | ||
#[derive(Debug, Clone)] | ||
pub struct KWinBlurManager { | ||
manager: OrgKdeKwinBlurManager, | ||
} | ||
|
||
impl KWinBlurManager { | ||
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 blur( | ||
&self, | ||
surface: &WlSurface, | ||
queue_handle: &QueueHandle<WinitState>, | ||
) -> OrgKdeKwinBlur { | ||
self.manager.create(surface, queue_handle, ()) | ||
} | ||
|
||
pub fn unset(&self, surface: &WlSurface) { | ||
self.manager.unset(surface) | ||
} | ||
} | ||
|
||
impl Dispatch<OrgKdeKwinBlurManager, GlobalData, WinitState> for KWinBlurManager { | ||
fn event( | ||
_: &mut WinitState, | ||
_: &OrgKdeKwinBlurManager, | ||
_: <OrgKdeKwinBlurManager as Proxy>::Event, | ||
_: &GlobalData, | ||
_: &Connection, | ||
_: &QueueHandle<WinitState>, | ||
) { | ||
unreachable!("no events defined for org_kde_kwin_blur_manager"); | ||
} | ||
} | ||
|
||
impl Dispatch<OrgKdeKwinBlur, (), WinitState> for KWinBlurManager { | ||
fn event( | ||
_: &mut WinitState, | ||
_: &OrgKdeKwinBlur, | ||
_: <OrgKdeKwinBlur as Proxy>::Event, | ||
_: &(), | ||
_: &Connection, | ||
_: &QueueHandle<WinitState>, | ||
) { | ||
unreachable!("no events defined for org_kde_kwin_blur"); | ||
} | ||
} | ||
|
||
delegate_dispatch!(WinitState: [OrgKdeKwinBlurManager: GlobalData] => KWinBlurManager); | ||
delegate_dispatch!(WinitState: [OrgKdeKwinBlur: ()] => KWinBlurManager); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
//! Wayland protocol implementation boilerplate. | ||
pub mod kwin_blur; | ||
pub mod wp_fractional_scaling; | ||
pub mod wp_viewporter; | ||
pub mod xdg_activation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters