Add xdg-foreign

This commit is contained in:
Ivan Molodetskikh
2024-03-08 17:08:58 +04:00
parent e45dbb8ef6
commit 03fe864d07
2 changed files with 15 additions and 2 deletions
+11 -2
View File
@@ -22,7 +22,10 @@ use smithay::wayland::shell::xdg::{
PopupSurface, PositionerState, ToplevelSurface, XdgPopupSurfaceData, XdgShellHandler, PopupSurface, PositionerState, ToplevelSurface, XdgPopupSurfaceData, XdgShellHandler,
XdgShellState, XdgToplevelSurfaceData, XdgToplevelSurfaceRoleAttributes, XdgShellState, XdgToplevelSurfaceData, XdgToplevelSurfaceRoleAttributes,
}; };
use smithay::{delegate_kde_decoration, delegate_xdg_decoration, delegate_xdg_shell}; use smithay::wayland::xdg_foreign::{XdgForeignHandler, XdgForeignState};
use smithay::{
delegate_kde_decoration, delegate_xdg_decoration, delegate_xdg_foreign, delegate_xdg_shell,
};
use crate::layout::workspace::ColumnWidth; use crate::layout::workspace::ColumnWidth;
use crate::niri::{PopupGrabState, State}; use crate::niri::{PopupGrabState, State};
@@ -526,9 +529,15 @@ impl KdeDecorationHandler for State {
&self.niri.kde_decoration_state &self.niri.kde_decoration_state
} }
} }
delegate_kde_decoration!(State); delegate_kde_decoration!(State);
impl XdgForeignHandler for State {
fn xdg_foreign_state(&mut self) -> &mut XdgForeignState {
&mut self.niri.xdg_foreign_state
}
}
delegate_xdg_foreign!(State);
fn initial_configure_sent(toplevel: &ToplevelSurface) -> bool { fn initial_configure_sent(toplevel: &ToplevelSurface) -> bool {
with_states(toplevel.wl_surface(), |states| { with_states(toplevel.wl_surface(), |states| {
states states
+4
View File
@@ -86,6 +86,7 @@ use smithay::wayland::tablet_manager::{TabletManagerState, TabletSeatTrait};
use smithay::wayland::text_input::TextInputManagerState; use smithay::wayland::text_input::TextInputManagerState;
use smithay::wayland::viewporter::ViewporterState; use smithay::wayland::viewporter::ViewporterState;
use smithay::wayland::virtual_keyboard::VirtualKeyboardManagerState; use smithay::wayland::virtual_keyboard::VirtualKeyboardManagerState;
use smithay::wayland::xdg_foreign::XdgForeignState;
use crate::backend::tty::SurfaceDmabufFeedback; use crate::backend::tty::SurfaceDmabufFeedback;
use crate::backend::{Backend, RenderResult, Tty, Winit}; use crate::backend::{Backend, RenderResult, Tty, Winit};
@@ -160,6 +161,7 @@ pub struct Niri {
pub foreign_toplevel_state: ForeignToplevelManagerState, pub foreign_toplevel_state: ForeignToplevelManagerState,
pub screencopy_state: ScreencopyManagerState, pub screencopy_state: ScreencopyManagerState,
pub viewporter_state: ViewporterState, pub viewporter_state: ViewporterState,
pub xdg_foreign_state: XdgForeignState,
pub shm_state: ShmState, pub shm_state: ShmState,
pub output_manager_state: OutputManagerState, pub output_manager_state: OutputManagerState,
pub dmabuf_state: DmabufState, pub dmabuf_state: DmabufState,
@@ -920,6 +922,7 @@ impl Niri {
!client.get_data::<ClientState>().unwrap().restricted !client.get_data::<ClientState>().unwrap().restricted
}); });
let viewporter_state = ViewporterState::new::<State>(&display_handle); let viewporter_state = ViewporterState::new::<State>(&display_handle);
let xdg_foreign_state = XdgForeignState::new::<State>(&display_handle);
let mut seat: Seat<State> = seat_state.new_wl_seat(&display_handle, backend.seat_name()); let mut seat: Seat<State> = seat_state.new_wl_seat(&display_handle, backend.seat_name());
seat.add_keyboard( seat.add_keyboard(
@@ -1042,6 +1045,7 @@ impl Niri {
foreign_toplevel_state, foreign_toplevel_state,
screencopy_state, screencopy_state,
viewporter_state, viewporter_state,
xdg_foreign_state,
text_input_state, text_input_state,
input_method_state, input_method_state,
virtual_keyboard_state, virtual_keyboard_state,