From d7d8936bc062567a8181eba81e194f9dffec5a04 Mon Sep 17 00:00:00 2001 From: ANSI TV Admin Date: Wed, 11 Nov 2026 11:46:55 -0800 Subject: [PATCH 17/24] Invert Mouse Wheel: reverse the BBS's wheel, not the dialing directory InvertMouseWheel set ciolib_swap_mouse_butt45, which swaps buttons 4 and 5 inside ciolib (mouse.c) for every consumer. With it on, the dialing directory, menus and scrollback all scrolled backwards: wheel up moved the list down. The SDL and GDI backends map the wheel correctly (up = button 4); the swap was the only inversion. Keep ciolib's swap off and apply the setting where it belongs: the wheel report sent to the host in handle_mouse_event(). SyncTERM's own UI always follows the physical wheel. The settings help line says so. Co-Authored-By: Claude Opus 5.5 --- src/syncterm/menu_settings.c | 2 +- src/syncterm/scripts/menu_settings_ui.wren | 2 +- src/syncterm/syncterm.c | 4 +++- src/syncterm/term.c | 8 ++++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/syncterm/menu_settings.c b/src/syncterm/menu_settings.c index 5aacb564..3e10d3e7 100644 --- a/src/syncterm/menu_settings.c +++ b/src/syncterm/menu_settings.c @@ -152,7 +152,7 @@ apply_settings(const struct syncterm_settings *set) settings.webgets = webgets; resolve_list_path(&settings); xpbeep_sound_devices_enabled = settings.audio_output_modes; - ciolib_swap_mouse_butt45 = settings.invert_wheel; + ciolib_swap_mouse_butt45 = false; /* applied to host reports in term.c */ if (settings.blocky) cio_api.options |= CONIO_OPT_BLOCKY_SCALING; else diff --git a/src/syncterm/scripts/menu_settings_ui.wren b/src/syncterm/scripts/menu_settings_ui.wren index fb841275..8b3359d6 100644 --- a/src/syncterm/scripts/menu_settings_ui.wren +++ b/src/syncterm/scripts/menu_settings_ui.wren @@ -496,7 +496,7 @@ class SettingsMenu { helpItem_("Menu Font", "The typeface used by the dialer and menus; sessions keep theirs") + helpItem_("Scaling", "Cycle the display scaling algorithm") + - helpItem_("Invert Mouse Wheel", "Reverse wheel-up and wheel-down") + + helpItem_("Invert Mouse Wheel", "Reverse the wheel as sent to the BBS; menus and lists are not affected") + helpItem_("GPU Accelerated", "Use SDL/OpenGL; Pointy runs its edge-aware scaler on the GPU. Restart when enabling") + helpItem_("Mouse Motion Past Edges", diff --git a/src/syncterm/syncterm.c b/src/syncterm/syncterm.c index 99440e4d..c1765453 100644 --- a/src/syncterm/syncterm.c +++ b/src/syncterm/syncterm.c @@ -2334,7 +2334,9 @@ main(int argc, char **argv) } atexit(syncterm_theme_shutdown); atexit(syncterm_cloud_themes_shutdown); - ciolib_swap_mouse_butt45 = settings.invert_wheel; + /* Invert Mouse Wheel reverses what the BBS is sent (term.c), not the + * wheel in SyncTERM's own lists, menus and scrollback. */ + ciolib_swap_mouse_butt45 = false; cvmode = find_vmode(CIOLIB_MODE_CUSTOM); vparams[cvmode].cols = settings.custom_cols; vparams[cvmode].rows = settings.custom_rows; diff --git a/src/syncterm/term.c b/src/syncterm/term.c index 1a9f034a..f546be85 100644 --- a/src/syncterm/term.c +++ b/src/syncterm/term.c @@ -4909,6 +4909,14 @@ handle_mouse_event(struct mouse_state *ms) case CIOLIB_BUTTON_3_RELEASE: case CIOLIB_BUTTON_4_PRESS: case CIOLIB_BUTTON_5_PRESS: + /* Invert Mouse Wheel applies here only: the wheel report + * the BBS receives. SyncTERM's own UI (dialing directory, + * menus, scrollback) always follows the physical wheel. */ + if (settings.invert_wheel + && (mevent.event == CIOLIB_BUTTON_4_PRESS + || mevent.event == CIOLIB_BUTTON_5_PRESS)) + mevent.event = (mevent.event == CIOLIB_BUTTON_4_PRESS) + ? CIOLIB_BUTTON_5_PRESS : CIOLIB_BUTTON_4_PRESS; conn_send(mouse_buf, fill_mevent(mouse_buf, sizeof(mouse_buf), &mevent, ms), 0); break; -- 2.47.3