Struct wayland_client::core::seat::Pointer [] [src]

pub struct Pointer<S: Surface> {
    // some fields omitted
}

A pointer interface.

This struct is a handle to the pointer interface of a given Seat.It allows you to change the pointer display and handle all pointer-related events.

The events are handled in a callback way. Each callback are provided a PointerId identifying the pointer. This is to allow specific situation where you need the pointer to not be borrowed (to change its surface for example) and have more than one cursor.

Methods

impl<S: Surface> Pointer<S>

fn get_id(&self) -> PointerId

Returns the unique PointerId associated to this pointer.

This struct can be tested for equality, and will be provided in event callbacks as a mean to identify the pointer associated with the events.

fn get_seat(&self) -> &Seat

Get access to the seat associated with this keyboard

fn set_cursor<NS: Surface>(self, surface: Option<NS>, hotspot: (i32, i32)) -> (Pointer<NS>, Option<S>)

Change the surface for drawing the cursor.

This cursor will be changed to this new surface every time it enters a window of application. You can control this per-surface by changing the cursor surface in the enter event, which is processed before the surface is transmitted to the wayland server.

This method consumes the Pointer object to create a new one and releasing the previous surface.

If surface is None, the cursor display won't be changed when it enters a surface of this application.

This will unhide the pointer if it was hidden.

Warning: doing this from inside one of this pointer's event callabacks will result in a deadlock. However, changing the buffer associated with the cursor's surface is not a problem.

fn set_cursor_hidden(&mut self, hidden: bool)

Hides or unhides the cursor image.

Warning: doing this from inside one of the event callabacks will result in a deadlock.

fn add_handled_surface(&mut self, surface: SurfaceId)

Adds a surface to the set of surfaces this pointer handler will change cursor and dispatch events.

Does nothing if the surface is already handled by this pointer.

Warning: doing this from inside one of this pointer's event callabacks will result in a deadlock.

fn remove_handled_surface(&mut self, surface: SurfaceId)

Adds a surface to the set of surfaces this pointer handler will change cursor and dispatch events.

Does nothing if the surface is already handled by this pointer.

Warning: doing this from inside one of this pointer's event callabacks will result in a deadlock.

fn release(self) -> Option<S>

fn get_surface<'c>(&'c self) -> Option<&'c S>

Provides a reference to the current cursor surface.

If no surface is set (and thus the default cursor is used), returns None.

fn set_enter_action<F>(&mut self, f: F) where F: Fn(PointerId, Serial, SurfaceId, f64, f64) + 'static + Send + Sync

Defines the action to be executed when the cursor enters a surface.

Arguments are:

  • Id of the pointer
  • Id of the surface
  • x and y, coordinates of the surface where the cursor entered.

Warning: doing this from inside one of this pointer's event callabacks will result in a deadlock.

fn set_leave_action<F>(&mut self, f: F) where F: Fn(PointerId, Serial, SurfaceId) + 'static + Send + Sync

Defines the action to be executed when the cursor leaves a surface.

This event is generated before the enter event is generated for the new surface the cursor goes to.

Arguments are:

  • Id of the pointer
  • Id of the surface

Warning: doing this from inside one of this pointer's event callabacks will result in a deadlock.

fn set_motion_action<F>(&mut self, f: F) where F: Fn(PointerId, u32, f64, f64) + 'static + Send + Sync

Defines the action to be executed when the cursor moves

Arguments are:

  • Id of the pointer
  • time of the event
  • x and y, new coordinates of the cursor relative to the current surface

Warning: doing this from inside one of this pointer's event callabacks will result in a deadlock.

fn set_button_action<F>(&mut self, f: F) where F: Fn(PointerId, Serial, u32, u32, ButtonState) + 'static + Send + Sync

Defines the action to be executed when a button is clicked or released

Arguments are:

  • Id of the pointer
  • time of the event
  • button of the event,
  • new state of the button

Warning: doing this from inside one of this pointer's event callabacks will result in a deadlock.

fn set_axis_action<F>(&mut self, f: F) where F: Fn(PointerId, u32, ScrollAxis, f64) + 'static + Send + Sync

Defines the action to be executed when a scrolling is done

Arguments are:

  • Id of the pointer
  • time of the event
  • the axis that is scrolled
  • the amplitude of the scrolling

Warning: doing this from inside one of this pointer's event callabacks will result in a deadlock.

Trait Implementations

impl<S: Surface + Send> Send for Pointer<S>

impl<S: Surface + Sync> Sync for Pointer<S>

impl<S: Surface> Drop for Pointer<S>

fn drop(&mut self)

impl<S: Surface> FFI for Pointer<S>

type Ptr = wl_pointer

fn ptr(&self) -> *const wl_pointer

unsafe fn ptr_mut(&self) -> *mut wl_pointer