• 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 #include "event_filter_service.h"
17 
18 #include <cstring>
19 
20 #include <sys/types.h>
21 #include <unistd.h>
22 
23 #include "string_ex.h"
24 
25 #include "mmi_log.h"
26 
27 namespace OHOS {
28 namespace MMI {
29 namespace {
30 constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, MMI_LOG_DOMAIN, "EventFilterService" };
31 } // namespace
32 
EventFilterService()33 EventFilterService::EventFilterService()
34 {
35     CALL_DEBUG_ENTER;
36 }
37 
~EventFilterService()38 EventFilterService::~EventFilterService()
39 {
40     CALL_DEBUG_ENTER;
41 }
42 
SetPointerEventPtr(std::function<bool (std::shared_ptr<PointerEvent>)> pointerFilter)43 void EventFilterService::SetPointerEventPtr(std::function<bool(std::shared_ptr<PointerEvent>)> pointerFilter)
44 {
45     pointerFilter_ = pointerFilter;
46 }
47 
HandlePointerEvent(const std::shared_ptr<PointerEvent> event)48 bool EventFilterService::HandlePointerEvent(const std::shared_ptr<PointerEvent> event)
49 {
50     CHKPF(pointerFilter_);
51     return pointerFilter_(event);
52 }
53 } // namespace MMI
54 } // namespace OHOS
55