mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-26 04:31:34 +08:00
Parse mouse middle
This commit is contained in:
parent
cbd13499ae
commit
d685a8655e
@ -41,6 +41,14 @@ class DrawKey : public Component {
|
||||
code += L"mouse_left_move(" + //
|
||||
std::to_wstring(keys[i].mouse_x()) + L"," +
|
||||
std::to_wstring(keys[i].mouse_y()) + L")";
|
||||
} else if (keys[i].is_mouse_middle_down()) {
|
||||
code += L"mouse_middle_down(" + //
|
||||
std::to_wstring(keys[i].mouse_x()) + L"," +
|
||||
std::to_wstring(keys[i].mouse_y()) + L")";
|
||||
} else if (keys[i].is_mouse_middle_move()) {
|
||||
code += L"mouse_middle_move(" + //
|
||||
std::to_wstring(keys[i].mouse_x()) + L"," +
|
||||
std::to_wstring(keys[i].mouse_y()) + L")";
|
||||
} else if (keys[i].is_mouse_right_down()) {
|
||||
code += L"mouse_right_down(" + //
|
||||
std::to_wstring(keys[i].mouse_x()) + L"," +
|
||||
|
@ -32,6 +32,8 @@ struct Event {
|
||||
static Event MouseUp(std::string, int x, int y);
|
||||
static Event MouseLeftMove(std::string, int x, int y);
|
||||
static Event MouseLeftDown(std::string, int x, int y);
|
||||
static Event MouseMiddleMove(std::string, int x, int y);
|
||||
static Event MouseMiddleDown(std::string, int x, int y);
|
||||
static Event MouseRightMove(std::string, int x, int y);
|
||||
static Event MouseRightDown(std::string, int x, int y);
|
||||
|
||||
@ -59,6 +61,8 @@ struct Event {
|
||||
|
||||
bool is_mouse_left_down() const { return type_ == Type::MouseLeftDown; }
|
||||
bool is_mouse_left_move() const { return type_ == Type::MouseLeftMove; }
|
||||
bool is_mouse_middle_down() const { return type_ == Type::MouseMiddleDown; }
|
||||
bool is_mouse_middle_move() const { return type_ == Type::MouseMiddleMove; }
|
||||
bool is_mouse_right_down() const { return type_ == Type::MouseRightDown; }
|
||||
bool is_mouse_right_move() const { return type_ == Type::MouseRightMove; }
|
||||
bool is_mouse_up() const { return type_ == Type::MouseUp; }
|
||||
@ -79,6 +83,8 @@ struct Event {
|
||||
MouseUp,
|
||||
MouseLeftDown,
|
||||
MouseLeftMove,
|
||||
MouseMiddleDown,
|
||||
MouseMiddleMove,
|
||||
MouseRightDown,
|
||||
MouseRightMove,
|
||||
};
|
||||
|
@ -73,6 +73,22 @@ Event Event::MouseRightDown(std::string input, int x, int y) {
|
||||
return event;
|
||||
}
|
||||
|
||||
// static
|
||||
Event Event::MouseMiddleMove(std::string input, int x, int y) {
|
||||
Event event;
|
||||
event.input_ = std::move(input);
|
||||
event.type_ = Type::MouseMiddleMove;
|
||||
event.mouse_ = {x, y};
|
||||
return event;
|
||||
}
|
||||
|
||||
// static
|
||||
Event Event::Special(std::string input) {
|
||||
Event event;
|
||||
event.input_ = std::move(input);
|
||||
return event;
|
||||
}
|
||||
|
||||
// static
|
||||
Event Event::MouseRightMove(std::string input, int x, int y) {
|
||||
Event event;
|
||||
@ -83,9 +99,11 @@ Event Event::MouseRightMove(std::string input, int x, int y) {
|
||||
}
|
||||
|
||||
// static
|
||||
Event Event::Special(std::string input) {
|
||||
Event Event::MouseMiddleDown(std::string input, int x, int y) {
|
||||
Event event;
|
||||
event.input_ = std::move(input);
|
||||
event.type_ = Type::MouseMiddleDown;
|
||||
event.mouse_ = {x, y};
|
||||
return event;
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,16 @@ void TerminalInputParser::Send(TerminalInputParser::Output output) {
|
||||
output.mouse.y));
|
||||
break;
|
||||
|
||||
case MOUSE_MIDDLE_DOWN:
|
||||
out_->Send(Event::MouseMiddleDown(std::move(pending_), output.mouse.x,
|
||||
output.mouse.y));
|
||||
break;
|
||||
|
||||
case MOUSE_MIDDLE_MOVE:
|
||||
out_->Send(Event::MouseMiddleMove(std::move(pending_), output.mouse.x,
|
||||
output.mouse.y));
|
||||
break;
|
||||
|
||||
case MOUSE_RIGHT_DOWN:
|
||||
out_->Send(Event::MouseRightDown(std::move(pending_), output.mouse.x,
|
||||
output.mouse.y));
|
||||
@ -211,6 +221,11 @@ TerminalInputParser::Output TerminalInputParser::ParseMouse(
|
||||
case 64:
|
||||
return Output(MOUSE_LEFT_MOVE, arguments[1], arguments[2]);
|
||||
|
||||
case 33:
|
||||
return Output(MOUSE_MIDDLE_DOWN, arguments[1], arguments[2]);
|
||||
case 65:
|
||||
return Output(MOUSE_MIDDLE_MOVE, arguments[1], arguments[2]);
|
||||
|
||||
case 34:
|
||||
return Output(MOUSE_RIGHT_DOWN, arguments[1], arguments[2]);
|
||||
case 66:
|
||||
|
@ -28,6 +28,8 @@ class TerminalInputParser {
|
||||
MOUSE_MOVE,
|
||||
MOUSE_LEFT_DOWN,
|
||||
MOUSE_LEFT_MOVE,
|
||||
MOUSE_MIDDLE_DOWN,
|
||||
MOUSE_MIDDLE_MOVE,
|
||||
MOUSE_RIGHT_DOWN,
|
||||
MOUSE_RIGHT_MOVE,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user