From 25b9756cc6a043f5e438d8cd17fa02be531c518f Mon Sep 17 00:00:00 2001 From: l00574490 Date: Sat, 30 Jul 2022 18:33:30 +0800 Subject: [PATCH] modify point down Signed-off-by: l00574490 Change-Id: Ie7e95cec03d67fe2a6eb916ea9d8aeb5c22c39ae --- .../wms/windowipc_fuzzer/windowipc_fuzzer.cpp | 2 + .../wms/window_touch_outside_test.cpp | 47 ++++--------------- wm/include/vsync_station.h | 1 - wm/include/window_adapter.h | 3 +- wm/src/vsync_station.cpp | 7 --- wm/src/window_adapter.cpp | 12 ++++- wm/src/window_impl.cpp | 15 +++--- wmserver/include/window_controller.h | 3 +- wmserver/include/window_inner_manager.h | 2 +- wmserver/include/window_manager_service.h | 3 +- .../include/zidl/window_manager_interface.h | 4 +- wmserver/include/zidl/window_manager_proxy.h | 3 +- wmserver/src/window_controller.cpp | 30 ++++++++---- wmserver/src/window_inner_manager.cpp | 4 +- wmserver/src/window_manager_service.cpp | 13 +++-- wmserver/src/zidl/window_manager_proxy.cpp | 21 ++++++++- wmserver/src/zidl/window_manager_stub.cpp | 9 +++- 17 files changed, 100 insertions(+), 79 deletions(-) diff --git a/test/fuzztest/wms/windowipc_fuzzer/windowipc_fuzzer.cpp b/test/fuzztest/wms/windowipc_fuzzer/windowipc_fuzzer.cpp index 90d1f2fe..6ed5984e 100644 --- a/test/fuzztest/wms/windowipc_fuzzer/windowipc_fuzzer.cpp +++ b/test/fuzztest/wms/windowipc_fuzzer/windowipc_fuzzer.cpp @@ -110,6 +110,8 @@ void IPCSpecificInterfaceFuzzTest1(sptr proxy, MessageParcel& sen sendData, reply, option); proxy->SendRequest(static_cast(IWindowManager::WindowManagerMessage::TRANS_ID_GET_TOP_WINDOW_ID), sendData, reply, option); + proxy->SendRequest(static_cast(IWindowManager::WindowManagerMessage::TRANS_ID_NOTIFY_READY_MOVE_OR_DRAG), + sendData, reply, option); proxy->SendRequest(static_cast(IWindowManager::WindowManagerMessage::TRANS_ID_PROCESS_POINT_DOWN), sendData, reply, option); proxy->SendRequest(static_cast(IWindowManager::WindowManagerMessage::TRANS_ID_PROCESS_POINT_UP), diff --git a/test/systemtest/wms/window_touch_outside_test.cpp b/test/systemtest/wms/window_touch_outside_test.cpp index 59d129f6..02b8935b 100644 --- a/test/systemtest/wms/window_touch_outside_test.cpp +++ b/test/systemtest/wms/window_touch_outside_test.cpp @@ -19,7 +19,6 @@ #include "singleton_container.h" #include "wm_common.h" #include "window_adapter.h" -#include "window_impl.h" #include "window_test_utils.h" using namespace testing; @@ -113,17 +112,10 @@ namespace { */ HWTEST_F(WindowTouchOutsideTest, onTouchInside, Function | MediumTest | Level3) { - sptr option = new WindowOption(); - option->SetWindowName(firstWindowInfo_.name); - option->SetWindowMode(firstWindowInfo_.mode); - option->SetWindowType(firstWindowInfo_.type); - option->SetWindowRect(firstWindowInfo_.rect); - sptr firstWindow = new WindowImpl(option); - firstWindow->Create(""); + const sptr &firstWindow = Utils::CreateTestWindow(firstWindowInfo_); firstWindow->RegisterTouchOutsideListener(windowlistener1_); firstWindow->Show(); - SingletonContainer::Get().ProcessPointDown(firstWindow->GetWindowId(), - firstWindow->property_, firstWindow->moveDragProperty_); + SingletonContainer::Get().ProcessPointDown(firstWindow->GetWindowId()); usleep(WAIT_CALLBACK_US); ASSERT_TRUE(!windowlistener1_->isTouchOutside_); firstWindow->Destroy(); @@ -138,18 +130,10 @@ HWTEST_F(WindowTouchOutsideTest, onTouchOutside, Function | MediumTest | Level3) { const sptr &firstWindow = Utils::CreateTestWindow(firstWindowInfo_); firstWindow->RegisterTouchOutsideListener(windowlistener1_); - - sptr secondOption = new WindowOption(); - secondOption->SetWindowName(secondWindowInfo_.name); - secondOption->SetWindowMode(secondWindowInfo_.mode); - secondOption->SetWindowType(secondWindowInfo_.type); - secondOption->SetWindowRect(secondWindowInfo_.rect); - sptr secondWindow = new WindowImpl(secondOption); - secondWindow->Create(""); + const sptr &secondWindow = Utils::CreateTestWindow(secondWindowInfo_); firstWindow->Show(); secondWindow->Show(); - SingletonContainer::Get().ProcessPointDown(secondWindow->GetWindowId(), - secondWindow->property_, secondWindow->moveDragProperty_); + SingletonContainer::Get().ProcessPointDown(secondWindow->GetWindowId()); usleep(WAIT_CALLBACK_US); ASSERT_TRUE(windowlistener1_->isTouchOutside_); firstWindow->Destroy(); @@ -165,17 +149,9 @@ HWTEST_F(WindowTouchOutsideTest, onTouchOutsideNotShow, Function | MediumTest | { const sptr &firstWindow = Utils::CreateTestWindow(firstWindowInfo_); firstWindow->RegisterTouchOutsideListener(windowlistener1_); - - sptr secondOption = new WindowOption(); - secondOption->SetWindowName(secondWindowInfo_.name); - secondOption->SetWindowMode(secondWindowInfo_.mode); - secondOption->SetWindowType(secondWindowInfo_.type); - secondOption->SetWindowRect(secondWindowInfo_.rect); - sptr secondWindow = new WindowImpl(secondOption); - secondWindow->Create(""); + const sptr &secondWindow = Utils::CreateTestWindow(secondWindowInfo_); secondWindow->Show(); - SingletonContainer::Get().ProcessPointDown(secondWindow->GetWindowId(), - secondWindow->property_, secondWindow->moveDragProperty_); + SingletonContainer::Get().ProcessPointDown(secondWindow->GetWindowId()); usleep(WAIT_CALLBACK_US); ASSERT_TRUE(!windowlistener1_->isTouchOutside_); firstWindow->Destroy(); @@ -197,16 +173,9 @@ HWTEST_F(WindowTouchOutsideTest, onTouchOutsideForAllWindow, Function | MediumTe firstWindow->Show(); secondWindow->Show(); - sptr thirdOption = new WindowOption(); - thirdOption->SetWindowName(thirdWindowInfo_.name); - thirdOption->SetWindowMode(thirdWindowInfo_.mode); - thirdOption->SetWindowType(thirdWindowInfo_.type); - thirdOption->SetWindowRect(thirdWindowInfo_.rect); - sptr thirdWindow = new WindowImpl(thirdOption); - thirdWindow->Create(""); + const sptr &thirdWindow = Utils::CreateTestWindow(thirdWindowInfo_); thirdWindow->Show(); - SingletonContainer::Get().ProcessPointDown(thirdWindow->GetWindowId(), - thirdWindow->property_, thirdWindow->moveDragProperty_); + SingletonContainer::Get().ProcessPointDown(thirdWindow->GetWindowId()); usleep(WAIT_CALLBACK_US); ASSERT_TRUE(windowlistener1_->isTouchOutside_); ASSERT_TRUE(windowlistener2_->isTouchOutside_); diff --git a/wm/include/vsync_station.h b/wm/include/vsync_station.h index 075b4b3d..ec63fbf5 100644 --- a/wm/include/vsync_station.h +++ b/wm/include/vsync_station.h @@ -54,7 +54,6 @@ private: void OnVsyncTimeOut(); std::mutex mtx_; - uint32_t vsyncCount_ = 0; bool hasRequestedVsync_ = false; bool hasInitVsyncReceiver_ = false; bool isMainHandlerAvailable_ = true; diff --git a/wm/include/window_adapter.h b/wm/include/window_adapter.h index 6843abe5..8ef9ed56 100644 --- a/wm/include/window_adapter.h +++ b/wm/include/window_adapter.h @@ -43,8 +43,9 @@ public: virtual WMError RequestFocus(uint32_t windowId); virtual WMError GetAvoidAreaByType(uint32_t windowId, AvoidAreaType type, AvoidArea& avoidRect); virtual WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId); - virtual void ProcessPointDown(uint32_t windowId, sptr& windowProperty, + virtual void NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr& windowProperty, sptr& moveDragProperty); + virtual void ProcessPointDown(uint32_t windowId); virtual void ProcessPointUp(uint32_t windowId); virtual void MinimizeAllAppWindows(DisplayId displayId); virtual WMError ToggleShownStateForAllAppWindows(); diff --git a/wm/src/vsync_station.cpp b/wm/src/vsync_station.cpp index 9efc9002..d115df1d 100644 --- a/wm/src/vsync_station.cpp +++ b/wm/src/vsync_station.cpp @@ -56,10 +56,6 @@ void VsyncStation::RequestVsync(const std::shared_ptr& vsyncCallb return; } hasRequestedVsync_ = true; - vsyncCount_++; - if (vsyncCount_ & 0x01) { // write log every 2 vsync - WLOGFD("Request next vsync."); - } vsyncHandler_->RemoveTask(VSYNC_TIME_OUT_TASK); vsyncHandler_->PostTask(vsyncTimeoutCallback_, VSYNC_TIME_OUT_TASK, VSYNC_TIME_OUT_MILLISECONDS); } @@ -82,9 +78,6 @@ void VsyncStation::VsyncCallbackInner(int64_t timestamp) vsyncCallbacks = vsyncCallbacks_; vsyncCallbacks_.clear(); vsyncHandler_->RemoveTask(VSYNC_TIME_OUT_TASK); - if (vsyncCount_ & 0x01) { // write log every 2 vsync - WLOGFD("[WM] On vsync callback."); - } } for (const auto& callback: vsyncCallbacks) { callback->onCallback(timestamp); diff --git a/wm/src/window_adapter.cpp b/wm/src/window_adapter.cpp index 9e3223bd..eabe9bfe 100644 --- a/wm/src/window_adapter.cpp +++ b/wm/src/window_adapter.cpp @@ -106,13 +106,21 @@ WMError WindowAdapter::GetAvoidAreaByType(uint32_t windowId, AvoidAreaType type, return WMError::WM_OK; } -void WindowAdapter::ProcessPointDown(uint32_t windowId, sptr& windowProperty, +void WindowAdapter::NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr& windowProperty, sptr& moveDragProperty) { INIT_PROXY_CHECK_RETURN(); - return windowManagerServiceProxy_->ProcessPointDown(windowId, windowProperty, moveDragProperty); + return windowManagerServiceProxy_->NotifyServerReadyToMoveOrDrag(windowId, windowProperty, moveDragProperty); } + +void WindowAdapter::ProcessPointDown(uint32_t windowId) +{ + INIT_PROXY_CHECK_RETURN(); + + return windowManagerServiceProxy_->ProcessPointDown(windowId); +} + void WindowAdapter::ProcessPointUp(uint32_t windowId) { INIT_PROXY_CHECK_RETURN(); diff --git a/wm/src/window_impl.cpp b/wm/src/window_impl.cpp index 9de4d856..308e87fe 100755 --- a/wm/src/window_impl.cpp +++ b/wm/src/window_impl.cpp @@ -1091,8 +1091,7 @@ WMError WindowImpl::Show(uint32_t reason, bool withAnimation) SingletonContainer::Get().MinimizeAllAppWindows(property_->GetDisplayId()); } else { WLOGFI("window is already shown id: %{public}u, raise to top", property_->GetWindowId()); - SingletonContainer::Get().ProcessPointDown(property_->GetWindowId(), - property_, moveDragProperty_); + SingletonContainer::Get().ProcessPointDown(property_->GetWindowId()); } NotifyAfterForeground(false); return WMError::WM_OK; @@ -1539,7 +1538,8 @@ void WindowImpl::StartMove() return; } moveDragProperty_->startMoveFlag_ = true; - SingletonContainer::Get().ProcessPointDown(property_->GetWindowId(), property_, moveDragProperty_); + SingletonContainer::Get().NotifyServerReadyToMoveOrDrag(property_->GetWindowId(), + property_, moveDragProperty_); WLOGFI("[StartMove] windowId %{public}u", GetWindowId()); } @@ -2151,7 +2151,7 @@ void WindowImpl::ReadyToMoveOrDragWindow(int32_t globalX, int32_t globalY, int32 if (GetType() == WindowType::WINDOW_TYPE_DOCK_SLICE) { moveDragProperty_->startMoveFlag_ = true; - SingletonContainer::Get().ProcessPointDown(property_->GetWindowId(), + SingletonContainer::Get().NotifyServerReadyToMoveOrDrag(property_->GetWindowId(), property_, moveDragProperty_); } else if (!WindowHelper::IsPointInTargetRect(moveDragProperty_->startPointPosX_, moveDragProperty_->startPointPosY_, moveDragProperty_->startRectExceptFrame_) || @@ -2161,7 +2161,7 @@ void WindowImpl::ReadyToMoveOrDragWindow(int32_t globalX, int32_t globalY, int32 moveDragProperty_->startPointPosY_, moveDragProperty_->startRectExceptCorner_)))) { moveDragProperty_->startDragFlag_ = true; UpdateDragType(); - SingletonContainer::Get().ProcessPointDown(property_->GetWindowId(), + SingletonContainer::Get().NotifyServerReadyToMoveOrDrag(property_->GetWindowId(), property_, moveDragProperty_); } @@ -2256,8 +2256,7 @@ void WindowImpl::ConsumePointerEvent(const std::shared_ptr& p return; } } - SingletonContainer::Get().ProcessPointDown(property_->GetWindowId(), - property_, moveDragProperty_); + SingletonContainer::Get().ProcessPointDown(property_->GetWindowId()); } // If point event type is up, should reset start move flag @@ -2468,7 +2467,7 @@ void WindowImpl::NotifyTouchOutside() void WindowImpl::NotifyTouchDialogTarget() { std::vector> dialogTargetTouchListeners; - SingletonContainer::Get().ProcessPointDown(property_->GetWindowId(), property_, moveDragProperty_); + SingletonContainer::Get().ProcessPointDown(property_->GetWindowId()); { std::lock_guard lock(mutex_); dialogTargetTouchListeners = dialogTargetTouchListeners_; diff --git a/wmserver/include/window_controller.h b/wmserver/include/window_controller.h index c8515c1a..575ecb46 100644 --- a/wmserver/include/window_controller.h +++ b/wmserver/include/window_controller.h @@ -48,7 +48,8 @@ public: WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId); void NotifyDisplayStateChange(DisplayId defaultDisplayId, sptr displayInfo, const std::map>& displayInfoMap, DisplayStateChangeType type); - WMError ProcessPointDown(uint32_t windowId, sptr& moveDragProperty); + WMError NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr& moveDragProperty); + WMError ProcessPointDown(uint32_t windowId); WMError ProcessPointUp(uint32_t windowId); void MinimizeAllAppWindows(DisplayId displayId); WMError ToggleShownStateForAllAppWindows(); diff --git a/wmserver/include/window_inner_manager.h b/wmserver/include/window_inner_manager.h index 90d438d1..8a57230d 100644 --- a/wmserver/include/window_inner_manager.h +++ b/wmserver/include/window_inner_manager.h @@ -51,7 +51,7 @@ public: void MinimizeAbility(const wptr &node, bool isFromUser); void ConsumePointerEvent(const std::shared_ptr& pointerEvent); - bool NotifyWindowReadyToMoveOrDrag(uint32_t windowId, sptr& windowProperty, + bool NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr& windowProperty, sptr& moveDragProperty); void NotifyWindowEndUpMovingOrDragging(uint32_t windowId); void NotifyWindowRemovedOrDestroyed(uint32_t windowId); diff --git a/wmserver/include/window_manager_service.h b/wmserver/include/window_manager_service.h index 8cc6e717..e05ed1d2 100644 --- a/wmserver/include/window_manager_service.h +++ b/wmserver/include/window_manager_service.h @@ -90,8 +90,9 @@ public: WMError DestroyWindow(uint32_t windowId, bool onlySelf = false) override; WMError RequestFocus(uint32_t windowId) override; AvoidArea GetAvoidAreaByType(uint32_t windowId, AvoidAreaType avoidAreaType) override; - void ProcessPointDown(uint32_t windowId, sptr& windowProperty, + void NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr& windowProperty, sptr& moveDragProperty) override; + void ProcessPointDown(uint32_t windowId) override; void ProcessPointUp(uint32_t windowId) override; WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId) override; void MinimizeAllAppWindows(DisplayId displayId) override; diff --git a/wmserver/include/zidl/window_manager_interface.h b/wmserver/include/zidl/window_manager_interface.h index 05813bcc..5f1619c1 100644 --- a/wmserver/include/zidl/window_manager_interface.h +++ b/wmserver/include/zidl/window_manager_interface.h @@ -62,6 +62,7 @@ public: TRANS_ID_UPDATE_AVOIDAREA_LISTENER, TRANS_ID_UPDATE_RS_TREE, TRANS_ID_BIND_DIALOG_TARGET, + TRANS_ID_NOTIFY_READY_MOVE_OR_DRAG, }; virtual WMError CreateWindow(sptr& window, sptr& property, const std::shared_ptr& surfaceNode, @@ -72,8 +73,9 @@ public: virtual WMError RequestFocus(uint32_t windowId) = 0; virtual AvoidArea GetAvoidAreaByType(uint32_t windowId, AvoidAreaType type) = 0; virtual WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId) = 0; - virtual void ProcessPointDown(uint32_t windowId, sptr& windowProperty, + virtual void NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr& windowProperty, sptr& moveDragProperty) = 0; + virtual void ProcessPointDown(uint32_t windowId) = 0; virtual void ProcessPointUp(uint32_t windowId) = 0; virtual void MinimizeAllAppWindows(DisplayId displayId) = 0; virtual WMError ToggleShownStateForAllAppWindows() = 0; diff --git a/wmserver/include/zidl/window_manager_proxy.h b/wmserver/include/zidl/window_manager_proxy.h index c4a2b12e..3a77c0ed 100644 --- a/wmserver/include/zidl/window_manager_proxy.h +++ b/wmserver/include/zidl/window_manager_proxy.h @@ -38,8 +38,9 @@ public: WMError RequestFocus(uint32_t windowId) override; AvoidArea GetAvoidAreaByType(uint32_t windowId, AvoidAreaType type) override; WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId) override; - void ProcessPointDown(uint32_t windowId, sptr& windowProperty, + void NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr& windowProperty, sptr& moveDragProperty) override; + void ProcessPointDown(uint32_t windowId) override; void ProcessPointUp(uint32_t windowId) override; void MinimizeAllAppWindows(DisplayId displayId) override; WMError ToggleShownStateForAllAppWindows() override; diff --git a/wmserver/src/window_controller.cpp b/wmserver/src/window_controller.cpp index 1b53d32b..83186ebc 100644 --- a/wmserver/src/window_controller.cpp +++ b/wmserver/src/window_controller.cpp @@ -663,7 +663,28 @@ AvoidArea WindowController::GetAvoidAreaByType(uint32_t windowId, AvoidAreaType return windowRoot_->GetAvoidAreaByType(windowId, avoidAreaType); } -WMError WindowController::ProcessPointDown(uint32_t windowId, sptr& moveDragProperty) +WMError WindowController::NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr& moveDragProperty) +{ + auto node = windowRoot_->GetWindowNode(windowId); + if (node == nullptr) { + WLOGFW("could not find window"); + return WMError::WM_ERROR_NULLPTR; + } + if (!node->currentVisibility_) { + WLOGFE("this window is not visible and not in window tree, windowId: %{public}u", windowId); + return WMError::WM_ERROR_INVALID_OPERATION; + } + + // if start dragging or start moving dock_slice, need to update size change reason + if ((moveDragProperty->startMoveFlag_ && node->GetWindowType() == WindowType::WINDOW_TYPE_DOCK_SLICE) || + moveDragProperty->startDragFlag_) { + WMError res = windowRoot_->UpdateSizeChangeReason(windowId, WindowSizeChangeReason::DRAG_START); + return res; + } + return WMError::WM_OK; +} + +WMError WindowController::ProcessPointDown(uint32_t windowId) { auto node = windowRoot_->GetWindowNode(windowId); if (node == nullptr) { @@ -677,13 +698,6 @@ WMError WindowController::ProcessPointDown(uint32_t windowId, sptrstartMoveFlag_ && node->GetWindowType() == WindowType::WINDOW_TYPE_DOCK_SLICE) || - moveDragProperty->startDragFlag_) { - WMError res = windowRoot_->UpdateSizeChangeReason(windowId, WindowSizeChangeReason::DRAG_START); - return res; - } - WLOGFI("process point down, windowId: %{public}u", windowId); WMError zOrderRes = windowRoot_->RaiseZOrderForAppWindow(node); WMError focusRes = windowRoot_->RequestFocus(windowId); diff --git a/wmserver/src/window_inner_manager.cpp b/wmserver/src/window_inner_manager.cpp index 7a008f88..6a00415a 100644 --- a/wmserver/src/window_inner_manager.cpp +++ b/wmserver/src/window_inner_manager.cpp @@ -203,7 +203,7 @@ pid_t WindowInnerManager::GetPid() return pid_; } -bool WindowInnerManager::NotifyWindowReadyToMoveOrDrag(uint32_t windowId, sptr& windowProperty, +bool WindowInnerManager::NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr& windowProperty, sptr& moveDragProperty) { if (moveDragController_->GetActiveWindowId() != INVALID_WINDOW_ID) { @@ -211,7 +211,7 @@ bool WindowInnerManager::NotifyWindowReadyToMoveOrDrag(uint32_t windowId, sptrHandleReadyToMoveOrDrag(windowId, windowProperty, moveDragProperty); - WLOGFI("NotifyWindowReadyToMoveOrDrag, windowId: %{public}u", windowId); + WLOGFI("NotifyServerReadyToMoveOrDrag, windowId: %{public}u", windowId); return true; } diff --git a/wmserver/src/window_manager_service.cpp b/wmserver/src/window_manager_service.cpp index 4b818e29..c5f03eed 100644 --- a/wmserver/src/window_manager_service.cpp +++ b/wmserver/src/window_manager_service.cpp @@ -711,7 +711,7 @@ void DisplayChangeListener::OnScreenshot(DisplayId displayId) WindowManagerService::GetInstance().OnScreenshot(displayId); } -void WindowManagerService::ProcessPointDown(uint32_t windowId, sptr& windowProperty, +void WindowManagerService::NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr& windowProperty, sptr& moveDragProperty) { if (windowProperty == nullptr || moveDragProperty == nullptr) { @@ -721,7 +721,7 @@ void WindowManagerService::ProcessPointDown(uint32_t windowId, sptrstartDragFlag_ || moveDragProperty->startMoveFlag_) { - bool res = WindowInnerManager::GetInstance().NotifyWindowReadyToMoveOrDrag(windowId, + bool res = WindowInnerManager::GetInstance().NotifyServerReadyToMoveOrDrag(windowId, windowProperty, moveDragProperty); if (!res) { WLOGFE("invalid operation"); @@ -729,7 +729,14 @@ void WindowManagerService::ProcessPointDown(uint32_t windowId, sptrInterceptInputEventToServer(windowId); } - windowController_->ProcessPointDown(windowId, moveDragProperty); + windowController_->NotifyServerReadyToMoveOrDrag(windowId, moveDragProperty); + }); +} + +void WindowManagerService::ProcessPointDown(uint32_t windowId) +{ + PostAsyncTask([this, windowId]() { + windowController_->ProcessPointDown(windowId); }); } diff --git a/wmserver/src/zidl/window_manager_proxy.cpp b/wmserver/src/zidl/window_manager_proxy.cpp index 633374bd..a1dbc886 100644 --- a/wmserver/src/zidl/window_manager_proxy.cpp +++ b/wmserver/src/zidl/window_manager_proxy.cpp @@ -280,7 +280,7 @@ WMError WindowManagerProxy::SetWindowAnimationController(const sptr(ret); } -void WindowManagerProxy::ProcessPointDown(uint32_t windowId, sptr& windowProperty, +void WindowManagerProxy::NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr& windowProperty, sptr& moveDragProperty) { MessageParcel data; @@ -302,6 +302,25 @@ void WindowManagerProxy::ProcessPointDown(uint32_t windowId, sptrSendRequest(static_cast(WindowManagerMessage::TRANS_ID_NOTIFY_READY_MOVE_OR_DRAG), + data, reply, option) != ERR_NONE) { + WLOGFE("SendRequest failed"); + } +} + +void WindowManagerProxy::ProcessPointDown(uint32_t windowId) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(GetDescriptor())) { + WLOGFE("WriteInterfaceToken failed"); + return; + } + if (!data.WriteUint32(windowId)) { + WLOGFE("Write windowId failed"); + return; + } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_PROCESS_POINT_DOWN), data, reply, option) != ERR_NONE) { WLOGFE("SendRequest failed"); diff --git a/wmserver/src/zidl/window_manager_stub.cpp b/wmserver/src/zidl/window_manager_stub.cpp index 23058e23..7493d690 100644 --- a/wmserver/src/zidl/window_manager_stub.cpp +++ b/wmserver/src/zidl/window_manager_stub.cpp @@ -98,11 +98,16 @@ int32_t WindowManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M UnregisterWindowManagerAgent(type, windowManagerAgentProxy); break; } - case WindowManagerMessage::TRANS_ID_PROCESS_POINT_DOWN: { + case WindowManagerMessage::TRANS_ID_NOTIFY_READY_MOVE_OR_DRAG: { uint32_t windowId = data.ReadUint32(); sptr windowProperty = data.ReadStrongParcelable(); sptr moveDragProperty = data.ReadStrongParcelable(); - ProcessPointDown(windowId, windowProperty, moveDragProperty); + NotifyServerReadyToMoveOrDrag(windowId, windowProperty, moveDragProperty); + break; + } + case WindowManagerMessage::TRANS_ID_PROCESS_POINT_DOWN: { + uint32_t windowId = data.ReadUint32(); + ProcessPointDown(windowId); break; } case WindowManagerMessage::TRANS_ID_PROCESS_POINT_UP: {