use super::Layer;
use smithay_client_toolkit::{
    reexports::client::{
        Connection,
        protocol::wl_pointer::WlPointer,
        QueueHandle,
    },
    seat::pointer::{PointerEvent, PointerHandler},
    shell::WaylandSurface
};
use tracing::trace;

impl PointerHandler for Layer {
    fn pointer_frame(
        &mut self,
        _conn: &Connection,
        _qh: &QueueHandle<Self>,
        _pointer: &WlPointer,
        events: &[PointerEvent],
    ) {
        for event in events {
            if event.surface != *self.layer_surface.wl_surface() {
                continue;
            }

            self.pointer_position = Some(event.position);

            trace!("pointer event: {:?}", event);
        }
    }
}
