working mouse

pull/111/merge
Ondřej Hruška 7 years ago
parent 58ed6098c4
commit 7aa3cd7f75
  1. 3
      html_orig/js/app.js
  2. 3
      html_orig/jssrc/term.js
  3. 2
      user/apars_csi.c
  4. 10
      user/cgi_sockets.c
  5. 18
      user/screen.h

@ -2244,11 +2244,13 @@ var Input = (function() {
if (b > 3 || b < 1) return;
var m = packModifiersForMouse();
Conn.send("p" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
console.log("B ",b," M ",m);
},
onMouseUp: function (x, y, b) {
if (b > 3 || b < 1) return;
var m = packModifiersForMouse();
Conn.send("r" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
console.log("B ",b," M ",m);
},
onMouseWheel: function (x, y, dir) {
// -1 ... btn 4 (away from user)
@ -2256,6 +2258,7 @@ var Input = (function() {
var m = packModifiersForMouse();
var b = (dir < 0 ? 4 : 5);
Conn.send("p" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
console.log("B ",b," M ",m);
},
};
})();

@ -678,11 +678,13 @@ var Input = (function() {
if (b > 3 || b < 1) return;
var m = packModifiersForMouse();
Conn.send("p" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
console.log("B ",b," M ",m);
},
onMouseUp: function (x, y, b) {
if (b > 3 || b < 1) return;
var m = packModifiersForMouse();
Conn.send("r" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
console.log("B ",b," M ",m);
},
onMouseWheel: function (x, y, dir) {
// -1 ... btn 4 (away from user)
@ -690,6 +692,7 @@ var Input = (function() {
var m = packModifiersForMouse();
var b = (dir < 0 ? 4 : 5);
Conn.send("p" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
console.log("B ",b," M ",m);
},
};
})();

@ -469,6 +469,8 @@ static void ICACHE_FLASH_ATTR do_csi_privattr(CSI_Data *opts)
else if (n == 1005) mouse_tracking.encoding = yn ? MTE_UTF8 : MTE_SIMPLE;
else if (n == 1006) mouse_tracking.encoding = yn ? MTE_SGR : MTE_SIMPLE;
else if (n == 1015) mouse_tracking.encoding = yn ? MTE_URXVT : MTE_SIMPLE;
dbg("Mouse opt %d yesno %d", n, yn);
}
else if (n == 12) {
// TODO Cursor blink on/off

@ -121,6 +121,10 @@ void ICACHE_FLASH_ATTR screen_notifyChange(ScreenNotifyChangeTopic topic)
void ICACHE_FLASH_ATTR sendMouseAction(char evt, int y, int x, int button, u8 mods)
{
// one-based
x++;
y++;
bool ctrl = (mods & 1) > 0;
bool shift = (mods & 2) > 0;
bool alt = (mods & 4) > 0;
@ -129,7 +133,7 @@ void ICACHE_FLASH_ATTR sendMouseAction(char evt, int y, int x, int button, u8 mo
enum MTE mte = mouse_tracking.encoding;
// No message on release in X10 mode
if (mtm == MTM_X10 && button == 0) {
if (mtm == MTM_X10 && (button == 0 || evt == 'r')) {
return;
}
@ -144,7 +148,7 @@ void ICACHE_FLASH_ATTR sendMouseAction(char evt, int y, int x, int button, u8 mo
int eventcode = 0;
if (mtm == MTM_X10) {
eventcode = button;
eventcode = button-1;
}
else {
if (button == 0 || (evt == 'r' && mte != MTE_SGR)) eventcode = 3; // release
@ -174,7 +178,7 @@ void ICACHE_FLASH_ATTR sendMouseAction(char evt, int y, int x, int button, u8 mo
sprintf(buf, "\x1b[M%c%c%c", (u8)(32+eventcode), (u8)(32+x), (u8)(32+y));
}
else if (mte == MTE_SGR) {
sprintf(buf, "\x1b[%d;%d;%d%c", eventcode, x, y, evt == 'p' ? 'M' : 'm');
sprintf(buf, "\x1b[<%d;%d;%d%c", eventcode, x, y, evt == 'p' ? 'M' : 'm');
}
else if (mte == MTE_URXVT) {
sprintf(buf, "\x1b[%d;%d;%dM", (u8)(32+eventcode), (u8)(32+x), (u8)(32+y));

@ -81,18 +81,18 @@ extern TerminalConfigBundle * const termconf;
extern TerminalConfigBundle termconf_scratch;
enum MTM {
MTM_NONE,
MTM_X10,
MTM_NORMAL,
MTM_BUTTON_MOTION,
MTM_ANY_MOTION,
MTM_NONE = 0,
MTM_X10 = 1,
MTM_NORMAL = 2,
MTM_BUTTON_MOTION = 3,
MTM_ANY_MOTION = 4,
};
enum MTE {
MTE_SIMPLE,
MTE_UTF8,
MTE_SGR,
MTE_URXVT,
MTE_SIMPLE = 0,
MTE_UTF8 = 1,
MTE_SGR = 2,
MTE_URXVT = 3,
};
typedef struct {

Loading…
Cancel
Save