From 8c7ef5dec386d3587c19263830e085e48820a6df Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Sun, 24 May 2020 10:17:46 +0000 Subject: [PATCH] Use separate mouse-down (click) and release pass-through flags. Rename CON_MOUSE_REPORT to CON_MOUSE_SCROLL (since that is all it is used for). --- src/sbbs3/inkey.cpp | 18 ++++++++++-------- src/sbbs3/sbbsdefs.h | 7 ++++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/sbbs3/inkey.cpp b/src/sbbs3/inkey.cpp index eb655a7af1..2af3a12434 100644 --- a/src/sbbs3/inkey.cpp +++ b/src/sbbs3/inkey.cpp @@ -392,12 +392,13 @@ char sbbs_t::handle_ctrlkey(char ch, long mode) } if(pause_inside) return '\r'; - } else if(button == '`') { + } else if(button == '`' && console&CON_MOUSE_SCROLL) { return TERM_KEY_UP; - } else if(button == 'a') { + } else if(button == 'a' && console&CON_MOUSE_SCROLL) { return TERM_KEY_DOWN; } - if(console&CON_MOUSE_PASSTHRU) { + if((button != 0x23 && console&CON_MOUSE_CLK_PASSTHRU) + || (button == 0x23 && console&CON_MOUSE_REL_PASSTHRU)) { for(j = i; j > 0; j--) ungetkey(str[j - 1], /* insert: */true); ungetkey('[', /* insert: */true); @@ -465,12 +466,13 @@ char sbbs_t::handle_ctrlkey(char ch, long mode) } if(pause_inside) return '\r'; - } else if(button == 0x40) { + } else if(button == 0x40 && console&CON_MOUSE_SCROLL) { return TERM_KEY_UP; - } else if(button == 0x41) { + } else if(button == 0x41 && console&CON_MOUSE_SCROLL) { return TERM_KEY_DOWN; } - if(console&CON_MOUSE_PASSTHRU) { + if((ch == 'M' && console&CON_MOUSE_CLK_PASSTHRU) + || (ch == 'm' && console&CON_MOUSE_REL_PASSTHRU)) { lprintf(LOG_DEBUG, "Passing-through SGR mouse report: 'ESC[<%s'", str); for(j = i; j > 0; j--) ungetkey(str[j - 1], /* insert: */true); @@ -478,7 +480,7 @@ char sbbs_t::handle_ctrlkey(char ch, long mode) ungetkey('[', /* insert: */true); return(ESC); } - if(button == 2) // Right-click + if(ch == 'M' && button == 2) // Right-click return handle_ctrlkey(TERM_KEY_ABORT, mode); #ifdef _DEBUG lprintf(LOG_DEBUG, "Eating SGR mouse report: 'ESC[<%s'", str); @@ -604,7 +606,7 @@ void sbbs_t::clear_hotspots(void) lprintf(LOG_DEBUG, "Clearing %ld mouse hot spots", spots); #endif listFreeNodes(&mouse_hotspots); - if(!(console&CON_MOUSE_REPORT)) + if(!(console&CON_MOUSE_SCROLL)) set_mouse(MOUSE_MODE_OFF); } } diff --git a/src/sbbs3/sbbsdefs.h b/src/sbbs3/sbbsdefs.h index c24e9745ee..0408bdef4f 100644 --- a/src/sbbs3/sbbsdefs.h +++ b/src/sbbs3/sbbsdefs.h @@ -492,9 +492,10 @@ typedef enum { /* Values for xtrn_t.event */ #define CON_HIGH_FONT (1<<19) /* Alt high-intensity font activated */ #define CON_BLINK_FONT (1<<20) /* Alt blink attribute font activated */ #define CON_HBLINK_FONT (1<<21) /* Alt high-blink attribute font activated */ -#define CON_MOUSE_PASSTHRU (1<<24) // Pass-through unhandled mouse reports -#define CON_MOUSE_REPORT (1<<25) // Mouse-reports enabled for non-hotspots (e.g. scroll-wheel) -#define CON_CR_CLREOL (1<<31) // outchar('\r') clears to end-of-line first +#define CON_MOUSE_CLK_PASSTHRU (1<<24) // Pass-through unhandled mouse button-click reports +#define CON_MOUSE_REL_PASSTHRU (1<<25) // Pass-through unhandled mouse button-release reports +#define CON_MOUSE_SCROLL (1<<26) // Mouse-reports enabled for non-hotspots (e.g. scroll-wheel) +#define CON_CR_CLREOL (1<<31) // outchar('\r') clears to end-of-line first /* Number of milliseconds */ #define DELAY_AUTOHG 1500 /* Delay for auto-hangup (xfer) */ -- GitLab