Skip to content
Snippets Groups Projects
Commit bca6eb52 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Setting console.mouse_mode to true enables default mouse=enabled mode

A single source of truth is now used for SBBS's mouse mode (MOUSE_MODE_ON). A JS script doesn't need to know what SBBS's preferred/default mouse-enabled mode flags are, just set to this property to "true". Setting to "false" is the same as setting to MOUSE_MODE_OFF (0).
parent 0021b378
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #3154 passed
......@@ -567,7 +567,12 @@ void sbbs_t::set_mouse(long flags)
if(mode & MOUSE_MODE_ANY) ansi_mouse(ANSI_MOUSE_ANY, true);
if(mode & MOUSE_MODE_EXT) ansi_mouse(ANSI_MOUSE_EXT, true);
mouse_mode = flags;
if(mouse_mode != flags) {
#if 0
lprintf(LOG_DEBUG, "New mouse mode: %X (was: %X)", flags, mouse_mode);
#endif
mouse_mode = flags;
}
}
}
......@@ -589,7 +594,7 @@ struct mouse_hotspot* sbbs_t::add_hotspot(struct mouse_hotspot* spot)
list_node_t* node = listInsertNodeData(&mouse_hotspots, spot, sizeof(*spot));
if(node == NULL)
return NULL;
set_mouse(MOUSE_MODE_NORM | MOUSE_MODE_EXT);
set_mouse(MOUSE_MODE_ON);
return (struct mouse_hotspot*)node->data;
}
......
......@@ -231,6 +231,8 @@ static JSBool js_console_set(JSContext *cx, JSObject *obj, jsid id, JSBool stric
sbbs->console=val;
break;
case CON_PROP_MOUSE_MODE:
if(*vp == JSVAL_TRUE)
val = MOUSE_MODE_ON;
sbbs->set_mouse(val);
break;
case CON_PROP_LNCNTR:
......@@ -387,7 +389,8 @@ static jsSyncPropertySpec js_console_properties[] = {
#ifdef BUILD_JSDOCS
static const char* con_prop_desc[] = {
"status bit-field (see <tt>CON_*</tt> in <tt>sbbsdefs.js</tt> for bit definitions)"
,"mouse mode bit-field (see <tt>MOUSE_MODE_*</tt> in <tt>sbbsdefs.js</tt> for bit definitions)"
,"mouse mode bit-field (see <tt>MOUSE_MODE_*</tt> in <tt>sbbsdefs.js</tt> for bit definitions, "
"set to <tt>true</tt> for default enabled mode, <tt>false</tt> to disable)"
,"current 0-based line counter (used for automatic screen pause)"
,"current 0-based row counter"
,"current 0-based column counter (used to auto-increment <i>line_counter</i> when screen wraps)"
......
......@@ -903,6 +903,7 @@ public:
#define MOUSE_MODE_BTN (1<<2) // Button-event tracking mode mouse reporting
#define MOUSE_MODE_ANY (1<<3) // Any-event tracking mode mouse reporting
#define MOUSE_MODE_EXT (1<<4) // SGR-encoded extended coordinate mouse reporting
#define MOUSE_MODE_ON (MOUSE_MODE_NORM | MOUSE_MODE_EXT) // Default mouse "enabled" mode flags
long mouse_mode; // Mouse reporting mode flags
uint hot_attr; // Auto-Mouse hot-spot attribute (when non-zero)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment