feat: add selection and decoration protocols

This commit is contained in:
Samuel Onoja committed 2026-09-24 05:41:38 +01:00
1 parent 475d433ec4
commit a941b80aa9
3 files changed
+80 -2

No files matched your search

+42 -2
View File
@@ -3,8 +3,20 @@ mod xdg_shell;
use smithay::{
input::{Seat, SeatHandler, SeatState, pointer::CursorImageStatus},
reexports::wayland_server::protocol::wl_surface::WlSurface,
wayland::output::OutputHandler,
reexports::wayland_server::{Resource, protocol::wl_surface::WlSurface},
wayland::{
output::OutputHandler,
selection::{
SelectionHandler,
data_device::{
ClientDndGrabHandler, DataDeviceHandler, DataDeviceState, ServerDndGrabHandler,
set_data_device_focus,
},
primary_selection::{
PrimarySelectionHandler, PrimarySelectionState, set_primary_focus,
},
},
},
};
use crate::Ferese;
@@ -19,12 +31,40 @@ impl SeatHandler for Ferese {
}
fn cursor_image(&mut self, _seat: &Seat<Self>, _image: CursorImageStatus) {}
fn focus_changed(&mut self, seat: &Seat<Self>, focused: Option<&WlSurface>) {
let client = focused.and_then(|surface| self.display_handle.get_client(surface.id()).ok());
set_data_device_focus(&self.display_handle, seat, client.clone());
set_primary_focus(&self.display_handle, seat, client);
}
}
impl OutputHandler for Ferese {}
impl SelectionHandler for Ferese {
type SelectionUserData = ();
}
impl ClientDndGrabHandler for Ferese {}
impl ServerDndGrabHandler for Ferese {}
impl DataDeviceHandler for Ferese {
fn data_device_state(&self) -> &DataDeviceState {
&self.data_device_state
}
}
impl PrimarySelectionHandler for Ferese {
fn primary_selection_state(&self) -> &PrimarySelectionState {
&self.primary_selection_state
}
}
smithay::delegate_compositor!(Ferese);
smithay::delegate_data_device!(Ferese);
smithay::delegate_output!(Ferese);
smithay::delegate_primary_selection!(Ferese);
smithay::delegate_seat!(Ferese);
smithay::delegate_shm!(Ferese);
smithay::delegate_xdg_decoration!(Ferese);
smithay::delegate_xdg_shell!(Ferese);