diff options
author | Drashna Jaelre <[email protected]> | 2024-03-09 21:34:41 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2024-03-10 05:34:41 +0000 |
commit | c0dbe9a33662a651fb91afb2e4810bae3f6a825e (patch) | |
tree | 468357a8433820dac27585d147e82c83b4bc6c9f /quantum/pointing_device | |
parent | 9f4a9d5826dde903aa0dcec3264cbf192b5044da (diff) | |
download | qmk_firmware-c0dbe9a33662a651fb91afb2e4810bae3f6a825e.tar.gz qmk_firmware-c0dbe9a33662a651fb91afb2e4810bae3f6a825e.zip |
Add utility functions for Pointing Device Auto Mouse feature (#23144)
* Make is_auto_mouse_active() available globally
* Add mouse key tracker functions for auto mouse layer
Diffstat (limited to 'quantum/pointing_device')
-rw-r--r-- | quantum/pointing_device/pointing_device_auto_mouse.c | 20 | ||||
-rw-r--r-- | quantum/pointing_device/pointing_device_auto_mouse.h | 4 |
2 files changed, 22 insertions, 2 deletions
diff --git a/quantum/pointing_device/pointing_device_auto_mouse.c b/quantum/pointing_device/pointing_device_auto_mouse.c index 1b11fffedb..d9f924e258 100644 --- a/quantum/pointing_device/pointing_device_auto_mouse.c +++ b/quantum/pointing_device/pointing_device_auto_mouse.c @@ -45,7 +45,7 @@ static inline bool layer_hold_check(void) { } /* check all layer activation criteria */ -static inline bool is_auto_mouse_active(void) { +bool is_auto_mouse_active(void) { return auto_mouse_context.status.is_activated || auto_mouse_context.status.mouse_key_tracker || layer_hold_check(); } @@ -99,6 +99,15 @@ bool get_auto_mouse_toggle(void) { } /** + * @brief get key tracker value + * + * @return bool of current layer_toggled state + */ +int8_t get_auto_mouse_key_tracker(void) { + return auto_mouse_context.status.mouse_key_tracker; +} + +/** * @brief Reset auto mouse context * * Clear timers and status @@ -164,6 +173,15 @@ void set_auto_mouse_debounce(uint8_t debounce) { } /** + * @brief Changes the timeout for the mouse auto layer to be disabled + * + * @param key_tracker + */ +void set_auto_mouse_key_tracker(int8_t key_tracker) { + auto_mouse_context.status.mouse_key_tracker = key_tracker; +} + +/** * @brief toggle mouse layer setting * * Change state of local layer_toggled bool meant to track when the mouse layer is toggled on by other means diff --git a/quantum/pointing_device/pointing_device_auto_mouse.h b/quantum/pointing_device/pointing_device_auto_mouse.h index 904f18b68e..a596c065a3 100644 --- a/quantum/pointing_device/pointing_device_auto_mouse.h +++ b/quantum/pointing_device/pointing_device_auto_mouse.h @@ -81,9 +81,11 @@ void set_auto_mouse_timeout(uint16_t timeout); // set l uint16_t get_auto_mouse_timeout(void); // get layer timeout void set_auto_mouse_debounce(uint8_t debounce); // set debounce uint8_t get_auto_mouse_debounce(void); // get debounce +void set_auto_mouse_key_tracker(int8_t key_tracker); // set key tracker +int8_t get_auto_mouse_key_tracker(void); // get key tracker void auto_mouse_layer_off(void); // disable target layer if appropriate (DO NOT USE in layer_state_set stack!!) layer_state_t remove_auto_mouse_layer(layer_state_t state, bool force); // remove auto mouse target layer from state if appropriate (can be forced) - +bool is_auto_mouse_active(void); // check if target layer is active /* ----------For custom pointing device activation----------------------------------------------------------- */ bool auto_mouse_activation(report_mouse_t mouse_report); // handles pointing device trigger conditions for target layer activation (overwritable) |