refactor(wayland): make code cleaner

This commit is contained in:
Nova
2022-11-12 11:53:11 -05:00
parent 8c36d73775
commit 83a5b36ddc
3 changed files with 6 additions and 6 deletions

View File

@@ -217,9 +217,9 @@ impl PanelItem {
let cursor = self.seat_data.cursor.lock(); let cursor = self.seat_data.cursor.lock();
if let Some(cursor) = cursor.as_ref().map(|cursor| 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(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(); data = serialize((mapped_data.size, cursor.hotspot)).unwrap();
} });
} }
} }

View File

@@ -209,9 +209,9 @@ impl Dispatch<WlPointer, SeatData, WaylandState> for SeatDelegate {
hotspot_x, hotspot_x,
hotspot_y, hotspot_y,
} => { } => {
if !*seat_data.pointer_active.lock() { // if !seat_data.pointer_active() {
return; // return;
} // }
*seat_data.0.cursor_changed.lock() = true; *seat_data.0.cursor_changed.lock() = true;
if let Some(surface) = surface.as_ref() { if let Some(surface) = surface.as_ref() {
compositor::with_states(surface, |data| { compositor::with_states(surface, |data| {

View File

@@ -97,7 +97,7 @@ pub struct CoreSurface {
pub state: Weak<Mutex<WaylandState>>, pub state: Weak<Mutex<WaylandState>>,
pub dh: DisplayHandle, pub dh: DisplayHandle,
pub weak_surface: wayland_server::Weak<WlSurface>, pub weak_surface: wayland_server::Weak<WlSurface>,
pub mapped_data: Mutex<Option<CoreSurfaceData>>, mapped_data: Mutex<Option<CoreSurfaceData>>,
pub pending_material_applications: Mutex<Vec<(Arc<Model>, u32)>>, pub pending_material_applications: Mutex<Vec<(Arc<Model>, u32)>>,
} }