Update smithay, with cursor/selection changes

We'll probably want to add support for `cursor-shape-v1`. Not sure about
`wlr-data-control-unstable-v1`. But this just updates to work with the
latest smithay commit for new.
This commit is contained in:
Ian Douglas Scott 2023-10-10 13:28:30 -07:00
parent c32b8d3cb7
commit 111eb4edf4
12 changed files with 109 additions and 186 deletions

View file

@ -0,0 +1,58 @@
// SPDX-License-Identifier: GPL-3.0-only
use crate::state::State;
use smithay::{
input::Seat,
wayland::selection::{SelectionHandler, SelectionSource, SelectionTarget},
xwayland::xwm::XwmId,
};
use std::os::unix::io::OwnedFd;
use tracing::warn;
impl SelectionHandler for State {
type SelectionUserData = XwmId;
fn new_selection(
&mut self,
target: SelectionTarget,
source: Option<SelectionSource>,
_seat: Seat<State>,
) {
if let Some(xwm) = self
.common
.xwayland_state
.as_mut()
.and_then(|xstate| xstate.xwm.as_mut())
{
if let Some(source) = &source {
if let Err(err) = xwm.new_selection(target, Some(source.mime_types())) {
warn!(?err, "Failed to set Xwayland clipboard selection.");
}
} else if let Err(err) = xwm.new_selection(target, None) {
warn!(?err, "Failed to clear Xwayland selection.");
}
}
}
fn send_selection(
&mut self,
target: SelectionTarget,
mime_type: String,
fd: OwnedFd,
_seat: Seat<State>,
_user_data: &Self::SelectionUserData,
) {
if let Some(xwm) = self
.common
.xwayland_state
.as_mut()
.and_then(|xstate| xstate.xwm.as_mut())
{
if let Err(err) =
xwm.send_selection(target, mime_type, fd, self.common.event_loop_handle.clone())
{
warn!(?err, "Failed to send selection (X11 -> Wayland).");
}
}
}
}