Input

Printing input file

struct weston_touch_device * weston_touch_create_touch_device(struct weston_touch * touch, const char * syspath, void * backend_data, const struct weston_touch_device_ops * ops)

Register a touchscreen input device

Parameters:
  • touch – The parent weston_touch that identifies the seat.
  • syspath – Unique device name.
  • backend_data – Backend private data if necessary.
  • ops – Calibration operations, or NULL for not able to run calibration.
Returns:

New touch device, or NULL on failure.

void weston_touch_device_destroy(struct weston_touch_device * device)

Destroy the touch device.

int weston_touch_device_can_calibrate()

Is it possible to run calibration on this touch device?

int weston_pointer_has_focus_resource()

Check if the pointer has focused resources.

Parameters:
  • pointer – The pointer to check for focused resources.
Returns:

Whether or not this pointer has focused resources

void weston_pointer_send_button(struct weston_pointer * pointer, const struct timespec * time, int button, enum wl_pointer_button_state state)

Send wl_pointer.button events to focused resources.

Parameters:
  • pointer – The pointer where the button events originates from.
  • time – The timestamp of the event
  • button – The button value of the event
  • value – The state enum value of the event

For every resource that is currently in focus, send a wl_pointer.button event with the passed parameters. The focused resources are the wl_pointer resources of the client which currently has the surface with pointer focus.

void weston_pointer_send_axis(struct weston_pointer * pointer, const struct timespec * time, struct weston_pointer_axis_event * event)

Send wl_pointer.axis events to focused resources.

Parameters:
  • pointer – The pointer where the axis events originates from.
  • time – The timestamp of the event
  • axis – The axis enum value of the event
  • value – The axis value of the event

For every resource that is currently in focus, send a wl_pointer.axis event with the passed parameters. The focused resources are the wl_pointer resources of the client which currently has the surface with pointer focus.

void weston_pointer_send_axis_source(struct weston_pointer * pointer, enum wl_pointer_axis_source source)

Send wl_pointer.axis_source events to focused resources.

Parameters:
  • pointer – The pointer where the axis_source events originates from.
  • source – The axis_source enum value of the event

For every resource that is currently in focus, send a wl_pointer.axis_source event with the passed parameter. The focused resources are the wl_pointer resources of the client which currently has the surface with pointer focus.

void pointer_send_frame(struct wl_resource * resource)

test document static function

Parameters:
  • resource – the struct wl_resource
void weston_pointer_send_frame(struct weston_pointer * pointer)

Send wl_pointer.frame events to focused resources.

Parameters:
  • pointer – The pointer where the frame events originates from.

For every resource that is currently in focus, send a wl_pointer.frame event. The focused resources are the wl_pointer resources of the client which currently has the surface with pointer focus.

int weston_touch_has_focus_resource()

Check if the touch has focused resources.

Parameters:
  • touch – The touch to check for focused resources.
Returns:

Whether or not this touch has focused resources

void weston_touch_send_down(struct weston_touch * touch, const struct timespec * time, int touch_id, int x, int y)

Send wl_touch.down events to focused resources.

Parameters:
  • touch – The touch where the down events originates from.
  • time – The timestamp of the event
  • touch_id – The touch_id value of the event
  • x – The x value of the event
  • y – The y value of the event

For every resource that is currently in focus, send a wl_touch.down event with the passed parameters. The focused resources are the wl_touch resources of the client which currently has the surface with touch focus.

void weston_touch_send_up(struct weston_touch * touch, const struct timespec * time, int touch_id)

Send wl_touch.up events to focused resources.

Parameters:
  • touch – The touch where the up events originates from.
  • time – The timestamp of the event
  • touch_id – The touch_id value of the event

For every resource that is currently in focus, send a wl_touch.up event with the passed parameters. The focused resources are the wl_touch resources of the client which currently has the surface with touch focus.

void weston_touch_send_motion(struct weston_touch * touch, const struct timespec * time, int touch_id, int x, int y)

Send wl_touch.motion events to focused resources.

Parameters:
  • touch – The touch where the motion events originates from.
  • time – The timestamp of the event
  • touch_id – The touch_id value of the event
  • x – The x value of the event
  • y – The y value of the event

For every resource that is currently in focus, send a wl_touch.motion event with the passed parameters. The focused resources are the wl_touch resources of the client which currently has the surface with touch focus.

void weston_touch_send_frame(struct weston_touch * touch)

Send wl_touch.frame events to focused resources.

Parameters:
  • touch – The touch where the frame events originates from.

For every resource that is currently in focus, send a wl_touch.frame event. The focused resources are the wl_touch resources of the client which currently has the surface with touch focus.

int weston_keyboard_has_focus_resource()

Check if the keyboard has focused resources.

Parameters:
  • keyboard – The keyboard to check for focused resources.
Returns:

Whether or not this keyboard has focused resources

void weston_keyboard_send_key(struct weston_keyboard * keyboard, const struct timespec * time, int key, enum wl_keyboard_key_state state)

Send wl_keyboard.key events to focused resources.

Parameters:
  • keyboard – The keyboard where the key events originates from.
  • time – The timestamp of the event
  • key – The key value of the event
  • state – The state enum value of the event

For every resource that is currently in focus, send a wl_keyboard.key event with the passed parameters. The focused resources are the wl_keyboard resources of the client which currently has the surface with keyboard focus.

void weston_keyboard_send_modifiers(struct weston_keyboard * keyboard, int serial, int mods_depressed, int mods_latched, int mods_locked, int group)
Send wl_keyboard.modifiers events to focused resources and pointer
focused resources.
Parameters:
  • keyboard – The keyboard where the modifiers events originates from.
  • serial – The serial of the event
  • mods_depressed – The mods_depressed value of the event
  • mods_latched – The mods_latched value of the event
  • mods_locked – The mods_locked value of the event
  • group – The group value of the event

For every resource that is currently in focus, send a wl_keyboard.modifiers event with the passed parameters. The focused resources are the wl_keyboard resources of the client which currently has the surface with keyboard focus. This also sends wl_keyboard.modifiers events to the wl_keyboard resources of the client having pointer focus (if different from the keyboard focus client).

void weston_pointer_clear_focus(struct weston_pointer * pointer)

Clear the pointer focus

Parameters:
  • pointer – the pointer to clear focus for.

This can be used to unset pointer focus and set the co-ordinates to the arbitrary values we use for the no focus case.

There’s no requirement to use this function. For example, passing the results of a weston_compositor_pick_view() directly to weston_pointer_set_focus() will do the right thing when no view is found.

void weston_keyboard_start_grab(struct weston_keyboard * keyboard, struct weston_keyboard_grab * grab)

Users of this function must manually manage the keyboard focus

void weston_pointer_handle_output_destroy(struct wl_listener * listener, void * data)

Verify if the pointer is in a valid position and move it if it isn’t.

void weston_compositor_update_touch_mode(struct weston_compositor * compositor)

Global touch mode update

If no seat has a touch down and the compositor is in a PREP touch mode, set the compositor to the goal touch mode.

Calls calibrator if touch mode changed.

void weston_compositor_set_touch_mode_normal(struct weston_compositor * compositor)

Start transition to normal touch event handling

The touch event mode changes when all touches on all touch devices have been lifted. If no touches are currently down, the transition is immediate.

sa weston_touch_mode

void weston_compositor_set_touch_mode_calib(struct weston_compositor * compositor)

Start transition to calibrator touch event handling

The touch event mode changes when all touches on all touch devices have been lifted. If no touches are currently down, the transition is immediate.

sa weston_touch_mode

void notify_touch_normalized(struct weston_touch_device * device, const struct timespec * time, int touch_id, double x, double y, const struct weston_point2d_device_normalized * norm, int touch_type)

Feed in touch down, motion, and up events, calibratable device.

It assumes always the correct cycle sequence until it gets here: touch_down → touch_update → … → touch_update → touch_end. The driver is responsible for sending along such order.

Parameters:
  • device – The physical device that generated the event.
  • time – The event timestamp.
  • touch_id – ID for the touch point of this event (multi-touch).
  • double_x – X coordinate in compositor global space.
  • double_y – Y coordinate in compositor global space.
  • norm – Normalized device X, Y coordinates in calibration space, or NULL.
  • touch_type – Either WL_TOUCH_DOWN, WL_TOUCH_UP, or WL_TOUCH_MOTION.

Coordinates double_x and double_y are used for normal operation.

Coordinates norm are only used for touch device calibration. If and only if the weston_touch_device does not support calibrating, norm must be NULL.

The calibration space is the normalized coordinate space [0.0, 1.0]×[0.0, 1.0] of the weston_touch_device. This is assumed to map to the similar normalized coordinate space of the associated weston_output.

struct weston_keyboard * weston_seat_get_keyboard(struct weston_seat * seat)

Get a seat’s keyboard pointer

Parameters:
  • seat – The seat to query
Returns:

The seat’s keyboard pointer, or NULL if no keyboard is present

The keyboard pointer for a seat isn’t freed when all keyboards are removed, so it should only be used when the seat’s keyboard_device_count is greater than zero. This function does that test and only returns a pointer when a keyboard is present.

struct weston_pointer * weston_seat_get_pointer(struct weston_seat * seat)

Get a seat’s pointer pointer

Parameters:
  • seat – The seat to query
Returns:

The seat’s pointer pointer, or NULL if no pointer device is present

The pointer pointer for a seat isn’t freed when all mice are removed, so it should only be used when the seat’s pointer_device_count is greater than zero. This function does that test and only returns a pointer when a pointing device is present.

struct weston_touch * weston_seat_get_touch(struct weston_seat * seat)

Get a seat’s touch pointer

Parameters:
  • seat – The seat to query
Returns:

The seat’s touch pointer, or NULL if no touch device is present

The touch pointer for a seat isn’t freed when all touch devices are removed, so it should only be used when the seat’s touch_device_count is greater than zero. This function does that test and only returns a pointer when a touch device is present.

void weston_seat_set_keyboard_focus(struct weston_seat * seat, struct weston_surface * surface)

Sets the keyboard focus to the given surface

Parameters:
  • seat – The seat to query