diff options
| author | Daniel Kao <daniel.m.kao@gmail.com> | 2022-07-26 11:35:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-26 19:35:41 +0100 |
| commit | b8b2e9997680bbc0aef074ad0bfb2eb130aafe04 (patch) | |
| tree | a90e222624ebc51cad429b62e8c862f995954d6d /quantum/pointing_device | |
| parent | c982d6c5e3f5b113322beabb8a51c3153cab3d54 (diff) | |
Constrain Cirque Pinnacle coordinates (#17803)
Static x & y should be the same type as touchData.xValue &
touchData.yValue: uint16_t.
Their delta could be larger than int8_t and should be constrained to
mouse_xy_report_t.
Diffstat (limited to 'quantum/pointing_device')
| -rw-r--r-- | quantum/pointing_device/pointing_device_drivers.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/quantum/pointing_device/pointing_device_drivers.c b/quantum/pointing_device/pointing_device_drivers.c index d0b545d22d..3780f3d2da 100644 --- a/quantum/pointing_device/pointing_device_drivers.c +++ b/quantum/pointing_device/pointing_device_drivers.c | |||
| @@ -117,11 +117,11 @@ void cirque_pinnacle_configure_cursor_glide(float trigger_px) { | |||
| 117 | # endif | 117 | # endif |
| 118 | 118 | ||
| 119 | report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report) { | 119 | report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report) { |
| 120 | pinnacle_data_t touchData = cirque_pinnacle_read_data(); | 120 | pinnacle_data_t touchData = cirque_pinnacle_read_data(); |
| 121 | mouse_xy_report_t report_x = 0, report_y = 0; | 121 | mouse_xy_report_t report_x = 0, report_y = 0; |
| 122 | static mouse_xy_report_t x = 0, y = 0; | 122 | static uint16_t x = 0, y = 0; |
| 123 | # ifdef POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE | 123 | # ifdef POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE |
| 124 | cursor_glide_t glide_report = {0}; | 124 | cursor_glide_t glide_report = {0}; |
| 125 | 125 | ||
| 126 | if (cursor_glide_enable) { | 126 | if (cursor_glide_enable) { |
| 127 | glide_report = cursor_glide_check(&glide); | 127 | glide_report = cursor_glide_check(&glide); |
| @@ -154,8 +154,8 @@ report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report) { | |||
| 154 | 154 | ||
| 155 | if (!cirque_pinnacle_gestures(&mouse_report, touchData)) { | 155 | if (!cirque_pinnacle_gestures(&mouse_report, touchData)) { |
| 156 | if (x && y && touchData.xValue && touchData.yValue) { | 156 | if (x && y && touchData.xValue && touchData.yValue) { |
| 157 | report_x = (mouse_xy_report_t)(touchData.xValue - x); | 157 | report_x = CONSTRAIN_HID_XY((int16_t)(touchData.xValue - x)); |
| 158 | report_y = (mouse_xy_report_t)(touchData.yValue - y); | 158 | report_y = CONSTRAIN_HID_XY((int16_t)(touchData.yValue - y)); |
| 159 | } | 159 | } |
| 160 | x = touchData.xValue; | 160 | x = touchData.xValue; |
| 161 | y = touchData.yValue; | 161 | y = touchData.yValue; |
