]> git.mdlowis.com Git - proto/labwc.git/commitdiff
config: replace enums with int to handle negative values
authortokyo4j <hrak1529@gmail.com>
Thu, 7 Sep 2023 14:43:58 +0000 (23:43 +0900)
committerJohan Malm <johanmalm@users.noreply.github.com>
Thu, 7 Sep 2023 21:55:50 +0000 (22:55 +0100)
This commit also fixes that an invalid value in <accelProfile> is interpreted as "flat"

include/config/libinput.h
src/config/rcxml.c

index 46451f26c019a700e299a0699212cfef19425dd1..61505b119fd13dd474c23669232dad433a1a2f48 100644 (file)
@@ -21,11 +21,11 @@ struct libinput_category {
        int left_handed;
        enum libinput_config_tap_state tap;
        enum libinput_config_tap_button_map tap_button_map;
-       enum libinput_config_drag_state tap_and_drag;
-       enum libinput_config_drag_lock_state drag_lock;
-       enum libinput_config_accel_profile accel_profile;
-       enum libinput_config_middle_emulation_state middle_emu;
-       enum libinput_config_dwt_state dwt;
+       int tap_and_drag; /* -1 or libinput_config_drag_state */
+       int drag_lock; /* -1 or libinput_config_drag_lock_state */
+       int accel_profile; /* -1 or libinput_config_accel_profile */
+       int middle_emu; /* -1 or libinput_config_middle_emulation_state */
+       int dwt; /* -1 or libinput_config_dwt_state */
 };
 
 enum device_type get_device_type(const char *s);
index 5e6a456a39508df3d1719b90ac329c5ac98e1f15..2c525c72110f8e0c63a5811994680a719a863c3d 100644 (file)
@@ -339,11 +339,11 @@ fill_mousebind(char *nodename, char *content)
        }
 }
 
-static enum libinput_config_accel_profile
+static int
 get_accel_profile(const char *s)
 {
        if (!s) {
-               return LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
+               return -1;
        }
        if (!strcasecmp(s, "flat")) {
                return LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
@@ -351,7 +351,7 @@ get_accel_profile(const char *s)
        if (!strcasecmp(s, "adaptive")) {
                return LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
        }
-       return LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
+       return -1;
 }
 
 static void