diff options
| author | Kirill Chibisov <contact@kchibisov.com> | 2023-09-27 16:08:11 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-09-27 18:38:38 +0400 |
| commit | 804e064826635b5cd2a0a468e1264c2ac0a1d4c2 (patch) | |
| tree | b3873f45a036216351c92e30805dc0f653eee957 /src | |
| parent | cf123ddcd029e3508e4b3efdddac62f605bd2610 (diff) | |
| download | niri-804e064826635b5cd2a0a468e1264c2ac0a1d4c2.tar.gz niri-804e064826635b5cd2a0a468e1264c2ac0a1d4c2.tar.bz2 niri-804e064826635b5cd2a0a468e1264c2ac0a1d4c2.zip | |
shell: add support for kde server decorations
This should provide server side decorations for the gtk3 applications,
like firefox.
Diffstat (limited to 'src')
| -rw-r--r-- | src/backend/tty.rs | 2 | ||||
| -rw-r--r-- | src/handlers/xdg_shell.rs | 11 | ||||
| -rw-r--r-- | src/niri.rs | 13 |
3 files changed, 24 insertions, 2 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs index 2c56dd74..c7ebab4b 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -3,7 +3,7 @@ use std::collections::{HashMap, HashSet}; use std::os::fd::FromRawFd; use std::path::{Path, PathBuf}; use std::rc::Rc; -use std::sync::{Mutex, Arc}; +use std::sync::{Arc, Mutex}; use std::time::Duration; use anyhow::{anyhow, Context}; diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs index 387e4bb3..80a50cd0 100644 --- a/src/handlers/xdg_shell.rs +++ b/src/handlers/xdg_shell.rs @@ -7,12 +7,13 @@ use smithay::reexports::wayland_server::protocol::wl_seat::WlSeat; use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface; use smithay::utils::Serial; use smithay::wayland::compositor::with_states; +use smithay::wayland::shell::kde::decoration::{KdeDecorationHandler, KdeDecorationState}; use smithay::wayland::shell::xdg::decoration::XdgDecorationHandler; use smithay::wayland::shell::xdg::{ PopupSurface, PositionerState, ToplevelSurface, XdgPopupSurfaceData, XdgShellHandler, XdgShellState, XdgToplevelSurfaceData, }; -use smithay::{delegate_xdg_decoration, delegate_xdg_shell}; +use smithay::{delegate_kde_decoration, delegate_xdg_decoration, delegate_xdg_shell}; use crate::layout::configure_new_window; use crate::niri::State; @@ -201,6 +202,14 @@ impl XdgDecorationHandler for State { } delegate_xdg_decoration!(State); +impl KdeDecorationHandler for State { + fn kde_decoration_state(&self) -> &KdeDecorationState { + &self.niri.kde_decoration_state + } +} + +delegate_kde_decoration!(State); + pub fn send_initial_configure_if_needed(window: &Window) { let initial_configure_sent = with_states(window.toplevel().wl_surface(), |states| { states diff --git a/src/niri.rs b/src/niri.rs index 1cbebe6c..ab823465 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -8,6 +8,7 @@ use std::sync::{Arc, Mutex}; use std::time::Duration; use std::{env, thread}; +use _server_decoration::server::org_kde_kwin_server_decoration_manager::Mode as KdeDecorationsMode; use anyhow::Context; use sd_notify::NotifyState; use smithay::backend::allocator::dmabuf::Dmabuf; @@ -37,6 +38,7 @@ use smithay::reexports::calloop::timer::{TimeoutAction, Timer}; use smithay::reexports::calloop::{self, Idle, Interest, LoopHandle, LoopSignal, Mode, PostAction}; use smithay::reexports::nix::libc::CLOCK_MONOTONIC; use smithay::reexports::wayland_protocols::xdg::shell::server::xdg_toplevel::WmCapabilities; +use smithay::reexports::wayland_protocols_misc::server_decoration as _server_decoration; use smithay::reexports::wayland_server::backend::{ ClientData, ClientId, DisconnectReason, GlobalId, }; @@ -52,6 +54,7 @@ use smithay::wayland::output::OutputManagerState; use smithay::wayland::pointer_gestures::PointerGesturesState; use smithay::wayland::presentation::PresentationState; use smithay::wayland::primary_selection::PrimarySelectionState; +use smithay::wayland::shell::kde::decoration::KdeDecorationState; use smithay::wayland::shell::wlr_layer::{Layer, WlrLayerShellState}; use smithay::wayland::shell::xdg::decoration::XdgDecorationState; use smithay::wayland::shell::xdg::XdgShellState; @@ -95,6 +98,7 @@ pub struct Niri { pub compositor_state: CompositorState, pub xdg_shell_state: XdgShellState, pub xdg_decoration_state: XdgDecorationState, + pub kde_decoration_state: KdeDecorationState, pub layer_shell_state: WlrLayerShellState, pub shm_state: ShmState, pub output_manager_state: OutputManagerState, @@ -235,6 +239,14 @@ impl Niri { [WmCapabilities::Fullscreen], ); let xdg_decoration_state = XdgDecorationState::new::<State>(&display_handle); + let kde_decoration_state = KdeDecorationState::new::<State>( + &display_handle, + if config_.prefer_no_csd { + KdeDecorationsMode::Server + } else { + KdeDecorationsMode::Client + }, + ); let layer_shell_state = WlrLayerShellState::new::<State>(&display_handle); let shm_state = ShmState::new::<State>(&display_handle, vec![]); let output_manager_state = @@ -587,6 +599,7 @@ impl Niri { compositor_state, xdg_shell_state, xdg_decoration_state, + kde_decoration_state, layer_shell_state, shm_state, output_manager_state, |
