aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/wheelapi2.txt13
-rw-r--r--int33.h3
-rw-r--r--mousetsr.c26
-rw-r--r--mousew16.c2
4 files changed, 22 insertions, 22 deletions
diff --git a/doc/wheelapi2.txt b/doc/wheelapi2.txt
index 6f6af29..d1f6fb3 100644
--- a/doc/wheelapi2.txt
+++ b/doc/wheelapi2.txt
@@ -6,7 +6,7 @@ NOTE: Draft, subject to change.
---------------------------------------------------------------------
Changes to the wheelapi v1 functions:
-INT 33/0011 - Check wheel support and enable/get capabilities flags
+INT 33/0011 - Check wheel support and get capabilities flags
AX = 0011h
Return: AX = 574Dh ('WM' in assembly) if Wheel API is supported by driver
CX = Capabilities flag
@@ -15,10 +15,9 @@ Return: AX = 574Dh ('WM' in assembly) if Wheel API is supported by driver
0 1=Pointing device supports wheel
1 1=Pointing device supports 2nd wheel
2-15 Reserved
-Note: calling this function enables support for BOTH wheels
- (until the next int33/0 reset call).
- To receive 2nd wheel interrupts,, bit 9 must be set when registering
- user interrupt routines (see INT 33/000C).
+Notes: this function should be examined before accessing wheel features.
+ vbmouse currently assumes this is called after each int33/0, otherwise
+ wheel events may be sent as keystrokes instead of wheelapi.
INT 33/0003 - Get cursor position, buttons status and wheel counter
AX = 0003h
@@ -62,9 +61,7 @@ Notes: on entry, bit 9 of CX (call mask) indicates that the user routine
BH holds VERTICAL wheel movement.
it is impossible for the user routine to be called with both
vertical (bit 7) and horizontal (bit 9) movement.
-
-Remark: A program that just sets 0xFFFF event mask and expects to find vertical
+ A program that just sets 0xFFFF event mask and expects to find vertical
wheel movement info in BH (wheelapi v1 style) will be confused, as
here when bit 9 is set BH will contain horizontal wheel movement
instead. DN/2 does this, so horizontal scrolling acts like vertical.
- Maybe this isn't so bad.
diff --git a/int33.h b/int33.h
index 8783d20..f7a469d 100644
--- a/int33.h
+++ b/int33.h
@@ -189,6 +189,9 @@ enum INT33_EVENT_MASK {
/** 2nd/horizontal wheel mouse movement. */
INT33_EVENT_MASK_HORIZ_WHEEL_MOVEMENT = 1 << 9,
+ INT33_EVENT_MASK_ANY_WHEEL_MOVEMENT
+ = INT33_EVENT_MASK_WHEEL_MOVEMENT | INT33_EVENT_MASK_HORIZ_WHEEL_MOVEMENT,
+
INT33_EVENT_MASK_4TH_BUTTON_PRESSED_INDEX = 10,
INT33_EVENT_MASK_4TH_BUTTON_PRESSED = 1 << 10,
INT33_EVENT_MASK_4TH_BUTTON_RELEASED = 1 << 11,
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) {
diff --git a/mousew16.c b/mousew16.c
index f082a6d..78f2315 100644
--- a/mousew16.c
+++ b/mousew16.c
@@ -300,7 +300,7 @@ static void FAR int33_mouse_callback(uint16_t events, uint16_t buttons, int16_t
}
#if USE_WHEEL
- if (flags.wheel && (events & INT33_EVENT_MASK_WHEEL_MOVEMENT|INT33_EVENT_MASK_HORIZ_WHEEL_MOVEMENT)) {
+ if (flags.wheel && (events & INT33_EVENT_MASK_ANY_WHEEL_MOVEMENT)) {
// If wheel API is enabled, higher byte of buttons contains wheel movement
int8_t z = (buttons & 0xFF00) >> 8;
BOOL vertical = !(events & INT33_EVENT_MASK_HORIZ_WHEEL_MOVEMENT);