Skip to content
Snippets Groups Projects
Commit 6c7bd3c8 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Show mouse state in status bar, add ALT-O to toggle remote mouse.

This allows easy copy/paste without scrollback hacks on BBSs that
insist on taking over the mouse just so you can move the mouse and
click a character rather than press one key because it's 3l337..
parent 55c4cece
Branches
No related tags found
No related merge requests found
Pipeline #5842 passed
...@@ -21,6 +21,7 @@ Improve startup behaviour on Windows ...@@ -21,6 +21,7 @@ Improve startup behaviour on Windows
Allow hardware scaling in X11, GDI, and SDL modes Allow hardware scaling in X11, GDI, and SDL modes
Support XTerm Bracketed Paste Support XTerm Bracketed Paste
Add -b and -n command-line options for BBS list and INI file respectively Add -b and -n command-line options for BBS list and INI file respectively
Add ALT-O to toggle remote mouse support (to enable copy/paste locally)
Version 1.1 Version 1.1
----------- -----------
......
...@@ -156,7 +156,8 @@ syncmenu(struct bbslist *bbs, int *speed) ...@@ -156,7 +156,8 @@ syncmenu(struct bbslist *bbs, int *speed)
"Capture Control ("ALT_KEY_NAMEP "-C)", "Capture Control ("ALT_KEY_NAMEP "-C)",
"ANSI Music Control ("ALT_KEY_NAMEP "-M)", "ANSI Music Control ("ALT_KEY_NAMEP "-M)",
"Font Setup ("ALT_KEY_NAMEP "-F)", "Font Setup ("ALT_KEY_NAMEP "-F)",
"Toggle Doorway Mode" "Toggle Doorway Mode",
"Toggle Remote Mouse (" ALT_KEY_NAMEP "-O)"
#ifndef WITHOUT_OOII #ifndef WITHOUT_OOII
, "Toggle Operation Overkill ][ Mode" , "Toggle Operation Overkill ][ Mode"
#endif #endif
...@@ -196,6 +197,7 @@ syncmenu(struct bbslist *bbs, int *speed) ...@@ -196,6 +197,7 @@ syncmenu(struct bbslist *bbs, int *speed)
"`ANSI Music` Enables/Disables ANSI Music\n" "`ANSI Music` Enables/Disables ANSI Music\n"
"`Font` Changes the current font (when supported)\n" "`Font` Changes the current font (when supported)\n"
"`Doorway Mode` Toggles the current DoorWay (keyboard input) setting\n" "`Doorway Mode` Toggles the current DoorWay (keyboard input) setting\n"
"`Remote Mouse` Toggles remote mouse events\n"
#ifndef WITHOUT_OOII #ifndef WITHOUT_OOII
"`Operation Overkill ][ Mode`\n" "`Operation Overkill ][ Mode`\n"
" Toggles the current Operation Overkill ][ setting\n" " Toggles the current Operation Overkill ][ setting\n"
......
...@@ -116,6 +116,7 @@ struct mouse_state { ...@@ -116,6 +116,7 @@ struct mouse_state {
uint32_t flags; uint32_t flags;
#define MS_FLAGS_SGR (1 << 0) #define MS_FLAGS_SGR (1 << 0)
#define MS_FLAGS_DISABLED (1 << 1)
#define MS_SGR_SET (1006) #define MS_SGR_SET (1006)
enum mouse_modes mode; enum mouse_modes mode;
}; };
...@@ -124,7 +125,7 @@ void ...@@ -124,7 +125,7 @@ void
setup_mouse_events(struct mouse_state *ms) setup_mouse_events(struct mouse_state *ms)
{ {
ciomouse_setevents(0); ciomouse_setevents(0);
if (ms) { if (ms && ((ms->flags & MS_FLAGS_DISABLED) == 0)) {
switch (ms->mode) { switch (ms->mode) {
case MM_RIP: case MM_RIP:
ciomouse_addevent(CIOLIB_BUTTON_1_PRESS); ciomouse_addevent(CIOLIB_BUTTON_1_PRESS);
...@@ -345,10 +346,13 @@ update_status(struct bbslist *bbs, int speed, int ooii_mode, bool ata_inv) ...@@ -345,10 +346,13 @@ update_status(struct bbslist *bbs, int speed, int ooii_mode, bool ata_inv)
time_t now; time_t now;
static time_t lastupd = 0; static time_t lastupd = 0;
static int oldspeed = 0; static int oldspeed = 0;
static int lastmouse = 0;
int newmouse;
int timeon; int timeon;
char sep; char sep;
int oldfont_norm; int oldfont_norm;
int oldfont_bright; int oldfont_bright;
struct mouse_state *ms = cterm->mouse_state_change_cbdata;
if (term.nostatus) if (term.nostatus)
return; return;
...@@ -374,12 +378,14 @@ update_status(struct bbslist *bbs, int speed, int ooii_mode, bool ata_inv) ...@@ -374,12 +378,14 @@ update_status(struct bbslist *bbs, int speed, int ooii_mode, bool ata_inv)
sep = '|'; sep = '|';
} }
now = time(NULL); now = time(NULL);
if ((now == lastupd) && (speed == oldspeed)) { newmouse = ((ms->mode == MM_OFF) ? 1 : 0) | (ms->flags & MS_FLAGS_DISABLED);
if ((now == lastupd) && (speed == oldspeed) && (newmouse == lastmouse)) {
setfont(oldfont_norm, 0, 1); setfont(oldfont_norm, 0, 1);
setfont(oldfont_bright, 0, 2); setfont(oldfont_bright, 0, 2);
return; return;
} }
lastupd = now; lastupd = now;
lastmouse = newmouse;
oldspeed = speed; oldspeed = speed;
if (now > (bbs->connected + 359999)) if (now > (bbs->connected + 359999))
timeon = 350000; timeon = 350000;
...@@ -481,6 +487,11 @@ update_status(struct bbslist *bbs, int speed, int ooii_mode, bool ata_inv) ...@@ -481,6 +487,11 @@ update_status(struct bbslist *bbs, int speed, int ooii_mode, bool ata_inv)
} }
if (wherex() - term.y + 1 >= term.width) if (wherex() - term.y + 1 >= term.width)
clreol(); clreol();
if (ms->mode != 0) {
gotoxy(31, 1);
ciolib_setcolour((ms->flags & MS_FLAGS_DISABLED) ? 8 : 11, 4);
putch('M');
}
_wscroll = oldscroll; _wscroll = oldscroll;
setfont(oldfont_norm, 0, 1); setfont(oldfont_norm, 0, 1);
setfont(oldfont_bright, 0, 2); setfont(oldfont_bright, 0, 2);
...@@ -4094,6 +4105,13 @@ doterm(struct bbslist *bbs) ...@@ -4094,6 +4105,13 @@ doterm(struct bbslist *bbs)
showmouse(); showmouse();
key = 0; key = 0;
break; break;
case 0x1800: /* ALT-O */
ms.flags ^= MS_FLAGS_DISABLED;
setup_mouse_events(&ms);
showmouse();
key = 0;
sleep = false;
break;
case 0x1600: /* ALT-U - Upload */ case 0x1600: /* ALT-U - Upload */
begin_upload(bbs, false, inch); begin_upload(bbs, false, inch);
setup_mouse_events(&ms); setup_mouse_events(&ms);
...@@ -4191,11 +4209,16 @@ doterm(struct bbslist *bbs) ...@@ -4191,11 +4209,16 @@ doterm(struct bbslist *bbs)
case 10: case 10:
cterm->doorway_mode = !cterm->doorway_mode; cterm->doorway_mode = !cterm->doorway_mode;
break; break;
case 11:
ms.flags ^= MS_FLAGS_DISABLED;
setup_mouse_events(&ms);
showmouse();
break;
#ifdef WITHOUT_OOII #ifdef WITHOUT_OOII
case 11: case 12:
#else #else
case 11: case 12:
ooii_mode++; ooii_mode++;
if (ooii_mode > MAX_OOII_MODE) { if (ooii_mode > MAX_OOII_MODE) {
xptone_close(); xptone_close();
...@@ -4205,7 +4228,7 @@ doterm(struct bbslist *bbs) ...@@ -4205,7 +4228,7 @@ doterm(struct bbslist *bbs)
xptone_open(); xptone_open();
} }
break; break;
case 12: case 13:
#endif #endif
scrollback_pos = cterm->backpos; scrollback_pos = cterm->backpos;
cterm_clearscreen(cterm, cterm->attr); /* Clear screen into cterm_clearscreen(cterm, cterm->attr); /* Clear screen into
...@@ -4218,9 +4241,9 @@ doterm(struct bbslist *bbs) ...@@ -4218,9 +4241,9 @@ doterm(struct bbslist *bbs)
hold_update = oldmc; hold_update = oldmc;
return true; return true;
#ifdef WITHOUT_OOII #ifdef WITHOUT_OOII
case 12:
#else
case 13: case 13:
#else
case 14:
#endif #endif
{ {
struct ciolib_screen *savscrn; struct ciolib_screen *savscrn;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment