• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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_INPUT_CHANNEL_H
17 #define OHOS_WINDOW_INPUT_CHANNEL_H
18 
19 #include <i_input_event_consumer.h>
20 #include <key_event.h>
21 #include "refbase.h"
22 #include "vsync_station.h"
23 #include "window.h"
24 
25 namespace OHOS {
26 namespace Rosen {
27 class WindowInputChannel final: public RefBase {
28 public:
29     explicit WindowInputChannel(const sptr<Window>& window);
30     virtual ~WindowInputChannel();
31     void HandlePointerEvent(std::shared_ptr<MMI::PointerEvent>& pointerEvent);
32     void HandleKeyEvent(std::shared_ptr<MMI::KeyEvent>& keyEvent);
33     void Destroy();
34     Rect GetWindowRect();
35 
36 private:
37     bool IsKeyboardEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) const;
38     void DispatchKeyEventCallback(std::shared_ptr<MMI::KeyEvent>& keyEvent, bool consumed);
39     std::mutex mtx_;
40     sptr<Window> window_;
41     bool isAvailable_;
42     static const int32_t MAX_INPUT_NUM = 100;
43 };
44 }
45 }
46 
47 
48 #endif // OHOS_WINDOW_INPUT_CHANNEL_H
49