2018-03-16 23:28:19 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "mozilla/layers/APZInputBridgeParent.h"
|
|
|
|
|
2018-03-16 23:28:19 +03:00
|
|
|
#include "mozilla/layers/APZInputBridge.h"
|
2018-03-16 23:28:19 +03:00
|
|
|
#include "mozilla/layers/CompositorBridgeParent.h"
|
|
|
|
#include "mozilla/layers/IAPZCTreeManager.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2018-03-25 02:06:01 +03:00
|
|
|
APZInputBridgeParent::APZInputBridgeParent(const LayersId& aLayersId) {
|
2018-03-16 23:28:19 +03:00
|
|
|
MOZ_ASSERT(XRE_IsGPUProcess());
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
|
|
|
|
mTreeManager = CompositorBridgeParent::GetAPZCTreeManager(aLayersId);
|
|
|
|
MOZ_ASSERT(mTreeManager);
|
|
|
|
}
|
|
|
|
|
2020-03-04 18:39:20 +03:00
|
|
|
APZInputBridgeParent::~APZInputBridgeParent() = default;
|
2018-03-16 23:28:19 +03:00
|
|
|
|
2018-03-16 23:28:19 +03:00
|
|
|
mozilla::ipc::IPCResult APZInputBridgeParent::RecvReceiveMultiTouchInputEvent(
|
2019-09-19 05:45:21 +03:00
|
|
|
const MultiTouchInput& aEvent, APZEventResult* aOutResult,
|
|
|
|
MultiTouchInput* aOutEvent) {
|
2018-03-16 23:28:19 +03:00
|
|
|
MultiTouchInput event = aEvent;
|
|
|
|
|
2019-09-19 05:45:21 +03:00
|
|
|
*aOutResult = mTreeManager->InputBridge()->ReceiveInputEvent(event);
|
2018-03-16 23:28:19 +03:00
|
|
|
*aOutEvent = event;
|
|
|
|
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult APZInputBridgeParent::RecvReceiveMouseInputEvent(
|
2019-09-19 05:45:21 +03:00
|
|
|
const MouseInput& aEvent, APZEventResult* aOutResult,
|
|
|
|
MouseInput* aOutEvent) {
|
2018-03-16 23:28:19 +03:00
|
|
|
MouseInput event = aEvent;
|
|
|
|
|
2019-09-19 05:45:21 +03:00
|
|
|
*aOutResult = mTreeManager->InputBridge()->ReceiveInputEvent(event);
|
2018-03-16 23:28:19 +03:00
|
|
|
*aOutEvent = event;
|
|
|
|
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult APZInputBridgeParent::RecvReceivePanGestureInputEvent(
|
2019-09-19 05:45:21 +03:00
|
|
|
const PanGestureInput& aEvent, APZEventResult* aOutResult,
|
|
|
|
PanGestureInput* aOutEvent) {
|
2018-03-16 23:28:19 +03:00
|
|
|
PanGestureInput event = aEvent;
|
|
|
|
|
2019-09-19 05:45:21 +03:00
|
|
|
*aOutResult = mTreeManager->InputBridge()->ReceiveInputEvent(event);
|
2018-03-16 23:28:19 +03:00
|
|
|
*aOutEvent = event;
|
|
|
|
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult APZInputBridgeParent::RecvReceivePinchGestureInputEvent(
|
2019-09-19 05:45:21 +03:00
|
|
|
const PinchGestureInput& aEvent, APZEventResult* aOutResult,
|
|
|
|
PinchGestureInput* aOutEvent) {
|
2018-03-16 23:28:19 +03:00
|
|
|
PinchGestureInput event = aEvent;
|
|
|
|
|
2019-09-19 05:45:21 +03:00
|
|
|
*aOutResult = mTreeManager->InputBridge()->ReceiveInputEvent(event);
|
2018-03-16 23:28:19 +03:00
|
|
|
*aOutEvent = event;
|
|
|
|
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult APZInputBridgeParent::RecvReceiveTapGestureInputEvent(
|
2019-09-19 05:45:21 +03:00
|
|
|
const TapGestureInput& aEvent, APZEventResult* aOutResult,
|
|
|
|
TapGestureInput* aOutEvent) {
|
2018-03-16 23:28:19 +03:00
|
|
|
TapGestureInput event = aEvent;
|
|
|
|
|
2019-09-19 05:45:21 +03:00
|
|
|
*aOutResult = mTreeManager->InputBridge()->ReceiveInputEvent(event);
|
2018-03-16 23:28:19 +03:00
|
|
|
*aOutEvent = event;
|
|
|
|
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult APZInputBridgeParent::RecvReceiveScrollWheelInputEvent(
|
2019-09-19 05:45:21 +03:00
|
|
|
const ScrollWheelInput& aEvent, APZEventResult* aOutResult,
|
|
|
|
ScrollWheelInput* aOutEvent) {
|
2018-03-16 23:28:19 +03:00
|
|
|
ScrollWheelInput event = aEvent;
|
|
|
|
|
2019-09-19 05:45:21 +03:00
|
|
|
*aOutResult = mTreeManager->InputBridge()->ReceiveInputEvent(event);
|
2018-03-16 23:28:19 +03:00
|
|
|
*aOutEvent = event;
|
|
|
|
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult APZInputBridgeParent::RecvReceiveKeyboardInputEvent(
|
2019-09-19 05:45:21 +03:00
|
|
|
const KeyboardInput& aEvent, APZEventResult* aOutResult,
|
|
|
|
KeyboardInput* aOutEvent) {
|
2018-03-16 23:28:19 +03:00
|
|
|
KeyboardInput event = aEvent;
|
|
|
|
|
2019-09-19 05:45:21 +03:00
|
|
|
*aOutResult = mTreeManager->InputBridge()->ReceiveInputEvent(event);
|
2018-03-16 23:28:19 +03:00
|
|
|
*aOutEvent = event;
|
|
|
|
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult APZInputBridgeParent::RecvUpdateWheelTransaction(
|
|
|
|
const LayoutDeviceIntPoint& aRefPoint, const EventMessage& aEventMessage) {
|
|
|
|
mTreeManager->InputBridge()->UpdateWheelTransaction(aRefPoint, aEventMessage);
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult APZInputBridgeParent::RecvProcessUnhandledEvent(
|
|
|
|
const LayoutDeviceIntPoint& aRefPoint, LayoutDeviceIntPoint* aOutRefPoint,
|
2019-02-27 19:15:07 +03:00
|
|
|
ScrollableLayerGuid* aOutTargetGuid, uint64_t* aOutFocusSequenceNumber,
|
|
|
|
LayersId* aOutLayersId) {
|
2018-03-16 23:28:19 +03:00
|
|
|
LayoutDeviceIntPoint refPoint = aRefPoint;
|
2019-02-27 19:15:07 +03:00
|
|
|
mTreeManager->InputBridge()->ProcessUnhandledEvent(
|
|
|
|
&refPoint, aOutTargetGuid, aOutFocusSequenceNumber, aOutLayersId);
|
2018-03-16 23:28:19 +03:00
|
|
|
*aOutRefPoint = refPoint;
|
|
|
|
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2018-03-16 23:28:19 +03:00
|
|
|
void APZInputBridgeParent::ActorDestroy(ActorDestroyReason aWhy) {
|
|
|
|
// We shouldn't need it after this
|
|
|
|
mTreeManager = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|