Merge pull request #738 from PolyMeilex/make-use-of-client-clone

Make use of `Client::clone` & Remove outdated TODOs
This commit is contained in:
Victoria Brekenfeld 2022-09-05 13:34:51 +02:00 committed by GitHub
commit d8f37af834
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 22 deletions

View file

@ -168,9 +168,8 @@ impl<BackendData> SeatHandler for AnvilState<BackendData> {
let dh = &self.display_handle;
let focus = surface.and_then(|s| dh.get_client(s.id()).ok());
let focus2 = surface.and_then(|s| dh.get_client(s.id()).ok());
set_data_device_focus(dh, seat, focus);
set_primary_focus(dh, seat, focus2);
set_data_device_focus(dh, seat, focus.clone());
set_primary_focus(dh, seat, focus);
}
fn cursor_image(&mut self, _seat: &Seat<Self>, image: CursorImageStatus) {
*self.cursor_status.lock().unwrap() = image;

View file

@ -1,6 +1,3 @@
// TODO: Remove once desktop is back
#![allow(unused)]
macro_rules! id_gen {
($func_name:ident, $id_name:ident, $ids_name:ident) => {
static $id_name: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);

View file

@ -58,7 +58,6 @@ where
icon,
serial,
} => {
/* TODO: handle the icon */
let serial = Serial::from(serial);
if let Some(pointer) = seat.get_pointer() {
if pointer.has_grab(serial) {

View file

@ -40,8 +40,6 @@ impl TouchHandle {
self.inner.lock().unwrap().known_handles.push(touch);
}
// TODO: Any ideas how to group some of those args?
#[allow(clippy::too_many_arguments)]
/// Notify clients about new touch points.
pub fn down(
&mut self,
@ -101,8 +99,6 @@ struct TouchInternal {
}
impl TouchInternal {
// TODO: Any ideas how to group some of those args?
#[allow(clippy::too_many_arguments)]
fn down(
&mut self,
serial: Serial,

View file

@ -158,8 +158,8 @@ impl Drop for XWayland {
#[derive(Debug)]
struct XWaylandInstance {
display_lock: X11Lock,
wayland_client: Option<Client>,
wayland_client_fd: Option<RawFd>,
wayland_client: Client,
wayland_client_fd: RawFd,
wm_fd: Option<UnixStream>,
child_stdout: ChildStdout,
}
@ -236,8 +236,8 @@ fn launch<D>(
let client = dh.insert_client(wl_me, Arc::new(XWaylandClientData { inner: inner.clone() }))?;
guard.instance = Some(XWaylandInstance {
display_lock: lock,
wayland_client: Some(client),
wayland_client_fd: Some(client_fd),
wayland_client: client,
wayland_client_fd: client_fd,
wm_fd: Some(x_wm_me),
child_stdout,
});
@ -306,11 +306,9 @@ impl Inner {
// don't do anything if not running
if let Some(instance) = self.instance.take() {
info!(self.log, "Shutting down XWayland.");
if let Some(client) = instance.wayland_client {
self.dh
.backend_handle()
.kill_client(client.id(), DisconnectReason::ConnectionClosed);
}
self.dh
.backend_handle()
.kill_client(instance.wayland_client.id(), DisconnectReason::ConnectionClosed);
// send error occurs if the user dropped the channel... We cannot do much except ignore.
let _ = self.sender.send(XWaylandEvent::Exited);
@ -360,8 +358,8 @@ fn xwayland_ready(inner: &Arc<Mutex<Inner>>) {
// send error occurs if the user dropped the channel... We cannot do much except ignore.
let _ = guard.sender.send(XWaylandEvent::Ready {
connection: instance.wm_fd.take().unwrap(), // This is a bug if None
client: instance.wayland_client.take().unwrap(), // TODO: .clone().unwrap(),
client_fd: instance.wayland_client_fd.take().unwrap(),
client: instance.wayland_client.clone(),
client_fd: instance.wayland_client_fd,
display: instance.display_lock.display(),
});
} else {