deps: Update smithay
Integrate new multigpu allocator code for gpu->gpu copies using the vulkan allocator. Also integrates Xwayland clipboard sync.
This commit is contained in:
parent
32762fb983
commit
4a9dfcead0
11 changed files with 450 additions and 115 deletions
|
|
@ -3,13 +3,57 @@
|
|||
use crate::state::State;
|
||||
use smithay::{
|
||||
delegate_primary_selection,
|
||||
wayland::primary_selection::{PrimarySelectionHandler, PrimarySelectionState},
|
||||
wayland::primary_selection::{PrimarySelectionHandler, PrimarySelectionState, with_source_metadata}, xwayland::xwm::{XwmId, SelectionType}, reexports::wayland_protocols::wp::primary_selection::zv1::server::zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1,
|
||||
};
|
||||
|
||||
use std::os::unix::io::OwnedFd;
|
||||
|
||||
impl PrimarySelectionHandler for State {
|
||||
type SelectionUserData = XwmId;
|
||||
|
||||
fn primary_selection_state(&self) -> &PrimarySelectionState {
|
||||
&self.common.primary_selection_state
|
||||
}
|
||||
|
||||
fn new_selection(&mut self, source: Option<ZwpPrimarySelectionSourceV1>) {
|
||||
for xstate in self.common.xwayland_state.values_mut() {
|
||||
if let Some(xwm) = xstate.xwm.as_mut() {
|
||||
if let Some(source) = &source {
|
||||
if let Ok(Err(err)) = with_source_metadata(source, |metadata| {
|
||||
xwm.new_selection(SelectionType::Primary, Some(metadata.mime_types.clone()))
|
||||
}) {
|
||||
slog_scope::warn!("Failed to set Xwayland primary selection: {}", err);
|
||||
}
|
||||
} else if let Err(err) = xwm.new_selection(SelectionType::Primary, None) {
|
||||
slog_scope::warn!("Failed to clear Xwayland primary selection: {}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn send_selection(
|
||||
&mut self,
|
||||
mime_type: String,
|
||||
fd: OwnedFd,
|
||||
user_data: &Self::SelectionUserData,
|
||||
) {
|
||||
if let Some(xwm) = self
|
||||
.common
|
||||
.xwayland_state
|
||||
.values_mut()
|
||||
.flat_map(|xstate| xstate.xwm.as_mut())
|
||||
.find(|xwm| &xwm.id() == user_data)
|
||||
{
|
||||
if let Err(err) = xwm.send_selection(
|
||||
SelectionType::Primary,
|
||||
mime_type,
|
||||
fd,
|
||||
self.common.event_loop_handle.clone(),
|
||||
) {
|
||||
slog_scope::warn!("Failed to send primary selection (X11 -> Wayland): {}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delegate_primary_selection!(State);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue