[PATCH libinput] tablet: Rename TILT_VERTICAL and TILT_HORIZONTAL to TILT_X and TILT_Y

Stephen Chandler Paul thatslyude at gmail.com
Tue Jul 8 22:14:48 PDT 2014


Since the orientation of the tablet can potentially change, this naming scheme
makes a lot more sense then VERTICAL and HORIZONTAL does since they don't
reflect the actual physical movement.

Signed-off-by: Stephen Chandler Paul <thatslyude at gmail.com>
---
 src/evdev-tablet.c  |  4 ++--
 src/evdev-tablet.h  |  8 ++++----
 src/libinput.h      | 13 ++++++-------
 test/tablet.c       | 16 ++++++++--------
 tools/event-debug.c |  8 ++++----
 5 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 051c3b4..d1ad4bb 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -149,8 +149,8 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
 		case LIBINPUT_TABLET_AXIS_PRESSURE:
 			tablet->axes[a] = normalize_pressure_or_dist(absinfo);
 			break;
-		case LIBINPUT_TABLET_AXIS_TILT_VERTICAL:
-		case LIBINPUT_TABLET_AXIS_TILT_HORIZONTAL:
+		case LIBINPUT_TABLET_AXIS_TILT_X:
+		case LIBINPUT_TABLET_AXIS_TILT_Y:
 			tablet->axes[a] = normalize_tilt(absinfo);
 			break;
 		default:
diff --git a/src/evdev-tablet.h b/src/evdev-tablet.h
index 4de4cec..74447bd 100644
--- a/src/evdev-tablet.h
+++ b/src/evdev-tablet.h
@@ -75,10 +75,10 @@ evcode_to_axis(const uint32_t evcode)
 		axis = LIBINPUT_TABLET_AXIS_PRESSURE;
 		break;
 	case ABS_TILT_X:
-		axis = LIBINPUT_TABLET_AXIS_TILT_HORIZONTAL;
+		axis = LIBINPUT_TABLET_AXIS_TILT_Y;
 		break;
 	case ABS_TILT_Y:
-		axis = LIBINPUT_TABLET_AXIS_TILT_VERTICAL;
+		axis = LIBINPUT_TABLET_AXIS_TILT_X;
 		break;
 	default:
 		axis = LIBINPUT_TABLET_AXIS_NONE;
@@ -106,10 +106,10 @@ axis_to_evcode(const enum libinput_tablet_axis axis)
 	case LIBINPUT_TABLET_AXIS_PRESSURE:
 		evcode = ABS_PRESSURE;
 		break;
-	case LIBINPUT_TABLET_AXIS_TILT_VERTICAL:
+	case LIBINPUT_TABLET_AXIS_TILT_X:
 		evcode = ABS_TILT_X;
 		break;
-	case LIBINPUT_TABLET_AXIS_TILT_HORIZONTAL:
+	case LIBINPUT_TABLET_AXIS_TILT_Y:
 		evcode = ABS_TILT_Y;
 		break;
 	default:
diff --git a/src/libinput.h b/src/libinput.h
index fa87094..14e533e 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -182,9 +182,9 @@ enum libinput_tablet_axis {
 	LIBINPUT_TABLET_AXIS_Y = 1,
 	LIBINPUT_TABLET_AXIS_DISTANCE = 2,
 	LIBINPUT_TABLET_AXIS_PRESSURE = 3,
-	LIBINPUT_TABLET_AXIS_TILT_VERTICAL = 4,
-	LIBINPUT_TABLET_AXIS_TILT_HORIZONTAL = 5,
-	LIBINPUT_TABLET_AXIS_CNT = LIBINPUT_TABLET_AXIS_TILT_HORIZONTAL + 1
+	LIBINPUT_TABLET_AXIS_TILT_X = 4,
+	LIBINPUT_TABLET_AXIS_TILT_Y = 5,
+	LIBINPUT_TABLET_AXIS_CNT = LIBINPUT_TABLET_AXIS_TILT_Y + 1
 };
 
 /**
@@ -871,10 +871,9 @@ libinput_event_tablet_axis_has_changed(struct libinput_event_tablet *event,
  *   sensor, normalized from 0 to 1
  * - @ref LIBINPUT_TABLET_AXIS_PRESSURE - The current pressure being applied on
  *   the tool in use, normalized from 0 to 1
- * - @ref LIBINPUT_TABLET_AXIS_TILT_VERTICAL and @ref
- *   LIBINPUT_TABLET_AXIS_TILT_HORIZONTAL - normalized value between -1 and 1
- *   that indicates the tilt vertical or horizontal tilt of the tool
- *   respectively
+ * - @ref LIBINPUT_TABLET_AXIS_TILT_X and @ref LIBINPUT_TABLET_AXIS_TILT_Y -
+ *   normalized value between -1 and 1 that indicates the X or Y tilt of the
+ *   tool
  *
  * @param event The libinput tablet event
  * @param axis The axis to retrieve the value of
diff --git a/test/tablet.c b/test/tablet.c
index 7069074..0cd6357 100644
--- a/test/tablet.c
+++ b/test/tablet.c
@@ -403,22 +403,22 @@ START_TEST(normalization)
 
 			if (libinput_event_tablet_axis_has_changed(
 				tablet_event,
-				LIBINPUT_TABLET_AXIS_TILT_VERTICAL)) {
+				LIBINPUT_TABLET_AXIS_TILT_X)) {
 				tilt_vertical =
 					libinput_event_tablet_get_axis_value(
 					    tablet_event,
-					    LIBINPUT_TABLET_AXIS_TILT_VERTICAL);
+					    LIBINPUT_TABLET_AXIS_TILT_X);
 
 				litest_assert_double_eq(tilt_vertical, -1);
 			}
 
 			if (libinput_event_tablet_axis_has_changed(
 				tablet_event,
-				LIBINPUT_TABLET_AXIS_TILT_HORIZONTAL)) {
+				LIBINPUT_TABLET_AXIS_TILT_Y)) {
 				tilt_horizontal =
 					libinput_event_tablet_get_axis_value(
 					    tablet_event,
-					    LIBINPUT_TABLET_AXIS_TILT_HORIZONTAL);
+					    LIBINPUT_TABLET_AXIS_TILT_Y);
 
 				litest_assert_double_eq(tilt_horizontal, -1);
 			}
@@ -465,22 +465,22 @@ START_TEST(normalization)
 
 			if (libinput_event_tablet_axis_has_changed(
 				tablet_event,
-				LIBINPUT_TABLET_AXIS_TILT_VERTICAL)) {
+				LIBINPUT_TABLET_AXIS_TILT_X)) {
 				tilt_vertical =
 					libinput_event_tablet_get_axis_value(
 					    tablet_event,
-					    LIBINPUT_TABLET_AXIS_TILT_VERTICAL);
+					    LIBINPUT_TABLET_AXIS_TILT_X);
 
 				litest_assert_double_eq(tilt_vertical, 1);
 			}
 
 			if (libinput_event_tablet_axis_has_changed(
 				tablet_event,
-				LIBINPUT_TABLET_AXIS_TILT_HORIZONTAL)) {
+				LIBINPUT_TABLET_AXIS_TILT_Y)) {
 				tilt_horizontal =
 					libinput_event_tablet_get_axis_value(
 					    tablet_event,
-					    LIBINPUT_TABLET_AXIS_TILT_HORIZONTAL);
+					    LIBINPUT_TABLET_AXIS_TILT_Y);
 
 				litest_assert_double_eq(tilt_horizontal, 1);
 			}
diff --git a/tools/event-debug.c b/tools/event-debug.c
index 5c6a062..acf9d81 100644
--- a/tools/event-debug.c
+++ b/tools/event-debug.c
@@ -397,11 +397,11 @@ print_tablet_axis_event(struct libinput_event *ev)
 	       x, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_X),
 	       y, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_Y));
 
-	x = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_TILT_VERTICAL);
-	y = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_TILT_HORIZONTAL);
+	x = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_TILT_X);
+	y = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_TILT_Y);
 	printf("\ttilt: %.2f%s/%.2f%s ",
-	       x, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_TILT_VERTICAL),
-	       y, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_TILT_HORIZONTAL));
+	       x, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_TILT_X),
+	       y, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_TILT_Y));
 
 	dist = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_DISTANCE);
 	pressure = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_PRESSURE);
-- 
1.8.5.5



More information about the wayland-devel mailing list