mirror of
https://github.com/moonlight-stream/moonlight-chrome.git
synced 2025-08-17 16:46:31 +00:00
Only send mouse input to the PC when the mouse is locked
This commit is contained in:
parent
6a963f3e6d
commit
8713d261aa
13
input.cpp
13
input.cpp
@ -36,6 +36,7 @@ bool MoonlightInstance::HandleInputEvent(const pp::InputEvent& event) {
|
|||||||
|
|
||||||
// Assume it worked until we get a callback telling us otherwise
|
// Assume it worked until we get a callback telling us otherwise
|
||||||
m_MouseLocked = true;
|
m_MouseLocked = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pp::MouseInputEvent mouseEvent(event);
|
pp::MouseInputEvent mouseEvent(event);
|
||||||
@ -45,6 +46,10 @@ bool MoonlightInstance::HandleInputEvent(const pp::InputEvent& event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case PP_INPUTEVENT_TYPE_MOUSEMOVE: {
|
case PP_INPUTEVENT_TYPE_MOUSEMOVE: {
|
||||||
|
if (!m_MouseLocked) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
pp::MouseInputEvent mouseEvent(event);
|
pp::MouseInputEvent mouseEvent(event);
|
||||||
pp::Point posDelta = mouseEvent.GetMovement();
|
pp::Point posDelta = mouseEvent.GetMovement();
|
||||||
|
|
||||||
@ -53,6 +58,10 @@ bool MoonlightInstance::HandleInputEvent(const pp::InputEvent& event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case PP_INPUTEVENT_TYPE_MOUSEUP: {
|
case PP_INPUTEVENT_TYPE_MOUSEUP: {
|
||||||
|
if (!m_MouseLocked) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
pp::MouseInputEvent mouseEvent(event);
|
pp::MouseInputEvent mouseEvent(event);
|
||||||
|
|
||||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, ConvertPPButtonToLiButton(mouseEvent.GetButton()));
|
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, ConvertPPButtonToLiButton(mouseEvent.GetButton()));
|
||||||
@ -60,6 +69,10 @@ bool MoonlightInstance::HandleInputEvent(const pp::InputEvent& event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case PP_INPUTEVENT_TYPE_WHEEL: {
|
case PP_INPUTEVENT_TYPE_WHEEL: {
|
||||||
|
if (!m_MouseLocked) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
pp::WheelInputEvent wheelEvent(event);
|
pp::WheelInputEvent wheelEvent(event);
|
||||||
|
|
||||||
// FIXME: Handle fractional scroll ticks
|
// FIXME: Handle fractional scroll ticks
|
||||||
|
Loading…
x
Reference in New Issue
Block a user