diff --git a/README.md b/README.md index dc90a3ba36..7070bb035e 100644 --- a/README.md +++ b/README.md @@ -193,106 +193,6 @@ The dependent APIs include the following:

Rotates the current window.

-

RegistPointerButtonCb

- -

Registers the callback for Button events of the mouse.

- - -

RegistPointerEnterCb

- -

Registers the callback for Enter events of the mouse.

- - -

RegistPointerLeaveCb

- -

Registers the callback for Leave events of the mouse.

- - -

RegistPointerMotionCb

- -

Registers the callback for Motion events of the mouse.

- - -

RegistPointerAxisDiscreteCb

- -

Registers the callback for AxisDiscrete events of the mouse.

- - -

RegistPointerAxisSourceCb

- -

Registers the callback for AxisSource events of the mouse.

- - -

RegistPointerAxisStopCb

- -

Registers the callback for AxisStop events of the mouse.

- - -

RegistPointerAxisCb

- -

Registers the callback for Axis events of the mouse.

- - -

RegistTouchUpCb

- -

Registers the callback for TouchUp events.

- - -

RegistTouchDownCb

- -

Registers the callback for TouchDown events.

- - -

RegistTouchEmotionCb

- -

Registers the callback for TouchEmotion events.

- - -

RegistTouchFrameCb

- -

Registers the callback for TouchFrame events.

- - -

RegistTouchCancelCb

- -

Registers the callback for TouchCancel events.

- - -

RegistTouchShapeCb

- -

Registers the callback for TouchShape events.

- - -

RegistTouchOrientationCb

- -

Registers the callback for TouchOrientation events.

- - -

RegistKeyboardKeyCb

- -

Registers the callback for Key events of the keyboard.

- - -

RegistKeyboardKeyMapCb

- -

Registers the callback for KeyMap events of the keyboard.

- - -

RegistKeyboardLeaveCb

- -

Registers the callback for Leave events of the keyboard.

- - -

RegistKeyboardEnterCb

- -

Registers the callback for Enter events of the keyboard.

- - -

RegistKeyboardRepeatInfoCb

- -

Registers the callback for RepeatInfo events of the keyboard.

- - diff --git a/README_zh.md b/README_zh.md index 1a1a4e28dc..30aeb513a5 100644 --- a/README_zh.md +++ b/README_zh.md @@ -102,26 +102,6 @@ foundation/graphic/standard/ | ChangeWindowType | 更改当前窗口类型 | | ReSize | 调整当前窗口至指定大小 | | Rotate | 旋转当前窗口 | -| RegistPointerButtonCb | 注册鼠标Button事件回调 | -| RegistPointerEnterCb | 注册鼠标Enter事件回调 | -| RegistPointerLeaveCb | 注册鼠标Leave事件回调 | -| RegistPointerMotionCb | 注册鼠标Motion事件回调 | -| RegistPointerAxisDiscreteCb | 注册鼠标AxisDiscrete事件回调 | -| RegistPointerAxisSourceCb | 注册鼠标AxisSource事件回调 | -| RegistPointerAxisStopCb | 注册鼠标AxisStop事件回调 | -| RegistPointerAxisCb | 注册鼠标Axis事件回调 | -| RegistTouchUpCb | 注册TouchUp事件回调 | -| RegistTouchDownCb | 注册TouchDown事件回调 | -| RegistTouchEmotionCb | 注册TouchEmotion事件回调 | -| RegistTouchFrameCb | 注册TouchFrame事件回调 | -| RegistTouchCancelCb | 注册TouchCancel事件回调 | -| RegistTouchShapeCb | 注册TouchShape事件回调 | -| RegistTouchOrientationCb | 注册TouchOrientation事件回调 | -| RegistKeyboardKeyCb | 注册键盘Key事件回调 | -| RegistKeyboardKeyMapCb | 注册键盘KeyMap事件回调 | -| RegistKeyboardLeaveCb | 注册键盘Leave事件回调 | -| RegistKeyboardEnterCb | 注册键盘Enter事件回调 | -| RegistKeyboardRepeatInfoCb | 注册键盘RepeatInfo事件回调 | ### SubWindow | 接口名 | 职责 | diff --git a/frameworks/wm/BUILD.gn b/frameworks/wm/BUILD.gn index baf2554f15..5656aca759 100644 --- a/frameworks/wm/BUILD.gn +++ b/frameworks/wm/BUILD.gn @@ -43,8 +43,6 @@ ohos_shared_library("wms_client") { "src/client/video_window.cpp", "src/client/window_manager.cpp", "src/client/window_manager_controller_client.cpp", - "src/input_listener_manager.cpp", - "src/log_listener.cpp", "src/singleton_container.cpp", "src/tester.cpp", "src/wayland_service.cpp", @@ -75,10 +73,6 @@ ohos_shared_library("wms_client") { "//developtools/bytrace_standard/interfaces/innerkits/native:bytrace_core", "//foundation/graphic/standard:libwmservice", "//foundation/graphic/standard/frameworks/wmserver:wms_protocol", - "//third_party/wayland-ivi-extension:libilmClient", - "//third_party/wayland-ivi-extension:libilmCommon", - "//third_party/wayland-ivi-extension:libilmControl", - "//third_party/wayland-ivi-extension:libilmInput", "//third_party/wayland-protocols_standard:linux_dmabuf_unstable_v1_protocol", "//third_party/wayland-protocols_standard:linux_explicit_synchronization_unstable_v1_protocol", "//third_party/wayland-protocols_standard:viewporter_protocol", @@ -139,8 +133,6 @@ config("libwmclient_public_config") { ohos_shared_library("libwmclient") { sources = [ - "src/input_listener_manager.cpp", - "src/log_listener.cpp", "src/singleton_container.cpp", "src/static_call.cpp", "src/subwindow_normal_impl.cpp", @@ -181,10 +173,6 @@ ohos_shared_library("libwmclient") { "//developtools/bytrace_standard/interfaces/innerkits/native:bytrace_core", "//foundation/graphic/standard:libwmservice", "//foundation/graphic/standard/frameworks/wmserver:wms_protocol", - "//third_party/wayland-ivi-extension:libilmClient", - "//third_party/wayland-ivi-extension:libilmCommon", - "//third_party/wayland-ivi-extension:libilmControl", - "//third_party/wayland-ivi-extension:libilmInput", "//third_party/wayland-protocols_standard:linux_dmabuf_unstable_v1_protocol", "//third_party/wayland-protocols_standard:linux_explicit_synchronization_unstable_v1_protocol", "//third_party/wayland-protocols_standard:viewporter_protocol", diff --git a/frameworks/wm/include/client/window_manager_controller_client.h b/frameworks/wm/include/client/window_manager_controller_client.h index be61969f63..bf8ae53dc9 100755 --- a/frameworks/wm/include/client/window_manager_controller_client.h +++ b/frameworks/wm/include/client/window_manager_controller_client.h @@ -24,8 +24,6 @@ #include #include -#include "input_listener_manager.h" -#include "log_listener.h" #include "wayland_service.h" #include "window_manager_server.h" #include "wl_buffer_cache.h" @@ -56,7 +54,6 @@ struct InnerWindowInfo { int32_t pos_y; funcWindowInfoChange windowInfoChangeCb; void (* onWindowCreateCb)(uint32_t pid); - sptr logListener; bool operator ==(const InnerWindowInfo &other) const { diff --git a/frameworks/wm/include/input_listener_manager.h b/frameworks/wm/include/input_listener_manager.h deleted file mode 100644 index a21a3b1636..0000000000 --- a/frameworks/wm/include/input_listener_manager.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef FRAMEWORKS_WM_INCLUDE_INPUT_LISTENER_MANAGER_H -#define FRAMEWORKS_WM_INCLUDE_INPUT_LISTENER_MANAGER_H - -#include -#include - -#include -#include -#include - -#include "singleton_delegator.h" -#include "wayland_service.h" - -namespace OHOS { -class InputListenerManager; -class InputListener : public RefBase { - friend class InputListenerManager; - -public: - PointerEnterFunc pointerEnter = nullptr; - PointerLeaveFunc pointerLeave = nullptr; - PointerMotionFunc pointerMotion = nullptr; - PointerButtonFunc pointerButton = nullptr; - PointerFrameFunc pointerFrame = nullptr; - PointerAxisFunc pointerAxis = nullptr; - PointerAxisSourceFunc pointerAxisSource = nullptr; - PointerAxisStopFunc pointerAxisStop = nullptr; - PointerAxisDiscreteFunc pointerAxisDiscrete = nullptr; - - KeyboardKeymapFunc keyboardKeymap = nullptr; - KeyboardEnterFunc keyboardEnter = nullptr; - KeyboardLeaveFunc keyboardLeave = nullptr; - KeyboardKeyFunc keyboardKey = nullptr; - KeyboardModifiersFunc keyboardModifiers = nullptr; - KeyboardRepeatInfoFunc keyboardRepeatInfo = nullptr; - - TouchDownFunc touchDown = nullptr; - TouchUpFunc touchUp = nullptr; - TouchMotionFunc touchMotion = nullptr; - TouchFrameFunc touchFrame = nullptr; - TouchCancelFunc touchCancel = nullptr; - TouchShapeFunc touchShape = nullptr; - TouchOrientationFunc touchOrientation = nullptr; - - void *GetWindow() const - { - return window; - } -private: - InputListener(void *w); - ~InputListener() = default; - - void *window; -}; - -struct Seat { - struct wl_seat *seat; - struct wl_pointer *pointer; - struct wl_keyboard *keyboard; - struct wl_touch *touch; -}; - -using InputListeners = std::vector>; - -class InputListenerManager : public RefBase { -public: - static sptr GetInstance(); - - MOCKABLE void Init(); - MOCKABLE void Deinit(); - - MOCKABLE sptr AddListener(void *window); - MOCKABLE void RemoveListener(sptr &listener); - -protected: - InputListeners GetFocus(); - InputListeners GetInputCallback(void *window); - void SetFocus(void *window); - - std::map inputListenersMap; - void *focus = nullptr; - -private: - InputListenerManager() = default; - MOCKABLE ~InputListenerManager() override; - static inline sptr instance = nullptr; - static inline SingletonDelegator delegator; - - static void OnAppear(const GetServiceFunc get, const std::string &iname, uint32_t ver); - static inline std::vector seats; - static uint32_t FindSeatNum(struct wl_seat *seat); - - static inline void SeatHandleCapabilities(void *, struct wl_seat *, uint32_t caps); - static inline void RegisterPointerListener(uint32_t caps, struct wl_seat *seat); - static inline void RegisterKeyboardListener(uint32_t caps, struct wl_seat *seat); - static inline void RegisterTouchListener(uint32_t caps, struct wl_seat *seat); -}; -} // namespace OHOS - -#endif // FRAMEWORKS_WM_INCLUDE_INPUT_LISTENER_MANAGER_H diff --git a/frameworks/wm/include/log_listener.h b/frameworks/wm/include/log_listener.h deleted file mode 100644 index 71f419da1f..0000000000 --- a/frameworks/wm/include/log_listener.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef FRAMEWORKS_WM_INCLUDE_LOG_LISTENER_H -#define FRAMEWORKS_WM_INCLUDE_LOG_LISTENER_H - -#include "input_listener_manager.h" - -#include "singleton_delegator.h" - -namespace OHOS { -class LogListener : public RefBase { -public: - static sptr GetInstance(); - - MOCKABLE sptr AddListener(void *window); - MOCKABLE void RemoveListener(sptr &listener); - -private: - LogListener() = default; - MOCKABLE ~LogListener() = default; - static inline sptr instance = nullptr; - static inline SingletonDelegator delegator; - - void PointerHandleEnter(void *data, uint32_t serial, double x, double y); - void PointerHandleLeave(void *data, uint32_t serial); - void PointerHandleMotion(void *data, uint32_t time, double x, double y); - void PointerHandleButton(void *data, - uint32_t serial, uint32_t time, uint32_t button, PointerButtonState state); - void PointerHandleFrame(void *data); - void PointerHandleAxis(void *data, uint32_t time, PointerAxis axis, double value); - void PointerHandleAxisSource(void *data, PointerAxisSource axisSource); - void PointerHandleAxisStop(void *data, uint32_t time, PointerAxis axis); - void PointerHandleAxisDiscrete(void *data, PointerAxis axis, int32_t discrete); - void KeyboardHandleKeyMap(void *data, KeyboardKeymapFormat format, int32_t fd, uint32_t size); - void KeyboardHandleEnter(void *data, uint32_t serial, const std::vector &keys); - void KeyboardHandleLeave(void *data, uint32_t serial); - void KeyboardHandleKey(void *data, - uint32_t serial, uint32_t time, uint32_t key, KeyboardKeyState state); - void KeyboardHandleModifiers(void *data, - uint32_t serial, uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group); - void KeyboardHandleRepeatInfo(void *data, int32_t rate, int32_t delay); - void TouchHandleDown(void *data, uint32_t serial, uint32_t time, int32_t id, double x, double y); - void TouchHandleUp(void *data, uint32_t serial, uint32_t time, int32_t id); - void TouchHandleMotion(void *data, uint32_t time, int32_t id, double x, double y); - void TouchHandleFrame(void *data); - void TouchHandleCancel(void *data); - void TouchHandleShape(void *data, int32_t id, double major, double minor); - void TouchHandleOrientation(void *data, int32_t id, double orientation); -}; -} // namespace OHOS - -#endif // FRAMEWORKS_WM_INCLUDE_LOG_LISTENER_H diff --git a/frameworks/wm/include/window_impl.h b/frameworks/wm/include/window_impl.h index 2702408439..80b2cc0891 100644 --- a/frameworks/wm/include/window_impl.h +++ b/frameworks/wm/include/window_impl.h @@ -22,7 +22,6 @@ #include -#include "log_listener.h" #include "wl_surface.h" #include "window_attribute.h" #include "window_option_impl.h" @@ -72,34 +71,6 @@ public: virtual GSError OnTouch(OnTouchFunc cb) override; virtual GSError OnKey(OnKeyFunc cb) override; - // pointer listener - virtual GSError OnPointerEnter(PointerEnterFunc func) override; - virtual GSError OnPointerLeave(PointerLeaveFunc func) override; - virtual GSError OnPointerMotion(PointerMotionFunc func) override; - virtual GSError OnPointerButton(PointerButtonFunc func) override; - virtual GSError OnPointerFrame(PointerFrameFunc func) override; - virtual GSError OnPointerAxis(PointerAxisFunc func) override; - virtual GSError OnPointerAxisSource(PointerAxisSourceFunc func) override; - virtual GSError OnPointerAxisStop(PointerAxisStopFunc func) override; - virtual GSError OnPointerAxisDiscrete(PointerAxisDiscreteFunc func) override; - - // keyboard listener - virtual GSError OnKeyboardKeymap(KeyboardKeymapFunc func) override; - virtual GSError OnKeyboardEnter(KeyboardEnterFunc func) override; - virtual GSError OnKeyboardLeave(KeyboardLeaveFunc func) override; - virtual GSError OnKeyboardKey(KeyboardKeyFunc func) override; - virtual GSError OnKeyboardModifiers(KeyboardModifiersFunc func) override; - virtual GSError OnKeyboardRepeatInfo(KeyboardRepeatInfoFunc func) override; - - // touch listener - virtual GSError OnTouchDown(TouchDownFunc func) override; - virtual GSError OnTouchUp(TouchUpFunc func) override; - virtual GSError OnTouchMotion(TouchMotionFunc func) override; - virtual GSError OnTouchFrame(TouchFrameFunc func) override; - virtual GSError OnTouchCancel(TouchCancelFunc func) override; - virtual GSError OnTouchShape(TouchShapeFunc func) override; - virtual GSError OnTouchOrientation(TouchOrientationFunc func) override; - private: WindowImpl() = default; virtual ~WindowImpl() override; @@ -127,8 +98,6 @@ private: sptr csurface = nullptr; sptr psurface = nullptr; - sptr logListener = nullptr; - sptr exportListener = nullptr; BeforeFrameSubmitFunc onBeforeFrameSubmitFunc = nullptr; }; } // namespace OHOS diff --git a/frameworks/wm/include/window_manager_impl.h b/frameworks/wm/include/window_manager_impl.h index 7f6fa2a657..f870c01f24 100644 --- a/frameworks/wm/include/window_manager_impl.h +++ b/frameworks/wm/include/window_manager_impl.h @@ -23,7 +23,6 @@ #include -#include "input_listener_manager.h" #include "singleton_delegator.h" #include "wayland_service.h" #include "window_manager_server.h" @@ -76,7 +75,6 @@ private: std::vector windowCache; sptr display = nullptr; - sptr inputListenerManager = nullptr; sptr wlBufferCache = nullptr; sptr wlDMABufferFactory = nullptr; sptr wlSHMBufferFactory = nullptr; diff --git a/frameworks/wm/src/client/window_manager_controller_client.cpp b/frameworks/wm/src/client/window_manager_controller_client.cpp index e0883933d2..7ccb97ab0a 100755 --- a/frameworks/wm/src/client/window_manager_controller_client.cpp +++ b/frameworks/wm/src/client/window_manager_controller_client.cpp @@ -64,7 +64,6 @@ bool LayerControllerClient::init(sptr &service) } wms = service; - InputListenerManager::GetInstance()->Init(); WlDMABufferFactory::GetInstance()->Init(); WlSHMBufferFactory::GetInstance()->Init(); WlSurfaceFactory::GetInstance()->Init(); diff --git a/frameworks/wm/src/input_listener_manager.cpp b/frameworks/wm/src/input_listener_manager.cpp deleted file mode 100644 index 8cde4a56e1..0000000000 --- a/frameworks/wm/src/input_listener_manager.cpp +++ /dev/null @@ -1,560 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "input_listener_manager.h" - -#include - -#include - -namespace OHOS { -namespace { -std::function g_getFocus = []() { return InputListeners(); }; -std::function g_getInputCallback = [](void *) { return InputListeners(); }; -std::function g_setFocus = [](void *) {}; -} - -InputListener::InputListener(void *w) -{ - window = w; -} - -void InputListenerManager::Init() -{ - delegator.Dep()->OnAppear(&InputListenerManager::OnAppear); - auto instance = SingletonContainer::Get(); - g_getFocus = std::bind(&InputListenerManager::GetFocus, instance); - g_getInputCallback = std::bind(&InputListenerManager::GetInputCallback, instance, std::placeholders::_1); - g_setFocus = std::bind(&InputListenerManager::SetFocus, instance, std::placeholders::_1); -} - -void InputListenerManager::Deinit() -{ - while (!seats.empty()) { - if (seats.back().seat != nullptr) { - wl_seat_destroy(seats.back().seat); - seats.back().seat = nullptr; - } - - if (seats.back().pointer != nullptr) { - wl_pointer_destroy(seats.back().pointer); - seats.back().pointer = nullptr; - } - - if (seats.back().keyboard != nullptr) { - wl_keyboard_destroy(seats.back().keyboard); - seats.back().keyboard = nullptr; - } - - if (seats.back().touch != nullptr) { - wl_touch_destroy(seats.back().touch); - seats.back().touch = nullptr; - } - seats.pop_back(); - } - - g_getFocus = []() { return InputListeners(); }; - g_getInputCallback = [](void *) { return InputListeners(); }; - g_setFocus = [](void *) {}; -} - -InputListenerManager::~InputListenerManager() -{ - Deinit(); -} - -sptr InputListenerManager::GetInstance() -{ - if (instance == nullptr) { - static std::mutex mutex; - std::lock_guard lock(mutex); - if (instance == nullptr) { - instance = new InputListenerManager(); - } - } - return instance; -} - -sptr InputListenerManager::AddListener(void *window) -{ - sptr listener = new InputListener(window); - if (listener == nullptr) { - return nullptr; - } - if (inputListenersMap.find(window) == inputListenersMap.end()) { - inputListenersMap[window] = std::vector>(); - } - inputListenersMap[window].push_back(listener); - return listener; -} - -void InputListenerManager::RemoveListener(sptr &listener) -{ - if (listener == nullptr) { - return; - } - auto &v = inputListenersMap[listener->GetWindow()]; - auto match = [&listener](const auto &l) { - return listener == l; - }; - auto it = std::find_if(v.begin(), v.end(), match); - if (it != v.end()) { - v.erase(it); - } - if (v.empty()) { - inputListenersMap.erase(listener->GetWindow()); - } -} - -InputListeners InputListenerManager::GetFocus() -{ - return GetInputCallback(focus); -} - -void InputListenerManager::SetFocus(void *window) -{ - focus = window; -} - -InputListeners InputListenerManager::GetInputCallback(void *window) -{ - static InputListeners nullInputCallback; - if (inputListenersMap.find(window) == inputListenersMap.end()) { - return nullInputCallback; - } - return inputListenersMap[window]; -} - -void InputListenerManager::OnAppear(const GetServiceFunc get, const std::string &iname, uint32_t ver) -{ - if (iname == "wl_seat") { - constexpr uint32_t wlSeatVersion = 1; - struct wl_seat *s = static_cast(get(&wl_seat_interface, wlSeatVersion)); - if (s == nullptr) { - return; - } - - Seat seat = { - .seat = s, - }; - seats.push_back(seat); - static struct wl_seat_listener listener = { SeatHandleCapabilities }; - wl_seat_add_listener(s, &listener, nullptr); - } -} - -void InputListenerManager::SeatHandleCapabilities(void *, struct wl_seat * seat, uint32_t caps) -{ - InputListenerManager::RegisterPointerListener(caps, seat); - InputListenerManager::RegisterKeyboardListener(caps, seat); - InputListenerManager::RegisterTouchListener(caps, seat); -} - -namespace { -void OnPointerEnter(void *, struct wl_pointer *, - uint32_t serial, struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy) -{ - double x = wl_fixed_to_double(sx); - double y = wl_fixed_to_double(sy); - - auto window = static_cast(wl_surface_get_user_data(surface)); - g_setFocus(window); - - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->pointerEnter) { - listener->pointerEnter(window, serial, x, y); - } - } -} - -void OnPointerLeave(void *, struct wl_pointer *, - uint32_t serial, struct wl_surface *surface) -{ - auto window = static_cast(wl_surface_get_user_data(surface)); - const auto &inputListeners = g_getInputCallback(window); - for (const auto &listener : inputListeners) { - if (listener->pointerLeave) { - listener->pointerLeave(window, serial); - } - } -} - -void OnPointerMotion(void *, struct wl_pointer *, - uint32_t time, wl_fixed_t sx, wl_fixed_t sy) -{ - double x = wl_fixed_to_double(sx); - double y = wl_fixed_to_double(sy); - - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->pointerMotion) { - listener->pointerMotion(listener->GetWindow(), time, x, y); - } - } -} - -void OnPointerButton(void *, struct wl_pointer *, - uint32_t serial, uint32_t time, uint32_t button, uint32_t s) -{ - auto state = static_cast(s); - - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->pointerButton) { - listener->pointerButton(listener->GetWindow(), serial, time, button, state); - } - } -} - -void OnPointerAxis(void *, struct wl_pointer *, - uint32_t time, uint32_t a, wl_fixed_t v) -{ - auto value = wl_fixed_to_double(v); - auto axis = static_cast(a); - - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->pointerAxis) { - listener->pointerAxis(listener->GetWindow(), time, axis, value); - } - } -} - -void OnPointerFrame(void *, struct wl_pointer *) -{ - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->pointerFrame) { - listener->pointerFrame(listener->GetWindow()); - } - } -} - -void OnPointerAxisSource(void *, struct wl_pointer *, - uint32_t as) -{ - auto axisSource = static_cast(as); - - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->pointerAxisSource) { - listener->pointerAxisSource(listener->GetWindow(), axisSource); - } - } -} - -void OnPointerAxisStop(void *, struct wl_pointer *, - uint32_t time, uint32_t a) -{ - auto axis = static_cast(a); - - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->pointerAxisStop) { - listener->pointerAxisStop(listener->GetWindow(), time, axis); - } - } -} - -void OnPointerAxisDiscrete(void *, struct wl_pointer *, - uint32_t a, int32_t discrete) -{ - auto axis = static_cast(a); - - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->pointerAxisDiscrete) { - listener->pointerAxisDiscrete(listener->GetWindow(), axis, discrete); - } - } -} - -void OnKeyboardKeymap(void *, struct wl_keyboard *, - uint32_t f, int32_t fd, uint32_t size) -{ - auto format = static_cast(f); - - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->keyboardKeymap) { - listener->keyboardKeymap(listener->GetWindow(), format, fd, size); - } - } -} - -void OnKeyboardEnter(void *, struct wl_keyboard *, - uint32_t serial, struct wl_surface *surface, struct wl_array *ks) -{ - std::vector keys; - auto k = static_cast(ks->data); - while (reinterpret_cast(k) < reinterpret_cast(ks->data) + ks->size) { - keys.push_back(*k++); - } - - auto window = static_cast(wl_surface_get_user_data(surface)); - g_setFocus(window); - - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->keyboardEnter) { - listener->keyboardEnter(listener->GetWindow(), serial, keys); - } - } -} - -void OnKeyboardLeave(void *, struct wl_keyboard *, - uint32_t serial, struct wl_surface *surface) -{ - auto window = static_cast(wl_surface_get_user_data(surface)); - const auto &inputListeners = g_getInputCallback(window); - for (const auto &listener : inputListeners) { - if (listener->keyboardLeave) { - listener->keyboardLeave(window, serial); - } - } -} - -void OnKeyboardKey(void *, struct wl_keyboard *, - uint32_t serial, uint32_t time, uint32_t key, uint32_t s) -{ - auto state = static_cast(s); - - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->keyboardKey) { - listener->keyboardKey(listener->GetWindow(), serial, time, key, state); - } - } -} - -void OnKeyboardModifiers(void *, struct wl_keyboard *, - uint32_t serial, uint32_t modsDepressed, - uint32_t modsLatched, uint32_t modsLocked, uint32_t group) -{ - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->keyboardModifiers) { - listener->keyboardModifiers(listener->GetWindow(), serial, modsDepressed, modsLatched, modsLocked, group); - } - } -} - -void OnKeyboardRepeatInfo(void *, struct wl_keyboard *, - int32_t rate, int32_t delay) -{ - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->keyboardRepeatInfo) { - listener->keyboardRepeatInfo(listener->GetWindow(), rate, delay); - } - } -} - -void OnTouchDown(void *, struct wl_touch *, - uint32_t serial, uint32_t time, - struct wl_surface *surface, - int32_t id, wl_fixed_t tx, wl_fixed_t ty) -{ - double x = wl_fixed_to_double(tx); - double y = wl_fixed_to_double(ty); - - auto window = static_cast(wl_surface_get_user_data(surface)); - g_setFocus(window); - - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->touchDown) { - listener->touchDown(listener->GetWindow(), serial, time, id, x, y); - } - } -} - -void OnTouchUp(void *, struct wl_touch *, - uint32_t serial, uint32_t time, int32_t id) -{ - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->touchUp) { - listener->touchUp(listener->GetWindow(), serial, time, id); - } - } -} - -void OnTouchMotion(void *, struct wl_touch *, - uint32_t time, int32_t id, wl_fixed_t tx, wl_fixed_t ty) -{ - double x = wl_fixed_to_double(tx); - double y = wl_fixed_to_double(ty); - - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->touchMotion) { - listener->touchMotion(listener->GetWindow(), time, id, x, y); - } - } -} - -void OnTouchFrame(void *, struct wl_touch *) -{ - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->touchFrame) { - listener->touchFrame(listener->GetWindow()); - } - } -} - -void OnTouchCancel(void *, struct wl_touch *) -{ - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->touchCancel) { - listener->touchCancel(listener->GetWindow()); - } - } -} - -void OnTouchShape(void *, struct wl_touch *, - int32_t id, wl_fixed_t ma, wl_fixed_t mi) -{ - double major = wl_fixed_to_double(ma); - double minor = wl_fixed_to_double(mi); - - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->touchShape) { - listener->touchShape(listener->GetWindow(), id, major, minor); - } - } -} - -void OnTouchOrientation(void *, struct wl_touch *, - int32_t id, wl_fixed_t o) -{ - double orientation = wl_fixed_to_double(o); - - const auto &inputListeners = g_getFocus(); - for (const auto &listener : inputListeners) { - if (listener->touchOrientation) { - listener->touchOrientation(listener->GetWindow(), id, orientation); - } - } -} -} // namespace - -uint32_t InputListenerManager::FindSeatNum(struct wl_seat *seat) -{ - uint32_t num = 1; - for (uint32_t i = 0; i < seats.size(); i++) { - if (seat == seats[i].seat) { - num = i; - break; - } - } - return num; -} - -void InputListenerManager::RegisterPointerListener(uint32_t caps, struct wl_seat *seat) -{ - struct wl_pointer *pointer = nullptr; - uint32_t num = FindSeatNum(seat); - pointer = seats[num].pointer; - bool havePointerCapability = !!(caps & WL_SEAT_CAPABILITY_POINTER); - if (havePointerCapability == true && pointer == nullptr) { - static struct wl_pointer_listener listener = { - OnPointerEnter, - OnPointerLeave, - OnPointerMotion, - OnPointerButton, - OnPointerAxis, - OnPointerFrame, - OnPointerAxisSource, - OnPointerAxisStop, - OnPointerAxisDiscrete, - }; - - pointer = wl_seat_get_pointer(seat); - if (pointer) { - wl_pointer_add_listener(pointer, &listener, nullptr); - } - } - - if (havePointerCapability == false && pointer != nullptr) { - wl_pointer_destroy(pointer); - pointer = nullptr; - } - seats[num].pointer = pointer; -} - -void InputListenerManager::RegisterKeyboardListener(uint32_t caps, struct wl_seat *seat) -{ - struct wl_keyboard *keyboard = nullptr; - uint32_t num = FindSeatNum(seat); - keyboard = seats[num].keyboard; - bool haveKeyboardCapability = !!(caps & WL_SEAT_CAPABILITY_KEYBOARD); - if (haveKeyboardCapability == true && keyboard == nullptr) { - static struct wl_keyboard_listener listener = { - OnKeyboardKeymap, - OnKeyboardEnter, - OnKeyboardLeave, - OnKeyboardKey, - OnKeyboardModifiers, - OnKeyboardRepeatInfo, - }; - - keyboard = wl_seat_get_keyboard(seat); - if (keyboard) { - wl_keyboard_add_listener(keyboard, &listener, nullptr); - } - } - - if (haveKeyboardCapability == false && keyboard != nullptr) { - wl_keyboard_destroy(keyboard); - keyboard = nullptr; - } - seats[num].keyboard = keyboard; -} - -void InputListenerManager::RegisterTouchListener(uint32_t caps, struct wl_seat *seat) -{ - struct wl_touch *touch = nullptr; - uint32_t num = FindSeatNum(seat); - touch = seats[num].touch; - bool haveTouchCapability = !!(caps & WL_SEAT_CAPABILITY_TOUCH); - if (haveTouchCapability == true && touch == nullptr) { - static const struct wl_touch_listener listener = { - OnTouchDown, - OnTouchUp, - OnTouchMotion, - OnTouchFrame, - OnTouchCancel, - OnTouchShape, - OnTouchOrientation, - }; - - touch = wl_seat_get_touch(seat); - if (touch) { - wl_touch_add_listener(touch, &listener, nullptr); - } - } - - if (haveTouchCapability == false && touch != nullptr) { - wl_touch_destroy(touch); - touch = nullptr; - } - seats[num].touch = touch; -} -} // namespace OHOS diff --git a/frameworks/wm/src/log_listener.cpp b/frameworks/wm/src/log_listener.cpp deleted file mode 100644 index 0d9bd4b56b..0000000000 --- a/frameworks/wm/src/log_listener.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "log_listener.h" - -#include -#include - -#include "window_manager_hilog.h" - -namespace OHOS { -namespace { -constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, 0, "WMLogListener" }; -} // namespace - -sptr LogListener::GetInstance() -{ - if (instance == nullptr) { - static std::mutex mutex; - std::lock_guard lock(mutex); - if (instance == nullptr) { - instance = new LogListener(); - } - } - return instance; -} - -sptr LogListener::AddListener(void *window) -{ - auto l = delegator.Dep()->AddListener(window); - l->pointerEnter = std::bind(&LogListener::PointerHandleEnter, this, POINTER_ENTER_ARG); - l->pointerLeave = std::bind(&LogListener::PointerHandleLeave, this, POINTER_LEAVE_ARG); - l->pointerMotion = std::bind(&LogListener::PointerHandleMotion, this, POINTER_MOTION_ARG); - l->pointerButton = std::bind(&LogListener::PointerHandleButton, this, POINTER_BUTTON_ARG); - l->pointerFrame = std::bind(&LogListener::PointerHandleFrame, this, POINTER_FRAME_ARG); - l->pointerAxis = std::bind(&LogListener::PointerHandleAxis, this, POINTER_AXIS_ARG); - l->pointerAxisSource = std::bind(&LogListener::PointerHandleAxisSource, this, POINTER_AXIS_SOURCE_ARG); - l->pointerAxisStop = std::bind(&LogListener::PointerHandleAxisStop, this, POINTER_AXIS_STOP_ARG); - l->pointerAxisDiscrete = std::bind(&LogListener::PointerHandleAxisDiscrete, this, POINTER_AXIS_DISCRETE_ARG); - l->keyboardKeymap = std::bind(&LogListener::KeyboardHandleKeyMap, this, KEYBOARD_KEYMAP_ARG); - l->keyboardEnter = std::bind(&LogListener::KeyboardHandleEnter, this, KEYBOARD_ENTER_ARG); - l->keyboardLeave = std::bind(&LogListener::KeyboardHandleLeave, this, KEYBOARD_LEAVE_ARG); - l->keyboardKey = std::bind(&LogListener::KeyboardHandleKey, this, KEYBOARD_KEY_ARG); - l->keyboardModifiers = std::bind(&LogListener::KeyboardHandleModifiers, this, KEYBOARD_MODIFIERS_ARG); - l->keyboardRepeatInfo = std::bind(&LogListener::KeyboardHandleRepeatInfo, this, KEYBOARD_REPEAT_INFO_ARG); - l->touchDown = std::bind(&LogListener::TouchHandleDown, this, TOUCH_DOWN_ARG); - l->touchUp = std::bind(&LogListener::TouchHandleUp, this, TOUCH_UP_ARG); - l->touchMotion = std::bind(&LogListener::TouchHandleMotion, this, TOUCH_MOTION_ARG); - l->touchFrame = std::bind(&LogListener::TouchHandleFrame, this, TOUCH_FRAME_ARG); - l->touchCancel = std::bind(&LogListener::TouchHandleCancel, this, TOUCH_CANCEL_ARG); - l->touchShape = std::bind(&LogListener::TouchHandleShape, this, TOUCH_SHAPE_ARG); - l->touchOrientation = std::bind(&LogListener::TouchHandleOrientation, this, TOUCH_ORIENTATION_ARG); - return l; -} - -void LogListener::RemoveListener(sptr &listener) -{ - delegator.Dep()->RemoveListener(listener); -} - -void LogListener::PointerHandleEnter(void *data, uint32_t sss, double x, double y) -{ - WMLOGFD(""); -} - -void LogListener::PointerHandleLeave(void *data, uint32_t sss) -{ - WMLOGFD(""); -} - -void LogListener::PointerHandleMotion(void *data, uint32_t time, double x, double y) -{ - WMLOGFD(""); -} - -void LogListener::PointerHandleButton(void *data, uint32_t sss, - uint32_t time, uint32_t button, PointerButtonState state) -{ - WMLOGFD(""); -} - -void LogListener::PointerHandleFrame(void *data) -{ - WMLOGFD(""); -} - -void LogListener::PointerHandleAxis(void *data, uint32_t time, PointerAxis axis, double value) -{ - WMLOGFD(""); -} - -void LogListener::PointerHandleAxisSource(void *data, PointerAxisSource axisSource) -{ - WMLOGFD(""); -} - -void LogListener::PointerHandleAxisStop(void *data, uint32_t time, PointerAxis axis) -{ - WMLOGFD(""); -} - -void LogListener::PointerHandleAxisDiscrete(void *data, PointerAxis axis, int32_t discrete) -{ - WMLOGFD(""); -} - -void LogListener::KeyboardHandleKeyMap(void *data, - KeyboardKeymapFormat format, int32_t fd, uint32_t size) -{ - WMLOGFD(""); -} - -void LogListener::KeyboardHandleEnter(void *data, uint32_t sss, const std::vector &keys) -{ - WMLOGFD(""); -} - -void LogListener::KeyboardHandleLeave(void *data, uint32_t sss) -{ - WMLOGFD(""); -} - -void LogListener::KeyboardHandleKey(void *data, - uint32_t sss, uint32_t time, uint32_t key, KeyboardKeyState state) -{ - WMLOGFD(""); -} - -void LogListener::KeyboardHandleModifiers(void *data, uint32_t sss, - uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group) -{ - WMLOGFD(""); -} - -void LogListener::KeyboardHandleRepeatInfo(void *data, int32_t rate, int32_t delay) -{ - WMLOGFD(""); -} - -void LogListener::TouchHandleDown(void *data, - uint32_t sss, uint32_t time, int32_t id, double x, double y) -{ - WMLOGFD(""); -} - -void LogListener::TouchHandleUp(void *data, uint32_t sss, uint32_t time, int32_t id) -{ - WMLOGFD(""); -} - -void LogListener::TouchHandleMotion(void *data, uint32_t time, int32_t id, double x, double y) -{ - WMLOGFD(""); -} - -void LogListener::TouchHandleFrame(void *data) -{ - WMLOGFD(""); -} - -void LogListener::TouchHandleCancel(void *data) -{ - WMLOGFD(""); -} - -void LogListener::TouchHandleShape(void *data, int32_t id, double major, double minor) -{ - WMLOGFD(""); -} - -void LogListener::TouchHandleOrientation(void *data, int32_t id, double orientation) -{ - WMLOGFD(""); -} -} diff --git a/frameworks/wm/src/wayland_service.cpp b/frameworks/wm/src/wayland_service.cpp index d850086003..bad7aae04a 100644 --- a/frameworks/wm/src/wayland_service.cpp +++ b/frameworks/wm/src/wayland_service.cpp @@ -18,7 +18,6 @@ #include #include -#include #include "window_manager_hilog.h" #include "wl_display.h" @@ -108,8 +107,8 @@ GSError WaylandService::Start() return GSERROR_API_FAILED; } - g_appear = std::bind(&WaylandService::Appear, this, __BIND3_ARGS); - g_remove = std::bind(&WaylandService::Remove, this, __BIND1_ARGS); + g_appear = std::bind(&WaylandService::Appear, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); + g_remove = std::bind(&WaylandService::Remove, this, std::placeholders::_1); return GSERROR_OK; } diff --git a/frameworks/wm/src/window_impl.cpp b/frameworks/wm/src/window_impl.cpp index b37d014034..1752be4a40 100644 --- a/frameworks/wm/src/window_impl.cpp +++ b/frameworks/wm/src/window_impl.cpp @@ -170,9 +170,6 @@ GSError WindowImpl::Create(sptr &window, return wret; } - wi->logListener = SingletonContainer::Get()->AddListener(wi.GetRefPtr()); - wi->exportListener = SingletonContainer::Get()->AddListener(wi.GetRefPtr()); - window = wi; WMLOGFI("Create Window Success"); return GSERROR_OK; @@ -424,160 +421,6 @@ GSError WindowImpl::OnKey(OnKeyFunc cb) return GSERROR_OK; } -GSError WindowImpl::OnPointerEnter(PointerEnterFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->pointerEnter = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnPointerLeave(PointerLeaveFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->pointerLeave = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnPointerMotion(PointerMotionFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->pointerMotion = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnPointerButton(PointerButtonFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->pointerButton = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnPointerFrame(PointerFrameFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->pointerFrame = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnPointerAxis(PointerAxisFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->pointerAxis = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnPointerAxisSource(PointerAxisSourceFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->pointerAxisSource = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnPointerAxisStop(PointerAxisStopFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->pointerAxisStop = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnPointerAxisDiscrete(PointerAxisDiscreteFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->pointerAxisDiscrete = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnKeyboardKeymap(KeyboardKeymapFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->keyboardKeymap = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnKeyboardEnter(KeyboardEnterFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->keyboardEnter = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnKeyboardLeave(KeyboardLeaveFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->keyboardLeave = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnKeyboardKey(KeyboardKeyFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->keyboardKey = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnKeyboardModifiers(KeyboardModifiersFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->keyboardModifiers = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnKeyboardRepeatInfo(KeyboardRepeatInfoFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->keyboardRepeatInfo = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnTouchDown(TouchDownFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->touchDown = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnTouchUp(TouchUpFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->touchUp = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnTouchMotion(TouchMotionFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->touchMotion = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnTouchFrame(TouchFrameFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->touchFrame = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnTouchCancel(TouchCancelFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->touchCancel = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnTouchShape(TouchShapeFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->touchShape = func; - return GSERROR_OK; -} - -GSError WindowImpl::OnTouchOrientation(TouchOrientationFunc func) -{ - CHECK_DESTROY(GSERROR_DESTROYED_OBJECT); - exportListener->touchOrientation = func; - return GSERROR_OK; -} - namespace { void BufferRelease(struct wl_buffer *wbuffer, int32_t fence) { @@ -642,14 +485,6 @@ void WindowImpl::OnBufferAvailable() WindowImpl::~WindowImpl() { - if (logListener != nullptr) { - SingletonContainer::Get()->RemoveListener(logListener); - } - - if (exportListener != nullptr) { - SingletonContainer::Get()->RemoveListener(exportListener); - } - if (csurface != nullptr) { csurface->UnregisterConsumerListener(); } diff --git a/frameworks/wm/src/window_manager_impl.cpp b/frameworks/wm/src/window_manager_impl.cpp index a8df4df708..9767ecc5bd 100644 --- a/frameworks/wm/src/window_manager_impl.cpp +++ b/frameworks/wm/src/window_manager_impl.cpp @@ -61,7 +61,6 @@ void WindowManagerImpl::InitSingleton() { if (initSingleton == false) { initSingleton = true; - inputListenerManager = SingletonContainer::Get(); windowManagerServer = SingletonContainer::Get(); wlBufferCache = SingletonContainer::Get(); wlDMABufferFactory = SingletonContainer::Get(); @@ -69,7 +68,6 @@ void WindowManagerImpl::InitSingleton() wlSubsurfaceFactory = SingletonContainer::Get(); wlSurfaceFactory = SingletonContainer::Get(); - inputListenerManager->Init(); windowManagerServer->Init(); wlBufferCache->Init(); wlDMABufferFactory->Init(); @@ -136,7 +134,6 @@ void WindowManagerImpl::DeinitSingleton() wlDMABufferFactory->Deinit(); wlBufferCache->Deinit(); windowManagerServer->Deinit(); - inputListenerManager->Deinit(); waylandService = nullptr; wlSurfaceFactory = nullptr; @@ -145,7 +142,6 @@ void WindowManagerImpl::DeinitSingleton() wlDMABufferFactory = nullptr; wlBufferCache = nullptr; windowManagerServer = nullptr; - inputListenerManager = nullptr; display->Roundtrip(); } diff --git a/frameworks/wm/test/unittest/BUILD.gn b/frameworks/wm/test/unittest/BUILD.gn index 6a61a1d17b..60aa738753 100644 --- a/frameworks/wm/test/unittest/BUILD.gn +++ b/frameworks/wm/test/unittest/BUILD.gn @@ -19,8 +19,6 @@ group("unittest") { testonly = true deps = [ - ":input_listener_manager_test", - ":log_listener_test", ":subwindow_normal_impl_test", ":subwindow_option_impl_test", ":wayland_service_test", @@ -38,28 +36,6 @@ group("unittest") { ] } -## UnitTest input_listener_manager_test {{{ -ohos_unittest("input_listener_manager_test") { - module_out_path = module_out_path - - sources = [ "input_listener_manager_test.cpp" ] - - deps = [ ":wm_test_common" ] -} - -## UnitTest input_listener_manager_test }}} - -## UnitTest log_listener_test {{{ -ohos_unittest("log_listener_test") { - module_out_path = module_out_path - - sources = [ "log_listener_test.cpp" ] - - deps = [ ":wm_test_common" ] -} - -## UnitTest log_listener_test }}} - ## UnitTest subwindow_normal_impl_test {{{ ohos_unittest("subwindow_normal_impl_test") { module_out_path = module_out_path diff --git a/frameworks/wm/test/unittest/input_listener_manager_test.cpp b/frameworks/wm/test/unittest/input_listener_manager_test.cpp deleted file mode 100644 index 64c4ded65a..0000000000 --- a/frameworks/wm/test/unittest/input_listener_manager_test.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "input_listener_manager_test.h" - -namespace OHOS { -void InputListenerManagerTest::SetUp() -{ -} - -void InputListenerManagerTest::TearDown() -{ -} - -void InputListenerManagerTest::SetUpTestCase() -{ - GTEST_LOG_(INFO) << getpid() << std::endl; - initRet = WindowManager::GetInstance()->Init(); -} - -void InputListenerManagerTest::TearDownTestCase() -{ -} - -namespace { -/* - * Feature: InputListenerManager AddListener - * Function: InputListenerManager - * SubFunction: AddListener - * FunctionPoints: InputListenerManager AddListener - * EnvConditions: WindowManager init success. - * CaseDescription: 1. add listener[0] by an address A - * 2. check listener[0] - * a. check listener[0] isn't nullptr - * b. check listener[0].GetWindow() is address A - * c. check map size is 1 - * d. check vector size of address A is 1 - * 3. add listener[1] by nullptr - * 4. check listener[1] - * a. check listener[1] isn't nullptr - * b. check listener[1].GetWindow() is nullptr - * c. check map size is 2 - * d. check vector size of nullptr is 1 - * 5. add listener[2] by the address A - * 6. check listener[2] - * a. check listener[2] isn't nullptr - * b. check listener[2].GetWindow() is address A - * c. check map size is 2 - * d. check vector size of address A is 2 - * 7. add listener[3] by nullptr - * 8. check listener[3] - * a. check listener[3] isn't nullptr - * b. check listener[3].GetWindow() is nullptr - * c. check map size is 2 - * d. check vector size of nullptr is 2 - */ -HWTEST_F(InputListenerManagerTest, AddListener, testing::ext::TestSize.Level0) -{ - // WindowManager init success. - ASSERT_EQ(initRet, GSERROR_OK) << "EnvConditions: WindowManager init success. (initRet == GSERROR_OK)"; - - auto manager = InputListenerManager::GetInstance(); - - // 1. add listener[0] by an address A - listener[0] = manager->AddListener(&addressA); - - // 2. check listener[0] - { - // a. check listener[0] isn't nullptr - ASSERT_NE(listener[0], nullptr) << "CaseDescription:" - << " 2.a check listener[0] isn't nullptr (listener[0] != nullptr)"; - // b. check listener[0].GetWindow() is address A - ASSERT_EQ(listener[0]->GetWindow(), &addressA) << "CaseDescription:" - << " 2.b. check listener[0].GetWindow() is address A (listener[0].GetWindow() == address A)"; - // c. check map size is 1 - ASSERT_EQ(manager->inputListenersMap.size(), 1u) << "CaseDescription:" - << " 2.c check map size is 1 (map.size() == 1)"; - // d. check vector size of address A is 1 - ASSERT_EQ(manager->inputListenersMap[&addressA].size(), 1u) << "CaseDescription:" - << " 2.d check vector size of address A is 1 (vector.size() == 1)"; - } - - // 3. add listener[1] by nullptr - listener[1] = manager->AddListener(nullptr); - - // 4. check listener[1] - { - // a. check listener[1] isn't nullptr - ASSERT_NE(listener[1], nullptr) << "CaseDescription:" - << " 4.a check listener[1] isn't nullptr (listener[1] != nullptr)"; - // b. check listener[1].GetWindow() is address A - ASSERT_EQ(listener[1]->GetWindow(), nullptr) << "CaseDescription:" - << " 4.b. check listener[1].GetWindow() is address A (listener[1].GetWindow() == nullptr)"; - // c. check map size is 2 - ASSERT_EQ(manager->inputListenersMap.size(), 2u) << "CaseDescription:" - << " 4.c check map size is 2 (map.size() == 2)"; - // d. check vector size of nullptr is 1 - ASSERT_EQ(manager->inputListenersMap[nullptr].size(), 1u) << "CaseDescription:" - << " 4.d check vector size of nullptr is 1 (vector.size() == 1)"; - } - - // 5. add listener[2] by the address A - listener[2] = manager->AddListener(&addressA); - - // 6. check listener[2] - { - // a. check listener[2] isn't nullptr - ASSERT_NE(listener[2], nullptr) << "CaseDescription:" - << " 6.a check listener[2] isn't nullptr (listener[2] != nullptr)"; - // b. check listener[2].GetWindow() is address A - ASSERT_EQ(listener[2]->GetWindow(), &addressA) << "CaseDescription:" - << " 6.b. check listener[2].GetWindow() is address A (listener[2].GetWindow() == address A)"; - // c. check map size is 2 - ASSERT_EQ(manager->inputListenersMap.size(), 2u) << "CaseDescription:" - << " 6.c check map size is 2 (map.size() == 2)"; - // d. check vector size of address A is 2 - ASSERT_EQ(manager->inputListenersMap[&addressA].size(), 2u) << "CaseDescription:" - << " 6.d check vector size of address A is 2 (vector.size() == 2)"; - } - - // 7. add listener[3] by nullptr - listener[3] = manager->AddListener(nullptr); - - // 8. check listener[3] - { - // a. check listener[3] isn't nullptr - ASSERT_NE(listener[3], nullptr) << "CaseDescription:" - << " 8.a check listener[3] isn't nullptr (listener[3] != nullptr)"; - // b. check listener[3].GetWindow() is address A - ASSERT_EQ(listener[3]->GetWindow(), nullptr) << "CaseDescription:" - << " 8.b. check listener[3].GetWindow() is address A (listener[3].GetWindow() == nullptr)"; - // c. check map size is 2 - ASSERT_EQ(manager->inputListenersMap.size(), 2u) << "CaseDescription:" - << " 8.c check map size is 2 (map.size() == 2)"; - // d. check vector size of nullptr is 2 - ASSERT_EQ(manager->inputListenersMap[nullptr].size(), 2u) << "CaseDescription:" - << " 8.d check vector size of nullptr is 2 (vector.size() == 2)"; - } -} - -/* - * Feature: InputListenerManager RemoveListener - * Function: InputListenerManager - * SubFunction: RemoveListener - * FunctionPoints: InputListenerManager RemoveListener - * EnvConditions: WindowManager init success. - * CaseDescription: 1. remove listener[0] - * 2. check map size is 2, check vector size of address A is 1 - * 3. remove listener[2] - * 4. check map size is 1 - * 5. remove listener[1], listener[3] - * 6. check map size is 0 - */ -HWTEST_F(InputListenerManagerTest, RemoveListener, testing::ext::TestSize.Level0) -{ - // WindowManager init success. - ASSERT_EQ(initRet, GSERROR_OK) << "EnvConditions: WindowManager init success. (initRet == GSERROR_OK)"; - - auto manager = InputListenerManager::GetInstance(); - - // 1. remove listener[0] - ASSERT_NE(listener[0], nullptr) << "CaseDescription: 1. remove listener[0] (listener[0] != nullptr)"; - manager->RemoveListener(listener[0]); - - // 2. check map size is 2, check vector size of address A is 1 - ASSERT_EQ(manager->inputListenersMap.size(), 2u) << "CaseDescription:" - << " 2. check map size is 2 (map.size() == 2)"; - ASSERT_EQ(manager->inputListenersMap[&addressA].size(), 1u) << "CaseDescription:" - << " 2. check vector size of address A is 1 (vector.size() == 1)"; - - // 3. remove listener[2] - ASSERT_NE(listener[2], nullptr) << "CaseDescription: 3. remove listener[2] (listener[2] != nullptr)"; - manager->RemoveListener(listener[2]); - - // 4. check map size is 1 - ASSERT_EQ(manager->inputListenersMap.size(), 1u) << "CaseDescription:" - << " 4. check map size is 1 (map.size() == 1)"; - - // 5. remove listener[1], listener[3] - ASSERT_NE(listener[1], nullptr) << "CaseDescription: 5. remove listener[1] (listener[1] != nullptr)"; - ASSERT_NE(listener[3], nullptr) << "CaseDescription: 5. remove listener[3] (listener[3] != nullptr)"; - manager->RemoveListener(listener[1]); - manager->RemoveListener(listener[3]); - - // 6. check map size is 0 - ASSERT_EQ(manager->inputListenersMap.size(), 0u) << "CaseDescription:" - << " 6. check map size is 0 (map.size() == 0)"; -} -} // namespace -} // namespace OHOS diff --git a/frameworks/wm/test/unittest/input_listener_manager_test.h b/frameworks/wm/test/unittest/input_listener_manager_test.h deleted file mode 100644 index 3dcf849146..0000000000 --- a/frameworks/wm/test/unittest/input_listener_manager_test.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef FRAMEWORKS_WM_TEST_UNITTEST_INPUT_LISTENER_MANAGER_TEST_H -#define FRAMEWORKS_WM_TEST_UNITTEST_INPUT_LISTENER_MANAGER_TEST_H - -#include -#include -#include - -#include "input_listener_manager.h" - -namespace OHOS { -class InputListenerManagerTest : public testing::Test { -public: - static void SetUpTestCase(); - static void TearDownTestCase(); - virtual void SetUp() override; - virtual void TearDown() override; - -private: - static inline GSError initRet = GSERROR_NOT_INIT; - static inline sptr listener[4] = {}; - static inline int32_t addressA = 0; -}; -} - -#endif // FRAMEWORKS_WM_TEST_UNITTEST_INPUT_LISTENER_MANAGER_TEST_H diff --git a/frameworks/wm/test/unittest/log_listener_test.cpp b/frameworks/wm/test/unittest/log_listener_test.cpp deleted file mode 100644 index fe87a87c93..0000000000 --- a/frameworks/wm/test/unittest/log_listener_test.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "log_listener_test.h" - -namespace OHOS { -void LogListenerTest::SetUp() -{ -} - -void LogListenerTest::TearDown() -{ -} - -void LogListenerTest::SetUpTestCase() -{ - GTEST_LOG_(INFO) << getpid() << std::endl; - initRet = WindowManager::GetInstance()->Init(); -} - -void LogListenerTest::TearDownTestCase() -{ -} - -namespace { -/* - * Feature: LogListener AddListener - * Function: LogListener - * SubFunction: AddListener - * FunctionPoints: LogListener AddListener - * EnvConditions: WindowManager init success. - * CaseDescription: 1. add listener[0] by an address A - * 2. check listener[0] - * a. check listener[0] isn't nullptr - * b. check listener[0].GetWindow() is address A - * c. check map size is 1 - * d. check vector size of address A is 1 - * 3. add listener[1] by nullptr - * 4. check listener[1] - * a. check listener[1] isn't nullptr - * b. check listener[1].GetWindow() is nullptr - * c. check map size is 2 - * d. check vector size of nullptr is 1 - * 5. add listener[2] by the address A - * 6. check listener[2] - * a. check listener[2] isn't nullptr - * b. check listener[2].GetWindow() is address A - * c. check map size is 2 - * d. check vector size of address A is 2 - * 7. add listener[3] by nullptr - * 8. check listener[3] - * a. check listener[3] isn't nullptr - * b. check listener[3].GetWindow() is nullptr - * c. check map size is 2 - * d. check vector size of nullptr is 2 - */ -HWTEST_F(LogListenerTest, AddListener, testing::ext::TestSize.Level0) -{ - // WindowManager init success. - ASSERT_EQ(initRet, GSERROR_OK) << "EnvConditions: WindowManager init success. (initRet == GSERROR_OK)"; - - auto ll = LogListener::GetInstance(); - auto manager = InputListenerManager::GetInstance(); - - // 1. add listener[0] by an address A - listener[0] = ll->AddListener(&addressA); - - // 2. check listener[0] - { - // a. check listener[0] isn't nullptr - ASSERT_NE(listener[0], nullptr) << "CaseDescription:" - << " 2.a check listener[0] isn't nullptr (listener[0] != nullptr)"; - // b. check listener[0].GetWindow() is address A - ASSERT_EQ(listener[0]->GetWindow(), &addressA) << "CaseDescription:" - << " 2.b. check listener[0].GetWindow() is address A (listener[0].GetWindow() == address A)"; - // c. check map size is 1 - ASSERT_EQ(manager->inputListenersMap.size(), 1u) << "CaseDescription:" - << " 2.c check map size is 1 (map.size() == 1)"; - // d. check vector size of address A is 1 - ASSERT_EQ(manager->inputListenersMap[&addressA].size(), 1u) << "CaseDescription:" - << " 2.d check vector size of address A is 1 (vector.size() == 1)"; - } - - // 3. add listener[1] by nullptr - listener[1] = ll->AddListener(nullptr); - - // 4. check listener[1] - { - // a. check listener[1] isn't nullptr - ASSERT_NE(listener[1], nullptr) << "CaseDescription:" - << " 4.a check listener[1] isn't nullptr (listener[1] != nullptr)"; - // b. check listener[1].GetWindow() is address A - ASSERT_EQ(listener[1]->GetWindow(), nullptr) << "CaseDescription:" - << " 4.b. check listener[1].GetWindow() is address A (listener[1].GetWindow() == nullptr)"; - // c. check map size is 2 - ASSERT_EQ(manager->inputListenersMap.size(), 2u) << "CaseDescription:" - << " 4.c check map size is 2 (map.size() == 2)"; - // d. check vector size of nullptr is 1 - ASSERT_EQ(manager->inputListenersMap[nullptr].size(), 1u) << "CaseDescription:" - << " 4.d check vector size of nullptr is 1 (vector.size() == 1)"; - } - - // 5. add listener[2] by the address A - listener[2] = ll->AddListener(&addressA); - - // 6. check listener[2] - { - // a. check listener[2] isn't nullptr - ASSERT_NE(listener[2], nullptr) << "CaseDescription:" - << " 6.a check listener[2] isn't nullptr (listener[2] != nullptr)"; - // b. check listener[2].GetWindow() is address A - ASSERT_EQ(listener[2]->GetWindow(), &addressA) << "CaseDescription:" - << " 6.b. check listener[2].GetWindow() is address A (listener[2].GetWindow() == address A)"; - // c. check map size is 2 - ASSERT_EQ(manager->inputListenersMap.size(), 2u) << "CaseDescription:" - << " 6.c check map size is 2 (map.size() == 2)"; - // d. check vector size of address A is 2 - ASSERT_EQ(manager->inputListenersMap[&addressA].size(), 2u) << "CaseDescription:" - << " 6.d check vector size of address A is 2 (vector.size() == 2)"; - } - - // 7. add listener[3] by nullptr - listener[3] = ll->AddListener(nullptr); - - // 8. check listener[3] - { - // a. check listener[3] isn't nullptr - ASSERT_NE(listener[3], nullptr) << "CaseDescription:" - << " 8.a check listener[3] isn't nullptr (listener[3] != nullptr)"; - // b. check listener[3].GetWindow() is address A - ASSERT_EQ(listener[3]->GetWindow(), nullptr) << "CaseDescription:" - << " 8.b. check listener[3].GetWindow() is address A (listener[3].GetWindow() == nullptr)"; - // c. check map size is 2 - ASSERT_EQ(manager->inputListenersMap.size(), 2u) << "CaseDescription:" - << " 8.c check map size is 2 (map.size() == 2)"; - // d. check vector size of nullptr is 2 - ASSERT_EQ(manager->inputListenersMap[nullptr].size(), 2u) << "CaseDescription:" - << " 8.d check vector size of nullptr is 2 (vector.size() == 2)"; - } -} - -/* - * Feature: LogListener RemoveListener - * Function: LogListener - * SubFunction: RemoveListener - * FunctionPoints: LogListener RemoveListener - * EnvConditions: WindowManager init success. - * CaseDescription: 1. remove listener[0] - * 2. check map size is 2, check vector size of address A is 1 - * 3. remove listener[2] - * 4. check map size is 1 - * 5. remove listener[1], listener[3] - * 6. check map size is 0 - */ -HWTEST_F(LogListenerTest, RemoveListener, testing::ext::TestSize.Level0) -{ - // WindowManager init success. - ASSERT_EQ(initRet, GSERROR_OK) << "EnvConditions: WindowManager init success. (initRet == GSERROR_OK)"; - - auto ll = LogListener::GetInstance(); - auto manager = InputListenerManager::GetInstance(); - - // 1. remove listener[0] - ASSERT_NE(listener[0], nullptr) << "CaseDescription: 1. remove listener[0] (listener[0] != nullptr)"; - ll->RemoveListener(listener[0]); - - // 2. check map size is 2, check vector size of address A is 1 - ASSERT_EQ(manager->inputListenersMap.size(), 2u) << "CaseDescription:" - << " 2. check map size is 2 (map.size() == 2)"; - ASSERT_EQ(manager->inputListenersMap[&addressA].size(), 1u) << "CaseDescription:" - << " 2. check vector size of address A is 1 (vector.size() == 1)"; - - // 3. remove listener[2] - ASSERT_NE(listener[2], nullptr) << "CaseDescription: 3. remove listener[2] (listener[2] != nullptr)"; - ll->RemoveListener(listener[2]); - - // 4. check map size is 1 - ASSERT_EQ(manager->inputListenersMap.size(), 1u) << "CaseDescription:" - << " 4. check map size is 1 (map.size() == 1)"; - - // 5. remove listener[1], listener[3] - ASSERT_NE(listener[1], nullptr) << "CaseDescription: 5. remove listener[1] (listener[1] != nullptr)"; - ASSERT_NE(listener[3], nullptr) << "CaseDescription: 5. remove listener[3] (listener[3] != nullptr)"; - ll->RemoveListener(listener[1]); - ll->RemoveListener(listener[3]); - - // 6. check map size is 0 - ASSERT_EQ(manager->inputListenersMap.size(), 0u) << "CaseDescription:" - << " 6. check map size is 0 (map.size() == 0)"; -} -} // namespace -} // namespace OHOS diff --git a/frameworks/wm/test/unittest/log_listener_test.h b/frameworks/wm/test/unittest/log_listener_test.h deleted file mode 100644 index 0122b14499..0000000000 --- a/frameworks/wm/test/unittest/log_listener_test.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef FRAMEWORKS_WM_TEST_UNITTEST_LOG_LISTENER_TEST_H -#define FRAMEWORKS_WM_TEST_UNITTEST_LOG_LISTENER_TEST_H - -#include -#include -#include - -#include "input_listener_manager.h" -#include "log_listener.h" - -namespace OHOS { -class LogListenerTest : public testing::Test { -public: - static void SetUpTestCase(); - static void TearDownTestCase(); - virtual void SetUp() override; - virtual void TearDown() override; - -private: - static inline GSError initRet = GSERROR_NOT_INIT; - static inline sptr listener[4] = {}; - static inline int32_t addressA = 0; -}; -} - -#endif // FRAMEWORKS_WM_TEST_UNITTEST_LOG_LISTENER_TEST_H diff --git a/frameworks/wm/test/unittest/mock/mock_window.h b/frameworks/wm/test/unittest/mock/mock_window.h index 0e913a41d3..f856dfffad 100644 --- a/frameworks/wm/test/unittest/mock/mock_window.h +++ b/frameworks/wm/test/unittest/mock/mock_window.h @@ -51,30 +51,8 @@ public: MOCK_METHOD1(OnTypeChange, void(WindowTypeChangeFunc func)); MOCK_METHOD1(OnModeChange, void(WindowModeChangeFunc func)); MOCK_METHOD1(OnSplitStatusChange, void(SplitStatusChangeFunc func)); - MOCK_METHOD1(OnTouch, GSError(OnTouchFunc cb)); MOCK_METHOD1(OnKey, GSError(OnKeyFunc cb)); - MOCK_METHOD1(OnPointerEnter, GSError(PointerEnterFunc func)); - MOCK_METHOD1(OnPointerLeave, GSError(PointerLeaveFunc func)); - MOCK_METHOD1(OnPointerMotion, GSError(PointerMotionFunc func)); - MOCK_METHOD1(OnPointerButton, GSError(PointerButtonFunc func)); - MOCK_METHOD1(OnPointerFrame, GSError(PointerFrameFunc func)); - MOCK_METHOD1(OnPointerAxis, GSError(PointerAxisFunc func)); - MOCK_METHOD1(OnPointerAxisSource, GSError(PointerAxisSourceFunc func)); - MOCK_METHOD1(OnPointerAxisStop, GSError(PointerAxisStopFunc func)); - MOCK_METHOD1(OnPointerAxisDiscrete, GSError(PointerAxisDiscreteFunc func)); - MOCK_METHOD1(OnKeyboardKeymap, GSError(KeyboardKeymapFunc func)); - MOCK_METHOD1(OnKeyboardEnter, GSError(KeyboardEnterFunc func)); - MOCK_METHOD1(OnKeyboardLeave, GSError(KeyboardLeaveFunc func)); - MOCK_METHOD1(OnKeyboardKey, GSError(KeyboardKeyFunc func)); - MOCK_METHOD1(OnKeyboardModifiers, GSError(KeyboardModifiersFunc func)); - MOCK_METHOD1(OnKeyboardRepeatInfo, GSError(KeyboardRepeatInfoFunc func)); - MOCK_METHOD1(OnTouchDown, GSError(TouchDownFunc func)); - MOCK_METHOD1(OnTouchUp, GSError(TouchUpFunc func)); - MOCK_METHOD1(OnTouchMotion, GSError(TouchMotionFunc func)); - MOCK_METHOD1(OnTouchFrame, GSError(TouchFrameFunc func)); - MOCK_METHOD1(OnTouchCancel, GSError(TouchCancelFunc func)); - MOCK_METHOD1(OnTouchShape, GSError(TouchShapeFunc func)); - MOCK_METHOD1(OnTouchOrientation, GSError(TouchOrientationFunc func)); + MOCK_METHOD1(OnTouch, GSError(OnTouchFunc cb)); }; } // namespace OHOS diff --git a/frameworks/wm/test/unittest/wayland_service_test.cpp b/frameworks/wm/test/unittest/wayland_service_test.cpp index 770062f00b..025641a98a 100644 --- a/frameworks/wm/test/unittest/wayland_service_test.cpp +++ b/frameworks/wm/test/unittest/wayland_service_test.cpp @@ -54,7 +54,8 @@ namespace { HWTEST_F(WaylandServiceTest, Start, testing::ext::TestSize.Level0) { // once before all - const auto appear = std::bind(&WaylandServiceTest::OnAppear, this, __BIND3_ARGS); + const auto appear = std::bind(&WaylandServiceTest::OnAppear, + this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); WaylandService::GetInstance()->OnAppear(appear); const auto &display = WlDisplay::GetInstance(); diff --git a/frameworks/wm/test/unittest/window_impl_test.cpp b/frameworks/wm/test/unittest/window_impl_test.cpp index 8ac3e3b590..b81964d64d 100644 --- a/frameworks/wm/test/unittest/window_impl_test.cpp +++ b/frameworks/wm/test/unittest/window_impl_test.cpp @@ -1296,147 +1296,5 @@ HWTEST_F(WindowImplTest, OnTypeChange01, Function | SmallTest | Level2) } } } - -/* - * Function: OnTouch - * Type: Function - * Rank: Important(2) - * EnvConditions: N/A - * CaseDescription: 1. call NormalWindow OnTouch, check GSERROR_OK - */ -HWTEST_F(WindowImplTest, OnTouch01, Function | SmallTest | Level2) -{ - PART("CaseDescription") { - STEP("1. call NormalWindow OnTouch, check GSERROR_OK") { - auto wret = normalWindow->OnTouch(nullptr); - STEP_ASSERT_EQ(wret, GSERROR_OK); - } - } -} - -/* - * Function: OnTouch - * Type: Reliability - * Rank: Important(2) - * EnvConditions: N/A - * CaseDescription: 1. call DestroyedWindow OnTouch, check GSERROR_DESTROYED_OBJECT - */ -HWTEST_F(WindowImplTest, OnTouch02, Reliability | SmallTest | Level2) -{ - PART("CaseDescription") { - STEP("1. call DestroyedWindow OnTouch, check GSERROR_DESTROYED_OBJECT") { - auto wret = destroyedWindow->OnTouch(nullptr); - STEP_ASSERT_EQ(wret, GSERROR_DESTROYED_OBJECT); - } - } -} - -/* - * Function: OnKey - * Type: Function - * Rank: Important(2) - * EnvConditions: N/A - * CaseDescription: 1. call NormalWindow OnKey, check GSERROR_OK - */ -HWTEST_F(WindowImplTest, OnKey01, Function | SmallTest | Level2) -{ - PART("CaseDescription") { - STEP("1. call NormalWindow OnKey, check GSERROR_OK") { - auto wret = normalWindow->OnKey(nullptr); - STEP_ASSERT_EQ(wret, GSERROR_OK); - } - } -} - -/* - * Function: OnKey - * Type: Reliability - * Rank: Important(2) - * EnvConditions: N/A - * CaseDescription: 1. call DestroyedWindow OnKey, check GSERROR_DESTROYED_OBJECT - */ -HWTEST_F(WindowImplTest, OnKey02, Reliability | SmallTest | Level2) -{ - PART("CaseDescription") { - STEP("1. call DestroyedWindow OnKey, check GSERROR_DESTROYED_OBJECT") { - auto wret = destroyedWindow->OnKey(nullptr); - STEP_ASSERT_EQ(wret, GSERROR_DESTROYED_OBJECT); - } - } -} - -/* - * Function: RawEvent - * Type: Reliability - * Rank: Important(2) - * EnvConditions: N/A - * CaseDescription: 1. call NormalWindow listen raw event, check GSERROR_OK - */ -HWTEST_F(WindowImplTest, RawEvent01, Reliability | SmallTest | Level2) -{ - PART("CaseDescription") { - STEP("1. call NormalWindow listen raw event, check GSERROR_OK") { - STEP_ASSERT_EQ(normalWindow->OnPointerEnter(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnPointerLeave(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnPointerMotion(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnPointerButton(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnPointerFrame(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnPointerAxis(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnPointerAxisSource(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnPointerAxisStop(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnPointerAxisDiscrete(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnKeyboardKeymap(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnKeyboardEnter(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnKeyboardLeave(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnKeyboardKey(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnKeyboardModifiers(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnKeyboardRepeatInfo(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnTouchDown(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnTouchUp(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnTouchMotion(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnTouchFrame(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnTouchCancel(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnTouchShape(nullptr), GSERROR_OK); - STEP_ASSERT_EQ(normalWindow->OnTouchOrientation(nullptr), GSERROR_OK); - } - } -} - -/* - * Function: RawEvent - * Type: Reliability - * Rank: Important(2) - * EnvConditions: N/A - * CaseDescription: 1. call DestroyedWindow listen raw event, check GSERROR_DESTROYED_OBJECT - */ -HWTEST_F(WindowImplTest, RawEvent02, Reliability | SmallTest | Level2) -{ - PART("CaseDescription") { - STEP("1. call DestroyedWindow listen raw event, check GSERROR_DESTROYED_OBJECT") { - STEP_ASSERT_EQ(destroyedWindow->OnPointerEnter(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnPointerLeave(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnPointerMotion(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnPointerButton(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnPointerFrame(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnPointerAxis(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnPointerAxisSource(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnPointerAxisStop(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnPointerAxisDiscrete(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnKeyboardKeymap(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnKeyboardEnter(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnKeyboardLeave(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnKeyboardKey(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnKeyboardModifiers(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnKeyboardRepeatInfo(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnTouchDown(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnTouchUp(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnTouchMotion(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnTouchFrame(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnTouchCancel(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnTouchShape(nullptr), GSERROR_DESTROYED_OBJECT); - STEP_ASSERT_EQ(destroyedWindow->OnTouchOrientation(nullptr), GSERROR_DESTROYED_OBJECT); - } - } -} } // namespace } // namespace OHOS diff --git a/frameworks/wmtest/BUILD.gn b/frameworks/wmtest/BUILD.gn index caf86046d2..e0b7fee486 100644 --- a/frameworks/wmtest/BUILD.gn +++ b/frameworks/wmtest/BUILD.gn @@ -52,7 +52,6 @@ ohos_executable("wmtest") { "test/wmclient_native_test_13.cpp", "test/wmclient_native_test_14.cpp", "test/wmclient_native_test_15.cpp", - "test/wmclient_native_test_16.cpp", "test/wmclient_native_test_17.cpp", "test/wmclient_native_test_18.cpp", "test/wmclient_native_test_19.cpp", diff --git a/frameworks/wmtest/test/wmclient_native_test_16.cpp b/frameworks/wmtest/test/wmclient_native_test_16.cpp deleted file mode 100644 index d9240b77e4..0000000000 --- a/frameworks/wmtest/test/wmclient_native_test_16.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "wmclient_native_test_16.h" - -#include -#include - -#include -#include - -#include "inative_test.h" -#include "native_test_class.h" -#include "util.h" - -using namespace OHOS; - -namespace { -class WMClientNativeTest16 : public INativeTest { -public: - std::string GetDescription() const override - { - constexpr const char *desc = "listener touch down and SwitchTop"; - return desc; - } - - std::string GetDomain() const override - { - constexpr const char *domain = "wmclient"; - return domain; - } - - int32_t GetID() const override - { - constexpr int32_t id = 16; - return id; - } - - uint32_t GetLastTime() const override - { - constexpr uint32_t lastTime = LAST_TIME_FOREVER; - return lastTime; - } - - void Run(int32_t argc, const char **argv) override - { - auto initRet = WindowManager::GetInstance()->Init(); - if (initRet) { - printf("init failed with %s\n", GSErrorStr(initRet).c_str()); - ExitTest(); - return; - } - - csurface1 = Surface::CreateSurfaceAsConsumer(); - window1 = NativeTestFactory::CreateWindow(WINDOW_TYPE_NORMAL, csurface1); - if (window1 == nullptr) { - printf("NativeTestFactory::CreateWindow return nullptr\n"); - return; - } - - window1->SwitchTop(); - auto surface1 = window1->GetSurface(); - windowSync1 = NativeTestSync::CreateSync(NativeTestDraw::ColorDraw, surface1); - - csurface2 = Surface::CreateSurfaceAsConsumer(); - window2 = NativeTestFactory::CreateWindow(WINDOW_TYPE_NORMAL, csurface2); - if (window2 == nullptr) { - printf("NativeTestFactory::CreateWindow return nullptr\n"); - return; - } - - window2->SwitchTop(); - auto surface2 = window2->GetSurface(); - windowSync2 = NativeTestSync::CreateSync(NativeTestDraw::ColorDraw, surface2); - - auto down1 = [this](void *, uint32_t, uint32_t, int32_t, double, double) { window2->SwitchTop(); }; - auto down2 = [this](void *, uint32_t, uint32_t, int32_t, double, double) { window1->SwitchTop(); }; - window1->OnTouchDown(down1); - window2->OnTouchDown(down2); - - std::vector displays; - WindowManager::GetInstance()->GetDisplays(displays); - if (displays.size() <= 0) { - printf("GetDisplays return no screen\n"); - ExitTest(); - return; - } - auto maxWidth = displays[0].width; - auto maxHeight = displays[0].height; - - constexpr double percent = 0.75; - uint32_t width = percent * maxWidth; - uint32_t height = percent * maxHeight; - - window1->Move(0, 0); - csurface1->SetDefaultWidthAndHeight(width, height); - window1->Resize(width, height); - - window2->Move(maxWidth - width, maxHeight - height); - csurface2->SetDefaultWidthAndHeight(width, height); - window2->Resize(width, height); - } - -private: - sptr csurface1 = nullptr; - sptr window1 = nullptr; - sptr windowSync1 = nullptr; - - sptr csurface2 = nullptr; - sptr window2 = nullptr; - sptr windowSync2 = nullptr; -} g_autoload; -} // namespace diff --git a/frameworks/wmtest/test/wmclient_native_test_16.h b/frameworks/wmtest/test/wmclient_native_test_16.h deleted file mode 100644 index 3ac132cc3a..0000000000 --- a/frameworks/wmtest/test/wmclient_native_test_16.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef FRAMEWORKS_WMTEST_TEST_WMCLIENT_WMCLIENT_NATIVE_TEST_16_H -#define FRAMEWORKS_WMTEST_TEST_WMCLIENT_WMCLIENT_NATIVE_TEST_16_H - -#endif // FRAMEWORKS_WMTEST_TEST_WMCLIENT_WMCLIENT_NATIVE_TEST_16_H diff --git a/frameworks/wmtest/test/wmclient_native_test_27.cpp b/frameworks/wmtest/test/wmclient_native_test_27.cpp index 3d7ddb5993..bfed7973f3 100644 --- a/frameworks/wmtest/test/wmclient_native_test_27.cpp +++ b/frameworks/wmtest/test/wmclient_native_test_27.cpp @@ -92,24 +92,30 @@ public: config.usage = surface->GetDefaultUsage(); freeWindowSync = NativeTestSync::CreateSync(NativeTestDraw::RainbowDraw, surface, &config); - freeWindow->OnTouchDown(std::bind(&WMClientNativeTest27::OnTouchDown, this, TOUCH_DOWN_ARG)); - freeWindow->OnTouchMotion(std::bind(&WMClientNativeTest27::OnTouchMotion, this, TOUCH_MOTION_ARG)); freeWindow->OnSizeChange(onSizeChange); constexpr int32_t width = 300; constexpr int32_t height = 300; freeWindow->Resize(width, height); + ListenWindowTouchEvent(freeWindow->GetID()); } - void OnTouchDown(void *, uint32_t serial, uint32_t time, int32_t id, double x, double y) + bool OnTouch(const TouchEvent &event) override { - downX = x; - downY = y; - } + int32_t x = event.GetPointerPosition(event.GetIndex()).GetX(); + int32_t y = event.GetPointerPosition(event.GetIndex()).GetY(); + if (event.GetAction() == TouchEnum::PRIMARY_POINT_DOWN) { + downX = x; + downY = y; + return false; + } - void OnTouchMotion(void *, uint32_t time, int32_t id, double x, double y) - { - freeWindow->Move(freeWindow->GetX() + x - downX, freeWindow->GetY() + y - downY) - ->Then(std::bind(&WMClientNativeTest27::OnMoveReturn, this, std::placeholders::_1)); + if (event.GetAction() == TouchEnum::POINT_MOVE) { + freeWindow->Move(freeWindow->GetX() + x - downX, freeWindow->GetY() + y - downY) + ->Then(std::bind(&WMClientNativeTest27::OnMoveReturn, this, std::placeholders::_1)); + return false; + } + + return true; } void OnMoveReturn(const GSError &err) diff --git a/interfaces/innerkits/wmclient/window.h b/interfaces/innerkits/wmclient/window.h index cb826678da..dd9aa40de8 100644 --- a/interfaces/innerkits/wmclient/window.h +++ b/interfaces/innerkits/wmclient/window.h @@ -20,7 +20,6 @@ #include #include -#include "window_manager_input_type.h" #include "window_manager_type.h" namespace OHOS { @@ -61,34 +60,6 @@ public: // listener virtual GSError OnTouch(OnTouchFunc cb) = 0; virtual GSError OnKey(OnKeyFunc cb) = 0; - - // pointer listener - virtual GSError OnPointerEnter(PointerEnterFunc func) = 0; - virtual GSError OnPointerLeave(PointerLeaveFunc func) = 0; - virtual GSError OnPointerMotion(PointerMotionFunc func) = 0; - virtual GSError OnPointerButton(PointerButtonFunc func) = 0; - virtual GSError OnPointerFrame(PointerFrameFunc func) = 0; - virtual GSError OnPointerAxis(PointerAxisFunc func) = 0; - virtual GSError OnPointerAxisSource(PointerAxisSourceFunc func) = 0; - virtual GSError OnPointerAxisStop(PointerAxisStopFunc func) = 0; - virtual GSError OnPointerAxisDiscrete(PointerAxisDiscreteFunc func) = 0; - - // keyboard listener - virtual GSError OnKeyboardKeymap(KeyboardKeymapFunc func) = 0; - virtual GSError OnKeyboardEnter(KeyboardEnterFunc func) = 0; - virtual GSError OnKeyboardLeave(KeyboardLeaveFunc func) = 0; - virtual GSError OnKeyboardKey(KeyboardKeyFunc func) = 0; - virtual GSError OnKeyboardModifiers(KeyboardModifiersFunc func) = 0; - virtual GSError OnKeyboardRepeatInfo(KeyboardRepeatInfoFunc func) = 0; - - // touch listener - virtual GSError OnTouchDown(TouchDownFunc func) = 0; - virtual GSError OnTouchUp(TouchUpFunc func) = 0; - virtual GSError OnTouchMotion(TouchMotionFunc func) = 0; - virtual GSError OnTouchFrame(TouchFrameFunc func) = 0; - virtual GSError OnTouchCancel(TouchCancelFunc func) = 0; - virtual GSError OnTouchShape(TouchShapeFunc func) = 0; - virtual GSError OnTouchOrientation(TouchOrientationFunc func) = 0; }; } // namespace OHOS diff --git a/interfaces/innerkits/wmclient/window_manager_input_type.h b/interfaces/innerkits/wmclient/window_manager_input_type.h deleted file mode 100644 index 4ff2ddf95a..0000000000 --- a/interfaces/innerkits/wmclient/window_manager_input_type.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef INTERFACES_INNERKITS_WMCLIENT_WINDOW_MANAGER_INPUT_TYPE_H -#define INTERFACES_INNERKITS_WMCLIENT_WINDOW_MANAGER_INPUT_TYPE_H - -#include - -namespace OHOS { -enum PointerButtonState { - POINTER_BUTTON_STATE_RELEASED, - POINTER_BUTTON_STATE_PRESSED, -}; - -enum PointerAxis { - POINTER_AXIS_VERTICAL_SCROLL, - POINTER_AXIS_HORIZONTAL_SCROLL, -}; - -enum PointerAxisSource { - POINTER_AXIS_SOURCE_WHEEL, - POINTER_AXIS_SOURCE_FINGER, - POINTER_AXIS_SOURCE_CONTINUOUS, - POINTER_AXIS_SOURCE_WHEEL_TILT, -}; - -enum KeyboardKeymapFormat { - KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP, - KEYBOARD_KEYMAP_FORMAT_XKB_V1, -}; - -enum KeyboardKeyState { - KEYBOARD_KEY_STATE_RELEASED, - KEYBOARD_KEY_STATE_PRESSED, -}; - -#define __BIND1_ARGS ::std::placeholders::_1 -#define __BIND2_ARGS __BIND1_ARGS, ::std::placeholders::_2 -#define __BIND3_ARGS __BIND2_ARGS, ::std::placeholders::_3 -#define __BIND4_ARGS __BIND3_ARGS, ::std::placeholders::_4 -#define __BIND5_ARGS __BIND4_ARGS, ::std::placeholders::_5 -#define __BIND6_ARGS __BIND5_ARGS, ::std::placeholders::_6 -#define __BIND7_ARGS __BIND6_ARGS, ::std::placeholders::_7 -#define __BIND8_ARGS __BIND7_ARGS, ::std::placeholders::_8 - -#define POINTER_ENTER_ARG __BIND4_ARGS -using PointerEnterFunc = std::function; - -#define POINTER_LEAVE_ARG __BIND2_ARGS -using PointerLeaveFunc = std::function; - -#define POINTER_MOTION_ARG __BIND4_ARGS -using PointerMotionFunc = std::function; - -#define POINTER_BUTTON_ARG __BIND5_ARGS -using PointerButtonFunc = std::function; - -#define POINTER_FRAME_ARG __BIND1_ARGS -using PointerFrameFunc = std::function; - -#define POINTER_AXIS_ARG __BIND4_ARGS -using PointerAxisFunc = std::function; - -#define POINTER_AXIS_SOURCE_ARG __BIND2_ARGS -using PointerAxisSourceFunc = std::function; - -#define POINTER_AXIS_STOP_ARG __BIND3_ARGS -using PointerAxisStopFunc = std::function; - -#define POINTER_AXIS_DISCRETE_ARG __BIND3_ARGS -using PointerAxisDiscreteFunc = std::function; - -#define KEYBOARD_KEYMAP_ARG __BIND4_ARGS -using KeyboardKeymapFunc = std::function; - -#define KEYBOARD_ENTER_ARG __BIND3_ARGS -using KeyboardEnterFunc = std::function &keys)>; - -#define KEYBOARD_LEAVE_ARG __BIND2_ARGS -using KeyboardLeaveFunc = std::function; - -#define KEYBOARD_KEY_ARG __BIND5_ARGS -using KeyboardKeyFunc = std::function; - -#define KEYBOARD_MODIFIERS_ARG __BIND6_ARGS -using KeyboardModifiersFunc = std::function; - -#define KEYBOARD_REPEAT_INFO_ARG __BIND3_ARGS -using KeyboardRepeatInfoFunc = std::function; - -#define TOUCH_DOWN_ARG __BIND6_ARGS -using TouchDownFunc = std::function; - -#define TOUCH_UP_ARG __BIND4_ARGS -using TouchUpFunc = std::function; - -#define TOUCH_MOTION_ARG __BIND5_ARGS -using TouchMotionFunc = std::function; - -#define TOUCH_FRAME_ARG __BIND1_ARGS -using TouchFrameFunc = std::function; - -#define TOUCH_CANCEL_ARG __BIND1_ARGS -using TouchCancelFunc = std::function; - -#define TOUCH_SHAPE_ARG __BIND4_ARGS -using TouchShapeFunc = std::function; - -#define TOUCH_ORIENTATION_ARG __BIND3_ARGS -using TouchOrientationFunc = std::function; -} // namespace OHOS - -#endif // INTERFACES_INNERKITS_WMCLIENT_WINDOW_MANAGER_INPUT_TYPE_H diff --git a/interfaces/innerkits/wmclient/wm_common.h b/interfaces/innerkits/wmclient/wm_common.h index 4a4105202e..ea12f0d384 100644 --- a/interfaces/innerkits/wmclient/wm_common.h +++ b/interfaces/innerkits/wmclient/wm_common.h @@ -129,14 +129,8 @@ class TouchEvent; class KeyEvent; using funcWindowInfoChange = std::function; - -using funcOnKey = std::function; -using funcOnTouch = std::function; - -using WindowInfoChangeFunc = std::function; using OnKeyFunc = std::function; using OnTouchFunc = std::function; - using WindowPositionChangeFunc = std::function; using WindowSizeChangeFunc = std::function; using WindowVisibilityChangeFunc = std::function;