feat(wayland): kde decoration support
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
use super::state::WaylandState;
|
||||
use smithay::{
|
||||
delegate_xdg_decoration,
|
||||
delegate_kde_decoration, delegate_xdg_decoration,
|
||||
reexports::wayland_protocols::xdg::decoration::zv1::server::zxdg_toplevel_decoration_v1::Mode,
|
||||
wayland::shell::xdg::decoration::XdgDecorationHandler,
|
||||
wayland::shell::{
|
||||
self, kde::decoration::KdeDecorationHandler, xdg::decoration::XdgDecorationHandler,
|
||||
},
|
||||
};
|
||||
|
||||
impl XdgDecorationHandler for WaylandState {
|
||||
@@ -23,3 +25,10 @@ impl XdgDecorationHandler for WaylandState {
|
||||
fn unset_mode(&mut self, _toplevel: smithay::wayland::shell::xdg::ToplevelSurface) {}
|
||||
}
|
||||
delegate_xdg_decoration!(WaylandState);
|
||||
|
||||
impl KdeDecorationHandler for WaylandState {
|
||||
fn kde_decoration_state(&self) -> &shell::kde::decoration::KdeDecorationState {
|
||||
&self.kde_decoration_state
|
||||
}
|
||||
}
|
||||
delegate_kde_decoration!(WaylandState);
|
||||
@@ -1,15 +1,15 @@
|
||||
pub mod compositor;
|
||||
mod data_device;
|
||||
pub mod decoration;
|
||||
pub mod panel_item;
|
||||
pub mod seat;
|
||||
pub mod shaders;
|
||||
pub mod state;
|
||||
pub mod surface;
|
||||
pub mod xdg_decoration;
|
||||
pub mod xdg_shell;
|
||||
|
||||
use self::{panel_item::PanelItem, state::WaylandState, surface::CORE_SURFACES};
|
||||
use crate::wayland::{seat::SeatData, state::ClientState};
|
||||
use crate::wayland::state::ClientState;
|
||||
use anyhow::{ensure, Result};
|
||||
use once_cell::sync::OnceCell;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
@@ -5,17 +5,23 @@ use slog::Logger;
|
||||
use smithay::{
|
||||
delegate_output, delegate_shm,
|
||||
output::{Output, Scale, Subpixel},
|
||||
reexports::wayland_server::{
|
||||
backend::{ClientData, ClientId, DisconnectReason},
|
||||
protocol::wl_data_device_manager::WlDataDeviceManager,
|
||||
Display, DisplayHandle,
|
||||
reexports::{
|
||||
wayland_protocols_misc::server_decoration::server::org_kde_kwin_server_decoration_manager::Mode,
|
||||
wayland_server::{
|
||||
backend::{ClientData, ClientId, DisconnectReason},
|
||||
protocol::wl_data_device_manager::WlDataDeviceManager,
|
||||
Display, DisplayHandle,
|
||||
},
|
||||
},
|
||||
utils::Size,
|
||||
wayland::{
|
||||
buffer::BufferHandler,
|
||||
compositor::CompositorState,
|
||||
output::OutputManagerState,
|
||||
shell::xdg::{decoration::XdgDecorationState, XdgShellState},
|
||||
shell::{
|
||||
kde::decoration::KdeDecorationState,
|
||||
xdg::{decoration::XdgDecorationState, XdgShellState},
|
||||
},
|
||||
shm::{ShmHandler, ShmState},
|
||||
},
|
||||
};
|
||||
@@ -42,6 +48,7 @@ pub struct WaylandState {
|
||||
pub compositor_state: CompositorState,
|
||||
pub xdg_shell_state: XdgShellState,
|
||||
pub xdg_decoration_state: XdgDecorationState,
|
||||
pub kde_decoration_state: KdeDecorationState,
|
||||
pub shm_state: ShmState,
|
||||
pub output_manager_state: OutputManagerState,
|
||||
pub output: Output,
|
||||
@@ -57,6 +64,8 @@ impl WaylandState {
|
||||
let compositor_state = CompositorState::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 =
|
||||
KdeDecorationState::new::<Self, _>(&display_handle, Mode::Server, log.clone());
|
||||
let shm_state = ShmState::new::<Self, _>(&display_handle, vec![], log.clone());
|
||||
let output_manager_state = OutputManagerState::new_with_xdg_output::<Self>(&display_handle);
|
||||
let output = Output::new(
|
||||
@@ -82,6 +91,7 @@ impl WaylandState {
|
||||
compositor_state,
|
||||
xdg_shell_state,
|
||||
xdg_decoration_state,
|
||||
kde_decoration_state,
|
||||
shm_state,
|
||||
output_manager_state,
|
||||
output,
|
||||
|
||||
@@ -23,7 +23,7 @@ impl XdgShellHandler for WaylandState {
|
||||
self.output
|
||||
.enter(&self.display_handle, surface.wl_surface());
|
||||
surface.with_pending_state(|state| {
|
||||
state.states.set(State::Fullscreen);
|
||||
state.states.set(State::Maximized);
|
||||
state.states.set(State::Activated);
|
||||
state.decoration_mode = Some(Mode::ServerSide);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user