2017-08-20 22:02:39 +02:00
|
|
|
#ifndef _WLR_TYPES_CURSOR_H
|
|
|
|
#define _WLR_TYPES_CURSOR_H
|
|
|
|
#include <wayland-server.h>
|
|
|
|
#include <wlr/types/wlr_output.h>
|
|
|
|
#include <wlr/types/wlr_output_layout.h>
|
|
|
|
#include <wlr/types/wlr_input_device.h>
|
2017-08-29 18:08:49 +02:00
|
|
|
#include <wlr/types/wlr_box.h>
|
2017-08-20 22:02:39 +02:00
|
|
|
#include <wlr/xcursor.h>
|
|
|
|
|
|
|
|
struct wlr_cursor_state;
|
|
|
|
|
|
|
|
struct wlr_cursor {
|
2017-08-29 16:31:39 +02:00
|
|
|
struct wlr_cursor_state *state;
|
|
|
|
int x, y;
|
2017-08-20 22:02:39 +02:00
|
|
|
|
2017-08-29 16:31:39 +02:00
|
|
|
struct {
|
|
|
|
struct wl_signal motion;
|
2017-08-20 22:02:39 +02:00
|
|
|
struct wl_signal motion_absolute;
|
|
|
|
struct wl_signal button;
|
|
|
|
struct wl_signal axis;
|
2017-08-27 17:34:25 +02:00
|
|
|
|
|
|
|
struct wl_signal touch_up;
|
|
|
|
struct wl_signal touch_down;
|
|
|
|
struct wl_signal touch_motion;
|
|
|
|
struct wl_signal touch_cancel;
|
2017-08-28 14:42:39 +02:00
|
|
|
|
|
|
|
struct wl_signal tablet_tool_axis;
|
|
|
|
struct wl_signal tablet_tool_proximity;
|
|
|
|
struct wl_signal tablet_tool_tip;
|
|
|
|
struct wl_signal tablet_tool_button;
|
2017-08-29 16:31:39 +02:00
|
|
|
} events;
|
2017-08-20 22:02:39 +02:00
|
|
|
};
|
|
|
|
|
2017-08-29 16:42:23 +02:00
|
|
|
struct wlr_cursor *wlr_cursor_create();
|
2017-08-20 22:02:39 +02:00
|
|
|
|
|
|
|
void wlr_cursor_destroy(struct wlr_cursor *cur);
|
|
|
|
|
|
|
|
void wlr_cursor_set_xcursor(struct wlr_cursor *cur, struct wlr_xcursor *xcur);
|
|
|
|
|
2017-08-24 16:42:05 +02:00
|
|
|
/**
|
|
|
|
* Warp the cursor to the given x and y in layout coordinates. If x and y are
|
|
|
|
* out of the layout boundaries or constraints, no warp will happen.
|
|
|
|
*
|
2017-08-24 20:35:55 +02:00
|
|
|
* `dev` may be passed to respect device mapping constraints. If `dev` is NULL,
|
|
|
|
* device mapping constraints will be ignored.
|
|
|
|
*
|
2017-08-24 16:42:05 +02:00
|
|
|
* Returns true when the mouse warp was successful.
|
|
|
|
*/
|
2017-08-24 20:35:55 +02:00
|
|
|
bool wlr_cursor_warp(struct wlr_cursor *cur, struct wlr_input_device *dev,
|
|
|
|
double x, double y);
|
2017-08-20 22:02:39 +02:00
|
|
|
|
2017-08-27 23:35:12 +02:00
|
|
|
void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
|
|
|
|
struct wlr_input_device *dev, double x_mm, double y_mm);
|
|
|
|
|
2017-08-24 16:42:05 +02:00
|
|
|
/**
|
|
|
|
* Move the cursor in the direction of the given x and y coordinates.
|
2017-08-24 20:35:55 +02:00
|
|
|
*
|
|
|
|
* `dev` may be passed to respect device mapping constraints. If `dev` is NULL,
|
|
|
|
* device mapping constraints will be ignored.
|
2017-08-24 16:42:05 +02:00
|
|
|
*/
|
2017-08-24 20:35:55 +02:00
|
|
|
void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
|
|
|
|
double delta_x, double delta_y);
|
2017-08-20 22:02:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Attaches this input device to this cursor. The input device must be one of:
|
|
|
|
*
|
|
|
|
* - WLR_INPUT_DEVICE_POINTER
|
|
|
|
* - WLR_INPUT_DEVICE_TOUCH
|
|
|
|
* - WLR_INPUT_DEVICE_TABLET_TOOL
|
|
|
|
*/
|
|
|
|
void wlr_cursor_attach_input_device(struct wlr_cursor *cur,
|
2017-08-29 16:31:39 +02:00
|
|
|
struct wlr_input_device *dev);
|
2017-08-20 22:02:39 +02:00
|
|
|
|
|
|
|
void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
|
2017-08-29 16:31:39 +02:00
|
|
|
struct wlr_input_device *dev);
|
2017-08-20 22:02:39 +02:00
|
|
|
/**
|
|
|
|
* Uses the given layout to establish the boundaries and movement semantics of
|
|
|
|
* this cursor. Cursors without an output layout allow infinite movement in any
|
|
|
|
* direction and do not support absolute input events.
|
|
|
|
*/
|
|
|
|
void wlr_cursor_attach_output_layout(struct wlr_cursor *cur,
|
2017-08-29 16:31:39 +02:00
|
|
|
struct wlr_output_layout *l);
|
2017-08-20 22:02:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Attaches this cursor to the given output, which must be among the outputs in
|
|
|
|
* the current output_layout for this cursor. This call is invalid for a cursor
|
|
|
|
* without an associated output layout.
|
|
|
|
*/
|
2017-08-29 16:31:39 +02:00
|
|
|
void wlr_cursor_map_to_output(struct wlr_cursor *cur,
|
|
|
|
struct wlr_output *output);
|
2017-08-20 22:02:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps all input from a specific input device to a given output. The input
|
|
|
|
* device must be attached to this cursor and the output must be among the
|
|
|
|
* outputs in the attached output layout.
|
|
|
|
*/
|
|
|
|
void wlr_cursor_map_input_to_output(struct wlr_cursor *cur,
|
2017-08-29 16:31:39 +02:00
|
|
|
struct wlr_input_device *dev, struct wlr_output *output);
|
2017-08-20 22:02:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps this cursor to an arbitrary region on the associated wlr_output_layout.
|
|
|
|
*/
|
2017-08-29 18:08:49 +02:00
|
|
|
void wlr_cursor_map_to_region(struct wlr_cursor *cur, struct wlr_box *box);
|
2017-08-20 22:02:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps inputs from this input device to an arbitrary region on the associated
|
|
|
|
* wlr_output_layout.
|
|
|
|
*/
|
2017-08-25 19:26:13 +02:00
|
|
|
void wlr_cursor_map_input_to_region(struct wlr_cursor *cur,
|
2017-08-29 18:08:49 +02:00
|
|
|
struct wlr_input_device *dev, struct wlr_box *box);
|
2017-08-20 22:02:39 +02:00
|
|
|
|
|
|
|
#endif
|