diff options
author | emersion <contact@emersion.fr> | 2018-04-29 13:10:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-29 13:10:59 +0100 |
commit | 976e6b99b62891a72e48fca21b93708e060c134a (patch) | |
tree | 472f59488b8ae77b5f296de8d17e5ba68d4407fb /sway/input | |
parent | 167c2e1aa99aa8011e169b0fb61c47953cc9a5f6 (diff) | |
parent | 24ab66d123ab493feb3c2343cbc9d93625b668d7 (diff) | |
download | sway-976e6b99b62891a72e48fca21b93708e060c134a.tar.xz |
Merge branch 'master' into refactor-arrange-windows
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/cursor.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 944ad8eb..64b95e7d 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -1,4 +1,5 @@ #define _XOPEN_SOURCE 700 +#include <math.h> #ifdef __linux__ #include <linux/input-event-codes.h> #elif __FreeBSD__ @@ -262,18 +263,11 @@ static void handle_touch_motion(struct wl_listener *listener, void *data) { } static double apply_mapping_from_coord(double low, double high, double value) { - if (value == -1) { + if (isnan(value)) { return value; } - value = (value - low) / (high - low); - if (value < 0) { - return 0; - } else if (value > 1) { - return 1; - } else { - return value; - } + return (value - low) / (high - low); } static void apply_mapping_from_region(struct wlr_input_device *device, @@ -300,7 +294,7 @@ static void handle_tool_axis(struct wl_listener *listener, void *data) { struct wlr_event_tablet_tool_axis *event = data; struct sway_input_device *input_device = event->device->data; - double x = -1, y = -1; + double x = NAN, y = NAN; if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X)) { x = event->x; } |