diff --git a/utils/include/window_property.h b/utils/include/window_property.h index afe2e98e8112561d735c3396c45c6019cc8611fa..ad5da828e92a54e5722c1b8253d617fde313c8f7 100644 --- a/utils/include/window_property.h +++ b/utils/include/window_property.h @@ -75,7 +75,6 @@ public: private: std::string windowName_; Rect windowRect_ { 0, 0, 0, 0 }; - Rect hotZoneRect_ { 0, 0, 0, 0 }; WindowType type_ { WindowType::WINDOW_TYPE_APP_MAIN_WINDOW }; WindowMode mode_ { WindowMode::WINDOW_MODE_FULLSCREEN }; WindowBlurLevel level_ { WindowBlurLevel::WINDOW_BLUR_OFF }; diff --git a/utils/src/window_property.cpp b/utils/src/window_property.cpp index fdb6ea9675face5a8b77766ba4c3033b7278870c..2fa6feee64890a32a74d78cb4e58105d80a7a203 100644 --- a/utils/src/window_property.cpp +++ b/utils/src/window_property.cpp @@ -29,14 +29,6 @@ void WindowProperty::SetWindowRect(const struct Rect& rect) windowRect_ = rect; } -void WindowProperty::SetWindowHotZoneRect(const struct Rect& rect) -{ - hotZoneRect_.posX_ = rect.posX_ - HOTZONE; - hotZoneRect_.posY_ = rect.posY_ - HOTZONE; - hotZoneRect_.width_ = rect.width_ + HOTZONE + HOTZONE; - hotZoneRect_.height_ = rect.height_ + HOTZONE + HOTZONE; -} - void WindowProperty::SetWindowType(WindowType type) { type_ = type; @@ -133,11 +125,6 @@ Rect WindowProperty::GetWindowRect() const return windowRect_; } -Rect WindowProperty::GetWindowHotZoneRect() const -{ - return hotZoneRect_; -} - WindowType WindowProperty::GetWindowType() const { return type_; diff --git a/wm/include/window_impl.h b/wm/include/window_impl.h index f6ae115dc931a7e5cd2956b5f192fb81963d2bdd..91a946054cd2d24298ed36f6ea118fd0e79f12f3 100644 --- a/wm/include/window_impl.h +++ b/wm/include/window_impl.h @@ -150,7 +150,6 @@ private: void OnVsync(int64_t timeStamp); static sptr FindTopWindow(uint32_t topWinId); WMError Drag(const Rect& rect); - void ConsumeDividerPointerEvent(std::shared_ptr& inputEvent); void ConsumeDragOrMoveEvent(std::shared_ptr& pointerEvent); void HandleDragEvent(const MMI::PointerEvent::PointerItem& pointerItem); void HandleMoveEvent(const MMI::PointerEvent::PointerItem& pointerItem); diff --git a/wm/src/window_impl.cpp b/wm/src/window_impl.cpp index fed0b0a9d9891960e3c22feec62f9954a4daaf97..a9054dcb2ef8c7ec876805934a252f8da9cdc644 100644 --- a/wm/src/window_impl.cpp +++ b/wm/src/window_impl.cpp @@ -839,24 +839,33 @@ void WindowImpl::ConsumeDragOrMoveEvent(std::shared_ptr& poin { int32_t action = pointerEvent->GetPointerAction(); MMI::PointerEvent::PointerItem pointerItem; + static bool hasPointDown = false; + static int32_t startPointerId; + int curPointerId = pointerEvent->GetPointerId(); switch (action) { case MMI::PointerEvent::POINTER_ACTION_DOWN: { - if (pointerEvent->GetPointerItem(pointerEvent->GetPointerId(), pointerItem)) { + if (!hasPointDown && pointerEvent->GetPointerItem(curPointerId, pointerItem)) { startPointRect_ = GetRect(); startPointPosX_ = pointerItem.GetGlobalX(); startPointPosY_ = pointerItem.GetGlobalY(); - if (!WindowHelper::IsPointInWindow(startPointPosX_, startPointPosY_, startPointRect_)) { + startPointerId = curPointerId; + hasPointDown = true; + if (GetType() == WindowType::WINDOW_TYPE_DOCK_SLICE) { + startMoveFlag_ = true; + } else if (!WindowHelper::IsPointInWindow(startPointPosX_, startPointPosY_, startPointRect_)) { startDragFlag_ = true; } - WLOGFI("[PointDown] windowId: %{public}d, pointPos: [%{public}d, %{public}d], winRect: " - "[%{public}d, %{public}d, %{public}d, %{public}d], startDragFlag: %{public}d", - GetWindowId(), startPointPosX_, startPointPosY_, startPointRect_.posX_, startPointRect_.posY_, + WLOGFI("[Point Down] windowId: %{public}d, pointerId: %{public}d, isDivider: %{public}d, " + "pointPos: [%{public}d, %{public}d], startDragFlag: %{public}d, " + "winRect: [%{public}d, %{public}d, %{public}d, %{public}d]", + GetWindowId(), curPointerId, (GetType() == WindowType::WINDOW_TYPE_DOCK_SLICE), + startPointPosX_, startPointPosY_, startPointRect_.posX_, startPointRect_.posY_, startPointRect_.width_, startPointRect_.height_, startDragFlag_); } break; } case MMI::PointerEvent::POINTER_ACTION_MOVE: { - if (pointerEvent->GetPointerItem(pointerEvent->GetPointerId(), pointerItem)) { + if ((curPointerId == startPointerId) && pointerEvent->GetPointerItem(curPointerId, pointerItem)) { if (startMoveFlag_) { HandleMoveEvent(pointerItem); } @@ -868,45 +877,13 @@ void WindowImpl::ConsumeDragOrMoveEvent(std::shared_ptr& poin } case MMI::PointerEvent::POINTER_ACTION_UP: case MMI::PointerEvent::POINTER_ACTION_CANCEL: - startDragFlag_ = false; - startMoveFlag_ = false; - WLOGFE("[Point Up/Cancel] windowId: %{public}d", GetWindowId()); - break; - default: - break; - } -} - -void WindowImpl::ConsumeDividerPointerEvent(std::shared_ptr& pointerEvent) -{ - int32_t action = pointerEvent->GetPointerAction(); - WLOGI("ConsumeDividerPointerEvent pointerEvent action: %{public}d, windowId: %{public}u", action, GetWindowId()); - MMI::PointerEvent::PointerItem pointerItem; - switch (action) { - case MMI::PointerEvent::POINTER_ACTION_DOWN: { - if (pointerEvent->GetPointerItem(pointerEvent->GetPointerId(), pointerItem)) { - startMoveFlag_ = true; - startPointRect_ = GetRect(); - startPointPosX_ = pointerItem.GetGlobalX(); - startPointPosY_ = pointerItem.GetGlobalY(); - WLOGFI("[Point divider] point pos: [%{public}d, %{public}d], " - "winRect: [%{public}d, %{public}d, %{public}d, %{public}d]", - startPointPosX_, startPointPosY_, startPointRect_.posX_, startPointRect_.posY_, - startPointRect_.width_, startPointRect_.height_); - } - break; - } - case MMI::PointerEvent::POINTER_ACTION_MOVE: { - if (startMoveFlag_ && (pointerEvent->GetPointerItem(pointerEvent->GetPointerId(), pointerItem))) { - HandleMoveEvent(pointerItem); + if (curPointerId == startPointerId) { + startDragFlag_ = false; + startMoveFlag_ = false; + hasPointDown = false; + WLOGFI("[Point Up/Cancel] windowId: %{public}d, pointerId: %{public}d", GetWindowId(), curPointerId); } break; - } - case MMI::PointerEvent::POINTER_ACTION_UP: - case MMI::PointerEvent::POINTER_ACTION_CANCEL: - startMoveFlag_ = false; - WLOGFE("[Point divider Up/Cancel] windowId: %{public}d", GetWindowId()); - break; default: break; } @@ -919,12 +896,8 @@ void WindowImpl::ConsumePointerEvent(std::shared_ptr& pointer if (action == MMI::PointerEvent::POINTER_ACTION_DOWN || action == MMI::PointerEvent::POINTER_ACTION_BUTTON_DOWN) { SingletonContainer::Get().ProcessWindowTouchedEvent(property_->GetWindowId()); } - if (GetType() == WindowType::WINDOW_TYPE_DOCK_SLICE) { - ConsumeDividerPointerEvent(pointerEvent); - return; - } - if (WindowHelper::IsMainFloatingWindow(GetType(), GetMode())) { + if (WindowHelper::IsMainFloatingWindow(GetType(), GetMode()) || GetType() == WindowType::WINDOW_TYPE_DOCK_SLICE) { ConsumeDragOrMoveEvent(pointerEvent); if (startDragFlag_ || startMoveFlag_) { return; diff --git a/wmserver/include/window_node.h b/wmserver/include/window_node.h index ee0f54fe6e6aa877558ecda0eecb635b9b444399..57c41784840de79236a5469bd76512d31348e015 100644 --- a/wmserver/include/window_node.h +++ b/wmserver/include/window_node.h @@ -71,6 +71,7 @@ public: int32_t priority_ { 0 }; bool requestedVisibility_ { false }; bool currentVisibility_ { false }; + bool hasDecorated = false; private: sptr property_; diff --git a/wmserver/src/window_controller.cpp b/wmserver/src/window_controller.cpp index 4c5d76eea1050b76355e0a76ae8ca260b20793e5..40027be6800ecb62d84f50f61d5e81908c99df66 100644 --- a/wmserver/src/window_controller.cpp +++ b/wmserver/src/window_controller.cpp @@ -152,6 +152,7 @@ WMError WindowController::Resize(uint32_t windowId, uint32_t width, uint32_t hei Rect lastRect = property->GetWindowRect(); Rect newRect = { lastRect.posX_, lastRect.posY_, width, height }; property->SetWindowRect(newRect); + node->hasDecorated = false; WMError res = windowRoot_->UpdateWindowNode(windowId); if (res != WMError::WM_OK) { return res; @@ -177,7 +178,7 @@ WMError WindowController::Drag(uint32_t windowId, const Rect& rect) if (res != WMError::WM_OK) { return res; } - RSTransaction::FlushImplicitTransaction(); + FlushWindowInfo(windowId); return WMError::WM_OK; } diff --git a/wmserver/src/window_layout_policy_cascade.cpp b/wmserver/src/window_layout_policy_cascade.cpp index 90dcab42543873f901df540f30b87d99649f2622..6a154a925ea285bf3f467c02510eb714e4264c97 100644 --- a/wmserver/src/window_layout_policy_cascade.cpp +++ b/wmserver/src/window_layout_policy_cascade.cpp @@ -163,8 +163,10 @@ void WindowLayoutPolicyCascade::UpdateLayoutRect(sptr& node) if (!floatingWindow) { // fullscreen window winRect = limitRect; } else { // floating window - if (node->GetWindowProperty()->GetDecorEnable()) { // is decorable + // decorate window only once in case of changing width or height continuously + if (!node->hasDecorated && node->GetWindowProperty()->GetDecorEnable()) { winRect = ComputeDecoratedWindowRect(winRect); + node->hasDecorated = true; } if (subWindow && parentLimit) { // subwidow and limited by parent limitRect = node->parent_->GetLayoutRect(); diff --git a/wmserver/src/window_manager_service.cpp b/wmserver/src/window_manager_service.cpp index c61b0b61a60f547cf6270ff68f480e076c71125d..0156cadef9c3c227426099fcead94bb7c8902287 100644 --- a/wmserver/src/window_manager_service.cpp +++ b/wmserver/src/window_manager_service.cpp @@ -189,11 +189,7 @@ WMError WindowManagerService::Drag(uint32_t windowId, const Rect& rect) windowId, rect.posX_, rect.posY_, rect.width_, rect.height_); WM_SCOPED_TRACE("wms:Drag"); std::lock_guard lock(mutex_); - WMError res = windowController_->Drag(windowId, rect); - if (res == WMError::WM_OK) { - inputWindowMonitor_->UpdateInputWindow(windowId); - } - return res; + return windowController_->Drag(windowId, rect); } WMError WindowManagerService::RequestFocus(uint32_t windowId) diff --git a/wmserver/src/window_node.cpp b/wmserver/src/window_node.cpp index 646db032a703f761e8e51cd7eb449aeef27f0571..6bb74a8d8343e3e3597f543575bcb1f926310022 100644 --- a/wmserver/src/window_node.cpp +++ b/wmserver/src/window_node.cpp @@ -118,17 +118,19 @@ Rect WindowNode::GetHotZoneRect() const { Rect rect = layoutRect_; if (GetWindowType() == WindowType::WINDOW_TYPE_DOCK_SLICE) { - const int32_t divTouchRegion = 20; + const int32_t divHotZone = 20; if (rect.width_ < rect.height_) { - rect.posX_ -= divTouchRegion; - rect.width_ += (divTouchRegion + divTouchRegion); + rect.posX_ -= divHotZone; + rect.width_ += (divHotZone + divHotZone); } else { - rect.posY_ -= divTouchRegion; - rect.height_ += (divTouchRegion + divTouchRegion); + rect.posY_ -= divHotZone; + rect.height_ += (divHotZone + divHotZone); } } else if (WindowHelper::IsMainFloatingWindow(GetWindowType(), GetWindowMode())) { - property_->SetWindowHotZoneRect(rect); - rect = property_->GetWindowHotZoneRect(); + rect.posX_ -= HOTZONE; + rect.posY_ -= HOTZONE; + rect.width_ += (HOTZONE + HOTZONE); + rect.height_ += (HOTZONE + HOTZONE); } return rect; } diff --git a/wmserver/src/window_node_container.cpp b/wmserver/src/window_node_container.cpp index 18867a49d19642ba5ad52b8b9bde4d5c40f2ec74..07a86254d8acfca6e34e16ef2426f265eb81358f 100644 --- a/wmserver/src/window_node_container.cpp +++ b/wmserver/src/window_node_container.cpp @@ -222,6 +222,7 @@ WMError WindowNodeContainer::RemoveWindowNode(sptr& node) } node->requestedVisibility_ = false; node->currentVisibility_ = false; + node->hasDecorated = false; for (auto& child : node->children_) { child->currentVisibility_ = false; }