diff options
author | JohSchneider <JohSchneider@googlemail.com> | 2024-01-10 16:38:13 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-10 17:38:13 +0100 |
commit | d9b1ab9ae03a5d6ca09902a1c0d2927548829de8 (patch) | |
tree | f7fd8e4ed6b7a2d6f0b6b94ae5814a0fb31e4f60 | |
parent | 41948350e866b8881a82a384342686942fc92865 (diff) |
pointing_device: motion pin define and c-format weirdness (#22802)
the mutual exclusive POINTING_DEVICE_MOTION_PIN and SPLIT_POINTING_ENABLE influence if and how the `pointing_device_driver.get_report` is triggered. now the way the define is wrapping around an "unbraced" if leads clang-format to weirdly indent the first line in the 'SPLIT_POINTING_ENABLE' as the first command after the if.
this hints that any code addition in between the two - that possibly should run regardless, would break the if-def enabled code.
this can be solved by adding a pair of curly braces in the POINTING_DEVICE_MOTION_PIN part, to clearly denote which commands are to be skipped if the motion pin shows now activity.
Co-authored-by: Johannes <you@example.com>
-rw-r--r-- | quantum/pointing_device/pointing_device.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/quantum/pointing_device/pointing_device.c b/quantum/pointing_device/pointing_device.c index 17dc701a41..2fa49ade8e 100644 --- a/quantum/pointing_device/pointing_device.c +++ b/quantum/pointing_device/pointing_device.c @@ -251,14 +251,15 @@ __attribute__((weak)) bool pointing_device_task(void) { # else if (readPin(POINTING_DEVICE_MOTION_PIN)) # endif + { #endif #if defined(SPLIT_POINTING_ENABLE) # if defined(POINTING_DEVICE_COMBINED) static uint8_t old_buttons = 0; - local_mouse_report.buttons = old_buttons; - local_mouse_report = pointing_device_driver.get_report(local_mouse_report); - old_buttons = local_mouse_report.buttons; + local_mouse_report.buttons = old_buttons; + local_mouse_report = pointing_device_driver.get_report(local_mouse_report); + old_buttons = local_mouse_report.buttons; # elif defined(POINTING_DEVICE_LEFT) || defined(POINTING_DEVICE_RIGHT) local_mouse_report = POINTING_DEVICE_THIS_SIDE ? pointing_device_driver.get_report(local_mouse_report) : shared_mouse_report; # else @@ -268,6 +269,10 @@ __attribute__((weak)) bool pointing_device_task(void) { local_mouse_report = pointing_device_driver.get_report(local_mouse_report); #endif // defined(SPLIT_POINTING_ENABLE) +#ifdef POINTING_DEVICE_MOTION_PIN + } +#endif + // allow kb to intercept and modify report #if defined(SPLIT_POINTING_ENABLE) && defined(POINTING_DEVICE_COMBINED) if (is_keyboard_left()) { |