Trait smithay::wayland::seat::PointerGrab[][src]

pub trait PointerGrab {
    fn motion(
        &mut self,
        handle: &mut PointerInnerHandle<'_>,
        location: Point<f64, Logical>,
        focus: Option<(WlSurface, Point<i32, Logical>)>,
        serial: Serial,
        time: u32
    );
fn button(
        &mut self,
        handle: &mut PointerInnerHandle<'_>,
        button: u32,
        state: ButtonState,
        serial: Serial,
        time: u32
    );
fn axis(&mut self, handle: &mut PointerInnerHandle<'_>, details: AxisFrame);
fn start_data(&self) -> &GrabStartData; }
Expand description

A trait to implement a pointer grab

In some context, it is necessary to temporarily change the behavior of the pointer. This is typically known as a pointer grab. A typical example would be, during a drag’n’drop operation, the underlying surfaces will no longer receive classic pointer event, but rather special events.

This trait is the interface to intercept regular pointer events and change them as needed, its interface mimics the PointerHandle interface.

If your logic decides that the grab should end, both PointerInnerHandle and PointerHandle have a method to change it.

When your grab ends (either as you requested it or if it was forcefully cancelled by the server), the struct implementing this trait will be dropped. As such you should put clean-up logic in the destructor, rather than trying to guess when the grab will end.

Required methods

A motion was reported

A button press was reported

An axis scroll was reported

The data about the event that started the grab.

Implementors