aboutsummaryrefslogtreecommitdiff
path: root/mousetsr.c
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2024-05-20 00:37:02 +0200
committerJavier <dev.git@javispedro.com>2024-05-20 00:37:02 +0200
commit20f20d680edf03a874fc25463e9278322550dd5d (patch)
treeddb9e8ac5ee2c84e531ad89b7896aa03eef999e1 /mousetsr.c
parentcc1d9b4f7b48f275b99afd313b47c1c650dc60f3 (diff)
downloadvbados-20f20d680edf03a874fc25463e9278322550dd5d.tar.gz
vbados-20f20d680edf03a874fc25463e9278322550dd5d.zip
do not necessarily require int33/11 call to enable wheelapi
Diffstat (limited to 'mousetsr.c')
-rw-r--r--mousetsr.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/mousetsr.c b/mousetsr.c
index 6ca7cd7..2afc2b4 100644
--- a/mousetsr.c
+++ b/mousetsr.c
@@ -666,16 +666,7 @@ static void handle_mouse_event(uint16_t buttons, bool absolute, int x, int y, ch
#if USE_WHEEL
if (data.num_wheels && z) {
- if (data.usewheelapi) {
- if (wheeln == 1) events |= INT33_EVENT_MASK_HORIZ_WHEEL_MOVEMENT;
- else events |= INT33_EVENT_MASK_WHEEL_MOVEMENT;
- // Higher byte of buttons contains wheel movement
- buttons |= (z & 0xFF) << 8;
- // Accumulate delta wheel movement
- data.wheel[wheeln].delta += z;
- data.wheel[wheeln].last.x = data.pos.x;
- data.wheel[wheeln].last.y = data.pos.y;
- } else if (wheeln == 0 && (data.wheel_up_key || data.wheel_down_key)) {
+ if (wheeln == 0 && !data.usewheelapi && (data.wheel_up_key || data.wheel_down_key)) {
// Emulate keystrokes on (vertical) wheel movement
if (z < 0 && data.wheel_up_key) {
for (; z < 0; z++) {
@@ -686,6 +677,15 @@ static void handle_mouse_event(uint16_t buttons, bool absolute, int x, int y, ch
int16_store_keystroke(data.wheel_down_key);
}
}
+ } else {
+ if (wheeln == 1) events |= INT33_EVENT_MASK_HORIZ_WHEEL_MOVEMENT;
+ else events |= INT33_EVENT_MASK_WHEEL_MOVEMENT;
+ // Higher byte of buttons contains wheel movement
+ buttons |= (z & 0xFF) << 8;
+ // Accumulate delta wheel movement
+ data.wheel[wheeln].delta += z;
+ data.wheel[wheeln].last.x = data.pos.x;
+ data.wheel[wheeln].last.y = data.pos.y;
}
}
#endif
@@ -1220,7 +1220,7 @@ static void int33_handler(union INTPACK r)
r.w.dx = snap_to_grid(data.pos.y, data.screen_granularity.y);
r.w.bx = data.buttons;
#if USE_WHEEL
- if (data.usewheelapi && data.num_wheels > 0) {
+ if (data.num_wheels > 0) {
r.h.bh = data.wheel[0].delta;
data.wheel[0].delta = 0;
r.x.si = data.wheel[1].delta;
@@ -1248,7 +1248,7 @@ static void int33_handler(union INTPACK r)
#endif
r.w.ax = data.buttons;
#if USE_WHEEL
- if (data.usewheelapi && data.num_wheels > 0) {
+ if (data.num_wheels > 0) {
int n = -(int16_t)(r.w.bx);
r.h.ah = data.wheel[0].delta;
if (n >= 0 && n < MAX_WHEELS) {
@@ -1268,7 +1268,7 @@ static void int33_handler(union INTPACK r)
#endif
r.w.ax = data.buttons;
#if USE_WHEEL
- if (data.usewheelapi && data.num_wheels > 0) {
+ if (data.num_wheels > 0) {
int n = -(int16_t)(r.w.bx);
r.h.ah = data.wheel[0].delta;
if (n >= 0 && n < MAX_WHEELS) {