Skip to content

Commit e71670a

Browse files
committed
support concurrent trackpoint movement and mousekeys
1 parent f20a6f8 commit e71670a

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

tmk_core/common/action.c

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
3333
#include "nodebug.h"
3434
#endif
3535

36+
int tp_buttons;
3637

3738
void action_exec(keyevent_t event)
3839
{
@@ -201,11 +202,35 @@ void process_action(keyrecord_t *record)
201202
/* Mouse key */
202203
case ACT_MOUSEKEY:
203204
if (event.pressed) {
204-
mousekey_on(action.key.code);
205-
mousekey_send();
205+
switch (action.key.code) {
206+
case KC_MS_BTN1:
207+
tp_buttons |= (1<<0);
208+
break;
209+
case KC_MS_BTN2:
210+
tp_buttons |= (1<<1);
211+
break;
212+
case KC_MS_BTN3:
213+
tp_buttons |= (1<<2);
214+
break;
215+
default:
216+
mousekey_on(action.key.code);
217+
mousekey_send();
218+
}
206219
} else {
207-
mousekey_off(action.key.code);
208-
mousekey_send();
220+
switch (action.key.code) {
221+
case KC_MS_BTN1:
222+
tp_buttons &= ~(1<<0);
223+
break;
224+
case KC_MS_BTN2:
225+
tp_buttons &= ~(1<<1);
226+
break;
227+
case KC_MS_BTN3:
228+
tp_buttons &= ~(1<<2);
229+
break;
230+
default:
231+
mousekey_off(action.key.code);
232+
mousekey_send();
233+
}
209234
}
210235
break;
211236
#endif

tmk_core/protocol/ps2_mouse.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,13 @@ void ps2_mouse_task(void)
7373
enum { SCROLL_NONE, SCROLL_BTN, SCROLL_SENT };
7474
static uint8_t scroll_state = SCROLL_NONE;
7575
static uint8_t buttons_prev = 0;
76+
extern tp_buttons;
7677

7778
/* receives packet from mouse */
7879
uint8_t rcv;
7980
rcv = ps2_host_send(PS2_MOUSE_READ_DATA);
8081
if (rcv == PS2_ACK) {
81-
mouse_report.buttons = ps2_host_recv_response();
82+
mouse_report.buttons = ps2_host_recv_response() | tp_buttons;
8283
mouse_report.x = ps2_host_recv_response();
8384
mouse_report.y = ps2_host_recv_response();
8485
} else {

0 commit comments

Comments
 (0)