refactor(wayland): separate backend from panel item

This commit is contained in:
Nova
2023-05-11 06:05:38 -04:00
parent e879b724ec
commit 1cb8e1b7a4
3 changed files with 252 additions and 172 deletions

View File

@@ -1,6 +1,8 @@
use super::{
panel_item::PanelItem, state::WaylandState, surface::CoreSurface, GLOBAL_DESTROY_QUEUE,
SERIAL_COUNTER,
panel_item::{Backend, PanelItem},
state::WaylandState,
surface::CoreSurface,
GLOBAL_DESTROY_QUEUE, SERIAL_COUNTER,
};
use crate::core::task;
use color_eyre::eyre::Result;
@@ -482,7 +484,9 @@ impl Dispatch<WlPointer, Arc<SeatData>, WaylandState> for WaylandState {
let surfaces = seat_data.surfaces.lock();
let Some(surface_info) = surfaces.get(&focus) else {return};
let Some(panel_item) = surface_info.panel_item.upgrade() else {return};
panel_item.set_cursor(surface.as_ref(), hotspot_x, hotspot_y);
if let Backend::Wayland(w) = &panel_item.backend {
w.set_cursor(&panel_item, surface.as_ref(), hotspot_x, hotspot_y);
}
}
wl_pointer::Request::Release => (),
_ => unreachable!(),