Allow for scroll wheel injection (#23)

* Working on proper resizing of AA

* allow for custom aspect ratios

* A mess of code to support sending input events from dash

* Restructuring input injection to be much nicer

* Code Cleanup

* Allow for scroll wheel injection
This commit is contained in:
Cole Brinsfield 2021-07-25 18:03:08 -07:00 committed by GitHub
parent 658005da61
commit efb9d8bc6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 8 deletions

View File

@ -38,7 +38,7 @@ class InputService:
public:
InputService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IInputDevice::Pointer inputDevice);
void sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode);
void sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode, projection::WheelDirection wheelDirection = projection::WheelDirection::NONE);
void start() override;
void stop() override;
void fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) override;

View File

@ -41,7 +41,7 @@ public:
void setOpacity(unsigned int alpha);
void resize();
void setNightMode(bool nightMode);
void sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode);
void sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode, projection::WheelDirection wheelDirection = projection::WheelDirection::NONE);
void sendKeyEvent(QKeyEvent* event);
static QRect mapActiveAreaToGlobal(QWidget* activeArea);
#ifdef USE_OMX

View File

@ -163,13 +163,20 @@ void InputService::onButtonEvent(const projection::ButtonEvent& event)
});
}
void InputService::sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode)
void InputService::sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode, projection::WheelDirection wheelDirection)
{
OPENAUTO_LOG(error) << "[InputService] injecting button press";
OPENAUTO_LOG(info) << "[InputService] injecting button press";
if(buttonCode == aasdk::proto::enums::ButtonCode::SCROLL_WHEEL)
{
onButtonEvent({projection::ButtonEventType::NONE, wheelDirection, buttonCode});
}
else
{
onButtonEvent({projection::ButtonEventType::PRESS, projection::WheelDirection::NONE, buttonCode});
onButtonEvent({projection::ButtonEventType::RELEASE, projection::WheelDirection::NONE, buttonCode});
}
}
void InputService::onTouchEvent(const projection::TouchEvent& event)
{

View File

@ -228,12 +228,12 @@ void ServiceFactory::setNightMode(bool nightMode)
}
}
void ServiceFactory::sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode)
void ServiceFactory::sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode, projection::WheelDirection wheelDirection)
{
if(std::shared_ptr<InputService> inputService = inputService_.lock())
{
inputService->sendButtonPress(buttonCode);
inputService->sendButtonPress(buttonCode, wheelDirection);
}
}