working mouse
This commit is contained in:
@@ -2244,11 +2244,13 @@ var Input = (function() {
|
|||||||
if (b > 3 || b < 1) return;
|
if (b > 3 || b < 1) return;
|
||||||
var m = packModifiersForMouse();
|
var m = packModifiersForMouse();
|
||||||
Conn.send("p" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
Conn.send("p" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
||||||
|
console.log("B ",b," M ",m);
|
||||||
},
|
},
|
||||||
onMouseUp: function (x, y, b) {
|
onMouseUp: function (x, y, b) {
|
||||||
if (b > 3 || b < 1) return;
|
if (b > 3 || b < 1) return;
|
||||||
var m = packModifiersForMouse();
|
var m = packModifiersForMouse();
|
||||||
Conn.send("r" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
Conn.send("r" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
||||||
|
console.log("B ",b," M ",m);
|
||||||
},
|
},
|
||||||
onMouseWheel: function (x, y, dir) {
|
onMouseWheel: function (x, y, dir) {
|
||||||
// -1 ... btn 4 (away from user)
|
// -1 ... btn 4 (away from user)
|
||||||
@@ -2256,6 +2258,7 @@ var Input = (function() {
|
|||||||
var m = packModifiersForMouse();
|
var m = packModifiersForMouse();
|
||||||
var b = (dir < 0 ? 4 : 5);
|
var b = (dir < 0 ? 4 : 5);
|
||||||
Conn.send("p" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
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;
|
if (b > 3 || b < 1) return;
|
||||||
var m = packModifiersForMouse();
|
var m = packModifiersForMouse();
|
||||||
Conn.send("p" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
Conn.send("p" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
||||||
|
console.log("B ",b," M ",m);
|
||||||
},
|
},
|
||||||
onMouseUp: function (x, y, b) {
|
onMouseUp: function (x, y, b) {
|
||||||
if (b > 3 || b < 1) return;
|
if (b > 3 || b < 1) return;
|
||||||
var m = packModifiersForMouse();
|
var m = packModifiersForMouse();
|
||||||
Conn.send("r" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
Conn.send("r" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
||||||
|
console.log("B ",b," M ",m);
|
||||||
},
|
},
|
||||||
onMouseWheel: function (x, y, dir) {
|
onMouseWheel: function (x, y, dir) {
|
||||||
// -1 ... btn 4 (away from user)
|
// -1 ... btn 4 (away from user)
|
||||||
@@ -690,6 +692,7 @@ var Input = (function() {
|
|||||||
var m = packModifiersForMouse();
|
var m = packModifiersForMouse();
|
||||||
var b = (dir < 0 ? 4 : 5);
|
var b = (dir < 0 ? 4 : 5);
|
||||||
Conn.send("p" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
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 == 1005) mouse_tracking.encoding = yn ? MTE_UTF8 : MTE_SIMPLE;
|
||||||
else if (n == 1006) mouse_tracking.encoding = yn ? MTE_SGR : 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;
|
else if (n == 1015) mouse_tracking.encoding = yn ? MTE_URXVT : MTE_SIMPLE;
|
||||||
|
|
||||||
|
dbg("Mouse opt %d yesno %d", n, yn);
|
||||||
}
|
}
|
||||||
else if (n == 12) {
|
else if (n == 12) {
|
||||||
// TODO Cursor blink on/off
|
// TODO Cursor blink on/off
|
||||||
|
|||||||
+7
-3
@@ -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)
|
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 ctrl = (mods & 1) > 0;
|
||||||
bool shift = (mods & 2) > 0;
|
bool shift = (mods & 2) > 0;
|
||||||
bool alt = (mods & 4) > 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;
|
enum MTE mte = mouse_tracking.encoding;
|
||||||
|
|
||||||
// No message on release in X10 mode
|
// No message on release in X10 mode
|
||||||
if (mtm == MTM_X10 && button == 0) {
|
if (mtm == MTM_X10 && (button == 0 || evt == 'r')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +148,7 @@ void ICACHE_FLASH_ATTR sendMouseAction(char evt, int y, int x, int button, u8 mo
|
|||||||
int eventcode = 0;
|
int eventcode = 0;
|
||||||
|
|
||||||
if (mtm == MTM_X10) {
|
if (mtm == MTM_X10) {
|
||||||
eventcode = button;
|
eventcode = button-1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (button == 0 || (evt == 'r' && mte != MTE_SGR)) eventcode = 3; // release
|
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));
|
sprintf(buf, "\x1b[M%c%c%c", (u8)(32+eventcode), (u8)(32+x), (u8)(32+y));
|
||||||
}
|
}
|
||||||
else if (mte == MTE_SGR) {
|
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) {
|
else if (mte == MTE_URXVT) {
|
||||||
sprintf(buf, "\x1b[%d;%d;%dM", (u8)(32+eventcode), (u8)(32+x), (u8)(32+y));
|
sprintf(buf, "\x1b[%d;%d;%dM", (u8)(32+eventcode), (u8)(32+x), (u8)(32+y));
|
||||||
|
|||||||
+9
-9
@@ -81,18 +81,18 @@ extern TerminalConfigBundle * const termconf;
|
|||||||
extern TerminalConfigBundle termconf_scratch;
|
extern TerminalConfigBundle termconf_scratch;
|
||||||
|
|
||||||
enum MTM {
|
enum MTM {
|
||||||
MTM_NONE,
|
MTM_NONE = 0,
|
||||||
MTM_X10,
|
MTM_X10 = 1,
|
||||||
MTM_NORMAL,
|
MTM_NORMAL = 2,
|
||||||
MTM_BUTTON_MOTION,
|
MTM_BUTTON_MOTION = 3,
|
||||||
MTM_ANY_MOTION,
|
MTM_ANY_MOTION = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MTE {
|
enum MTE {
|
||||||
MTE_SIMPLE,
|
MTE_SIMPLE = 0,
|
||||||
MTE_UTF8,
|
MTE_UTF8 = 1,
|
||||||
MTE_SGR,
|
MTE_SGR = 2,
|
||||||
MTE_URXVT,
|
MTE_URXVT = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user