1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_WINDOW_SCENE_SESSION_WINDOW_EVENT_CHANNEL_INTERFACE_H 17 #define OHOS_WINDOW_SCENE_SESSION_WINDOW_EVENT_CHANNEL_INTERFACE_H 18 19 #include <iremote_broker.h> 20 #include <list> 21 #include <map> 22 23 #include "interfaces/include/ws_common.h" 24 25 namespace OHOS::MMI { 26 class PointerEvent; 27 class KeyEvent; 28 class AxisEvent; 29 } // namespace OHOS::MMI 30 namespace OHOS::Accessibility { 31 class AccessibilityElementInfo; 32 } 33 namespace OHOS::Rosen { 34 class IWindowEventChannelListener : public IRemoteBroker { 35 public: 36 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IWindowEventChannelListener"); 37 enum class WindowEventChannelListenerMessage : int32_t { 38 TRANS_ID_ON_TRANSFER_KEY_EVENT_FOR_CONSUMED_ASYNC, 39 }; 40 41 virtual void OnTransferKeyEventForConsumed(int32_t keyEventId, bool isPreImeEvent, 42 bool isConsumed, WSError retCode) = 0; 43 }; 44 45 class IWindowEventChannel : public IRemoteBroker { 46 public: 47 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IWindowEventChannel"); 48 49 virtual WSError TransferKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) = 0; 50 virtual WSError TransferPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) = 0; 51 52 // transfer sync key event for weather consumed 53 virtual WSError TransferBackpressedEventForConsumed(bool& isConsumed) = 0; 54 virtual WSError TransferKeyEventForConsumed(const std::shared_ptr<MMI::KeyEvent>& keyEvent, bool& isConsumed, 55 bool isPreImeEvent = false) = 0; 56 virtual WSError TransferKeyEventForConsumedAsync(const std::shared_ptr<MMI::KeyEvent>& keyEvent, bool isPreImeEvent, 57 const sptr<IRemoteObject>& listener) = 0; 58 virtual WSError TransferFocusActiveEvent(bool isFocusActive) = 0; 59 virtual WSError TransferFocusState(bool focusState) = 0; 60 virtual WSError TransferAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType, int32_t eventType, 61 int64_t timeMs) = 0; 62 virtual WSError TransferAccessibilityChildTreeRegister( 63 uint32_t windowId, int32_t treeId, int64_t accessibilityId) = 0; 64 virtual WSError TransferAccessibilityChildTreeUnregister() = 0; 65 virtual WSError TransferAccessibilityDumpChildInfo( 66 const std::vector<std::string>& params, std::vector<std::string>& info) = 0; 67 }; 68 } // namespace OHOS::Rosen 69 #endif // OHOS_WINDOW_SCENE_SESSION_WINDOW_EVENT_CHANNEL_INTERFACE_H 70