From: Peter Hutterer Date: Thu, 2 Aug 2018 05:02:18 +0000 (+1000) Subject: util: remove now-unused helper functions X-Git-Tag: 1.11.902~54 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a508097e986dc8b5fa99263edb409fdec703719a;p=platform%2Fupstream%2Flibinput.git util: remove now-unused helper functions Obsolete with the switch to the device quirks Signed-off-by: Peter Hutterer --- diff --git a/src/libinput-util.c b/src/libinput-util.c index bb6a9c3..1e198a8 100644 --- a/src/libinput-util.c +++ b/src/libinput-util.c @@ -252,28 +252,6 @@ parse_mouse_wheel_click_angle_property(const char *prop) } /** - * Helper function to parse the TRACKPOINT_CONST_ACCEL property from udev. - * Property is of the form: - * TRACKPOINT_CONST_ACCEL= - * - * @param prop The value of the udev property (without the TRACKPOINT_CONST_ACCEL=) - * @return The acceleration, or 0.0 on error. - */ -double -parse_trackpoint_accel_property(const char *prop) -{ - double accel; - - if (!prop) - return 0.0; - - if (!safe_atod(prop, &accel)) - accel = 0.0; - - return accel; -} - -/** * Parses a simple dimension string in the form of "10x40". The two * numbers must be positive integers in decimal notation. * On success, the two numbers are stored in w and h. On failure, w and h @@ -421,81 +399,6 @@ parse_range_property(const char *prop, int *hi, int *lo) } /** - * Helper function to parse the LIBINPUT_ATTR_PALM_PRESSURE_THRESHOLD - * property from udev. Property is of the form: - * LIBINPUT_ATTR_PALM_PRESSURE_THRESHOLD= - * Where the number indicates the minimum threshold to consider a touch to - * be a palm. - * - * @param prop The value of the udev property (without the * - * LIBINPUT_ATTR_PALM_PRESSURE_THRESHOLD=) - * @return The pressure threshold or 0 on error - */ -int -parse_palm_pressure_property(const char *prop) -{ - int threshold = 0; - - if (!prop) - return 0; - - if (!safe_atoi(prop, &threshold) || threshold < 0) - return 0; - - return threshold; -} - -/** - * Helper function to parse the LIBINPUT_ATTR_PALM_SIZE_THRESHOLD property - * from udev. Property is of the form: - * LIBINPUT_ATTR_PALM_SIZE_THRESHOLD= - * Where the number indicates the minimum threshold to consider a touch to - * be a palm. - * - * @param prop The value of the udev property (without the - * LIBINPUT_ATTR_PALM_SIZE_THRESHOLD=) - * @return The pressure threshold or 0 on error - */ -int -parse_palm_size_property(const char *prop) -{ - int thr = 0; - - if (!prop) - return 0; - - if (!safe_atoi(prop, &thr) || thr < 0 || thr > 2028) - return 0; - - return thr; -} - -/** - * Helper function to parse the LIBINPUT_ATTR_THUMB_PRESSURE_THRESHOLD - * property from udev. Property is of the form: - * LIBINPUT_ATTR_THUMB_PRESSURE_THRESHOLD= - * Where the number indicates the minimum threshold to consider a touch to - * be a thumb. - * - * @param prop The value of the udev property (without the - * LIBINPUT_ATTR_THUMB_PRESSURE_THRESHOLD=) - * @return The pressure threshold or 0 on error - */ -int -parse_thumb_pressure_property(const char *prop) -{ - int threshold = 0; - - if (!prop) - return 0; - - if (!safe_atoi(prop, &threshold) || threshold < 0) - return 0; - - return threshold; -} - -/** * Return the next word in a string pointed to by state before the first * separator character. Call repeatedly to tokenize a whole string. * diff --git a/src/libinput-util.h b/src/libinput-util.h index 944e186..537de57 100644 --- a/src/libinput-util.h +++ b/src/libinput-util.h @@ -422,13 +422,9 @@ enum ratelimit_state ratelimit_test(struct ratelimit *r); int parse_mouse_dpi_property(const char *prop); int parse_mouse_wheel_click_angle_property(const char *prop); int parse_mouse_wheel_click_count_property(const char *prop); -double parse_trackpoint_accel_property(const char *prop); bool parse_dimension_property(const char *prop, size_t *width, size_t *height); bool parse_calibration_property(const char *prop, float calibration[6]); bool parse_range_property(const char *prop, int *hi, int *lo); -int parse_palm_pressure_property(const char *prop); -int parse_palm_size_property(const char *prop); -int parse_thumb_pressure_property(const char *prop); enum tpkbcombo_layout { TPKBCOMBO_LAYOUT_UNKNOWN, diff --git a/test/test-misc.c b/test/test-misc.c index 2257156..c1cca24 100644 --- a/test/test-misc.c +++ b/test/test-misc.c @@ -838,35 +838,6 @@ START_TEST(wheel_click_count_parser) } END_TEST -struct parser_test_float { - char *tag; - double expected_value; -}; - -START_TEST(trackpoint_accel_parser) -{ - struct parser_test_float tests[] = { - { "0.5", 0.5 }, - { "1.0", 1.0 }, - { "2.0", 2.0 }, - { "fail1.0", 0.0 }, - { "1.0fail", 0.0 }, - { "0,5", 0.0 }, - { NULL, 0.0 } - }; - int i; - double accel; - - for (i = 0; tests[i].tag != NULL; i++) { - accel = parse_trackpoint_accel_property(tests[i].tag); - ck_assert(accel == tests[i].expected_value); - } - - accel = parse_trackpoint_accel_property(NULL); - ck_assert_double_eq(accel, 0.0); -} -END_TEST - struct parser_test_dimension { char *tag; bool success; @@ -1051,33 +1022,6 @@ START_TEST(range_prop_parser) } END_TEST -START_TEST(palm_pressure_parser) -{ - struct parser_test tests[] = { - { "1", 1 }, - { "10", 10 }, - { "255", 255 }, - { "360", 360 }, - - { "-12", 0 }, - { "0", 0 }, - { "-0", 0 }, - { "a", 0 }, - { "10a", 0 }, - { "10-", 0 }, - { "sadfasfd", 0 }, - { NULL, 0 } - }; - - int i, angle; - - for (i = 0; tests[i].tag != NULL; i++) { - angle = parse_palm_pressure_property(tests[i].tag); - ck_assert_int_eq(angle, tests[i].expected_value); - } -} -END_TEST - START_TEST(time_conversion) { ck_assert_int_eq(us(10), 10); @@ -1798,12 +1742,10 @@ TEST_COLLECTION(misc) litest_add_deviceless("misc:parser", dpi_parser); litest_add_deviceless("misc:parser", wheel_click_parser); litest_add_deviceless("misc:parser", wheel_click_count_parser); - litest_add_deviceless("misc:parser", trackpoint_accel_parser); litest_add_deviceless("misc:parser", dimension_prop_parser); litest_add_deviceless("misc:parser", reliability_prop_parser); litest_add_deviceless("misc:parser", calibration_prop_parser); litest_add_deviceless("misc:parser", range_prop_parser); - litest_add_deviceless("misc:parser", palm_pressure_parser); litest_add_deviceless("misc:parser", safe_atoi_test); litest_add_deviceless("misc:parser", safe_atoi_base_16_test); litest_add_deviceless("misc:parser", safe_atoi_base_8_test);