feat(wayland): xdg activation

This commit is contained in:
Nova
2022-09-24 13:21:01 -04:00
parent 101fadd55d
commit 0e09aae9f8
3 changed files with 41 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ pub mod seat;
pub mod shaders;
pub mod state;
pub mod surface;
pub mod xdg_activation;
pub mod xdg_shell;
use self::{panel_item::PanelItem, state::WaylandState, surface::CORE_SURFACES};

View File

@@ -23,6 +23,7 @@ use smithay::{
xdg::{decoration::XdgDecorationState, XdgShellState},
},
shm::{ShmHandler, ShmState},
xdg_activation::XdgActivationState,
},
};
use std::sync::{Arc, Weak};
@@ -47,9 +48,10 @@ pub struct WaylandState {
pub display_handle: DisplayHandle,
pub compositor_state: CompositorState,
pub xdg_shell_state: XdgShellState,
pub xdg_activation_state: XdgActivationState,
pub xdg_decoration_state: XdgDecorationState,
pub kde_decoration_state: KdeDecorationState,
pub xdg_shell_state: XdgShellState,
pub shm_state: ShmState,
pub output_manager_state: OutputManagerState,
pub output: Output,
@@ -63,6 +65,7 @@ impl WaylandState {
display_handle: DisplayHandle,
) -> Arc<Mutex<Self>> {
let compositor_state = CompositorState::new::<Self, _>(&display_handle, log.clone());
let xdg_activation_state = XdgActivationState::new::<Self, _>(&display_handle, log.clone());
let xdg_shell_state = XdgShellState::new::<Self, _>(&display_handle, log.clone());
let xdg_decoration_state = XdgDecorationState::new::<Self, _>(&display_handle, log.clone());
let kde_decoration_state =
@@ -92,9 +95,10 @@ impl WaylandState {
display_handle,
compositor_state,
xdg_shell_state,
xdg_activation_state,
xdg_decoration_state,
kde_decoration_state,
xdg_shell_state,
shm_state,
output_manager_state,
output,

View File

@@ -0,0 +1,34 @@
use smithay::{
delegate_xdg_activation,
reexports::wayland_server::protocol::wl_surface::WlSurface,
wayland::xdg_activation::{XdgActivationHandler, XdgActivationToken, XdgActivationTokenData},
};
use super::state::WaylandState;
impl XdgActivationHandler for WaylandState {
fn activation_state(&mut self) -> &mut smithay::wayland::xdg_activation::XdgActivationState {
&mut self.xdg_activation_state
}
fn request_activation(
&mut self,
token: XdgActivationToken,
token_data: XdgActivationTokenData,
_surface: WlSurface,
) {
dbg!(token);
dbg!(token_data);
}
fn destroy_activation(
&mut self,
token: XdgActivationToken,
token_data: XdgActivationTokenData,
_surface: WlSurface,
) {
dbg!(token);
dbg!(token_data);
}
}
delegate_xdg_activation!(WaylandState);