mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-11-04 13:38:14 +08:00 
			
		
		
		
	Parse mouse middle
This commit is contained in:
		@@ -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,
 | 
			
		||||
  };
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user