From 83a5b36ddc8009907d9ff4e8488d55373036c1e1 Mon Sep 17 00:00:00 2001 From: Nova Date: Sat, 12 Nov 2022 11:53:11 -0500 Subject: [PATCH] refactor(wayland): make code cleaner --- src/wayland/panel_item.rs | 4 ++-- src/wayland/seat.rs | 6 +++--- src/wayland/surface.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/wayland/panel_item.rs b/src/wayland/panel_item.rs index fc38ce1..d08069a 100644 --- a/src/wayland/panel_item.rs +++ b/src/wayland/panel_item.rs @@ -217,9 +217,9 @@ impl PanelItem { let cursor = self.seat_data.cursor.lock(); if let Some(cursor) = cursor.as_ref().map(|cursor| cursor.lock()) { if let Some(core_surface) = cursor.core_surface.upgrade() { - if let Some(mapped_data) = &*core_surface.mapped_data.lock() { + core_surface.with_data(|mapped_data| { data = serialize((mapped_data.size, cursor.hotspot)).unwrap(); - } + }); } } diff --git a/src/wayland/seat.rs b/src/wayland/seat.rs index 740c7d7..da698ec 100644 --- a/src/wayland/seat.rs +++ b/src/wayland/seat.rs @@ -209,9 +209,9 @@ impl Dispatch for SeatDelegate { hotspot_x, hotspot_y, } => { - if !*seat_data.pointer_active.lock() { - return; - } + // if !seat_data.pointer_active() { + // return; + // } *seat_data.0.cursor_changed.lock() = true; if let Some(surface) = surface.as_ref() { compositor::with_states(surface, |data| { diff --git a/src/wayland/surface.rs b/src/wayland/surface.rs index a40e580..aa060df 100644 --- a/src/wayland/surface.rs +++ b/src/wayland/surface.rs @@ -97,7 +97,7 @@ pub struct CoreSurface { pub state: Weak>, pub dh: DisplayHandle, pub weak_surface: wayland_server::Weak, - pub mapped_data: Mutex>, + mapped_data: Mutex>, pub pending_material_applications: Mutex, u32)>>, }