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