diff --git a/window_manager/utils/include/window_helper.h b/window_manager/utils/include/window_helper.h index b23023e2bbd728d93bddd543ae3e7000bb149e1d..ba5597ab4d12ce774aacdad72987a19e4f8335ec 100644 --- a/window_manager/utils/include/window_helper.h +++ b/window_manager/utils/include/window_helper.h @@ -258,7 +258,7 @@ public: static bool IsPointInWindowExceptCorner(int32_t pointPosX, int32_t pointPosY, const Rect& rectExceptCorner) { if ((pointPosX > rectExceptCorner.posX_ && - pointPosX < (rectExceptCorner.posX_ + static_cast(rectExceptCorner.width_)) - 1) || + pointPosX < (rectExceptCorner.posX_ + static_cast(rectExceptCorner.width_)) - 1) && (pointPosY > rectExceptCorner.posY_ && pointPosY < (rectExceptCorner.posY_ + static_cast(rectExceptCorner.height_)) - 1)) { return true; diff --git a/window_manager/wm/src/window_impl.cpp b/window_manager/wm/src/window_impl.cpp index 30e134f822330b3d752945dc9ef7c681e7dbea09..d3772bb557f376bbe486352db048aeab4fe61a96 100755 --- a/window_manager/wm/src/window_impl.cpp +++ b/window_manager/wm/src/window_impl.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -2228,15 +2229,15 @@ void WindowImpl::UpdateDragType(int32_t startPointPosX, int32_t startPointPosY) const auto& startRectExceptCorner = moveDragProperty_->startRectExceptCorner_; if (startPointPosX > startRectExceptCorner.posX_ && (startPointPosX < startRectExceptCorner.posX_ + - static_cast(startRectExceptCorner.width_))) { + static_cast(startRectExceptCorner.width_) - 1)) { moveDragProperty_->dragType_ = DragType::DRAG_BOTTOM_OR_TOP; } else if (startPointPosY > startRectExceptCorner.posY_ && (startPointPosY < startRectExceptCorner.posY_ + - static_cast(startRectExceptCorner.height_))) { + static_cast(startRectExceptCorner.height_) - 1)) { moveDragProperty_->dragType_ = DragType::DRAG_LEFT_OR_RIGHT; } else if ((startPointPosX <= startRectExceptCorner.posX_ && startPointPosY <= startRectExceptCorner.posY_) || - (startPointPosX >= startRectExceptCorner.posX_ + static_cast(startRectExceptCorner.width_) && - startPointPosY >= startRectExceptCorner.posY_ + static_cast(startRectExceptCorner.height_))) { + (startPointPosX >= startRectExceptCorner.posX_ + static_cast(startRectExceptCorner.width_) - 1 && + startPointPosY >= startRectExceptCorner.posY_ + static_cast(startRectExceptCorner.height_) - 1)) { moveDragProperty_->dragType_ = DragType::DRAG_LEFT_TOP_CORNER; } else { moveDragProperty_->dragType_ = DragType::DRAG_RIGHT_TOP_CORNER; @@ -2275,8 +2276,8 @@ void WindowImpl::CalculateStartRectExceptHotZone(float vpr) bool WindowImpl::IsPointInDragHotZone(int32_t startPointPosX, int32_t startPointPosY) { - if (!WindowHelper::IsPointInTargetRect(startPointPosX, - startPointPosY, moveDragProperty_->startRectExceptFrame_) || + if (WindowHelper::IsPointInTargetRect(startPointPosX, + startPointPosY, moveDragProperty_->startRectExceptFrame_) && (!WindowHelper::IsPointInWindowExceptCorner(startPointPosX, startPointPosY, moveDragProperty_->startRectExceptCorner_))) { return true; @@ -2462,6 +2463,7 @@ void WindowImpl::HandlePointerStyle(const std::shared_ptr& po return; } auto action = pointerEvent->GetPointerAction(); + uint32_t targetMouseStyle = mouseStyleID_; if (WindowHelper::IsMainFloatingWindow(GetType(), GetMode())) { /* To optimize performance, we only get virtualPixelRatio once. * TODO: If there is a change in virtualPixelRatio, the DMS will report the virtualPixelRatio change event, @@ -2484,28 +2486,26 @@ void WindowImpl::HandlePointerStyle(const std::shared_ptr& po // calculate pointer style mouseStyleID_ = CalculatePointerDirection(pointerItem.GetDisplayX(), pointerItem.GetDisplayY()); if (tempStyleID != mouseStyleID_) { - MMI::InputManager::GetInstance()->SetPointerStyle( - static_cast(pointerEvent->GetAgentWindowId()), mouseStyleID_); + targetMouseStyle = mouseStyleID_; } isPointerStyleChanged_ = true; } else if (action == MMI::PointerEvent::POINTER_ACTION_BUTTON_UP) { - MMI::InputManager::GetInstance()->SetPointerStyle( - static_cast(pointerEvent->GetAgentWindowId()), MMI::MOUSE_ICON::DEFAULT); + targetMouseStyle = MMI::MOUSE_ICON::DEFAULT; } } else if (GetType() == WindowType::WINDOW_TYPE_DOCK_SLICE && isPointerStyleChanged_ == false) { uint32_t mouseStyle = (GetRect().width_ > GetRect().height_) ? MMI::MOUSE_ICON::NORTH_SOUTH : MMI::MOUSE_ICON::WEST_EAST; - MMI::InputManager::GetInstance()->SetPointerStyle( - static_cast(pointerEvent->GetAgentWindowId()), mouseStyle); + targetMouseStyle = mouseStyle; isPointerStyleChanged_ = true; } if (isPointerStyleChanged_ && (action == MMI::PointerEvent::POINTER_ACTION_LEAVE_WINDOW || !IsPointInDragHotZone(pointerItem.GetDisplayX(), pointerItem.GetDisplayY()))) { - MMI::InputManager::GetInstance()->SetPointerStyle(static_cast(pointerEvent->GetAgentWindowId()), - MMI::MOUSE_ICON::DEFAULT); + targetMouseStyle = MMI::MOUSE_ICON::DEFAULT; isPointerStyleChanged_ = false; mouseStyleID_ = 0; } + MMI::InputManager::GetInstance()->SetPointerStyle(static_cast(pointerEvent->GetAgentWindowId()), + targetMouseStyle); } void WindowImpl::ConsumePointerEvent(const std::shared_ptr& pointerEvent)