diff options
author | emersion <contact@emersion.fr> | 2018-04-27 17:26:33 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-04-28 09:24:38 +0100 |
commit | 6e7c0b57f6b601a8c6883f71d00719dbd208c79d (patch) | |
tree | 1fed977b6aaf73dba2b487662d63c22711292409 /include/wlr | |
parent | 4d7877420d49f4ab1999211e96f5d3ffdede0551 (diff) |
cursor: use NAN for unspecified axes, refactor absolute warping code
Diffstat (limited to 'include/wlr')
-rw-r--r-- | include/wlr/types/wlr_cursor.h | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h index b764e6d2..1a9e0d38 100644 --- a/include/wlr/types/wlr_cursor.h +++ b/include/wlr/types/wlr_cursor.h @@ -69,16 +69,34 @@ void wlr_cursor_destroy(struct wlr_cursor *cur); * `dev` may be passed to respect device mapping constraints. If `dev` is NULL, * device mapping constraints will be ignored. * - * Returns true when the mouse warp was successful. + * Returns true when the cursor warp was successful. */ bool wlr_cursor_warp(struct wlr_cursor *cur, struct wlr_input_device *dev, - double x, double y); + double lx, double ly); +/** + * Convert absolute 0..1 coordinates to layout coordinates. + * + * `dev` may be passed to respect device mapping constraints. If `dev` is NULL, + * device mapping constraints will be ignored. + */ +void wlr_cursor_absolute_to_layout_coords(struct wlr_cursor *cur, + struct wlr_input_device *dev, double x, double y, double *lx, double *ly); + +/** + * Warp the cursor to the given x and y in absolute 0..1 coordinates. If the + * given point is out of the layout boundaries or constraints, the closest point + * will be used. If one coordinate is NAN, it will be ignored. + * + * `dev` may be passed to respect device mapping constraints. If `dev` is NULL, + * device mapping constraints will be ignored. + */ void wlr_cursor_warp_absolute(struct wlr_cursor *cur, struct wlr_input_device *dev, double x, double y); /** - * Move the cursor in the direction of the given x and y coordinates. + * Move the cursor in the direction of the given x and y layout coordinates. If + * one coordinate is NAN, it will be ignored. * * `dev` may be passed to respect device mapping constraints. If `dev` is NULL, * device mapping constraints will be ignored. @@ -153,11 +171,4 @@ void wlr_cursor_map_to_region(struct wlr_cursor *cur, struct wlr_box *box); void wlr_cursor_map_input_to_region(struct wlr_cursor *cur, struct wlr_input_device *dev, struct wlr_box *box); -/** - * Convert absolute coordinates to layout coordinates for the device. - */ -bool wlr_cursor_absolute_to_layout_coords(struct wlr_cursor *cur, - struct wlr_input_device *device, double x, double y, - double *lx, double *ly); - #endif |