diff --git a/utils/include/window_helper.h b/utils/include/window_helper.h index a8091862d56b3401d38bd99babdd063d2fecd012..30974904a8f6a7d9f57df8a8295758a9b80374ab 100644 --- a/utils/include/window_helper.h +++ b/utils/include/window_helper.h @@ -113,10 +113,10 @@ public: static bool IsPointInWindow(int32_t pointPosX, int32_t pointPosY, Rect pointRect) { - if ((pointPosX > pointRect.posX_) && - (pointPosX < (pointRect.posX_ + static_cast(pointRect.width_))) && - (pointPosY > pointRect.posY_) && - (pointPosY < (pointRect.posY_ + static_cast(pointRect.height_)))) { + if ((pointPosX > pointRect.posX_ + static_cast(WINDOW_FRAME_WIDTH)) && + (pointPosX < (pointRect.posX_ + static_cast(pointRect.width_ - WINDOW_FRAME_WIDTH))) && + (pointPosY > pointRect.posY_ + static_cast(WINDOW_FRAME_TOP_WIDTH)) && + (pointPosY < (pointRect.posY_ + static_cast(pointRect.height_ - WINDOW_FRAME_WIDTH)))) { return true; } return false; diff --git a/utils/include/wm_common_inner.h b/utils/include/wm_common_inner.h index 369fd40d29903304d7bc44eed93f879e7c6cfb85..6754068336cfbfa3e984983ca1dff9bc14d81f52 100644 --- a/utils/include/wm_common_inner.h +++ b/utils/include/wm_common_inner.h @@ -49,8 +49,8 @@ namespace { constexpr uint32_t DIVIDER_WIDTH = 8; constexpr uint32_t WINDOW_TITLE_BAR_HEIGHT = 48; constexpr uint32_t WINDOW_FRAME_WIDTH = 4; - constexpr uint32_t HOTZONE = 40; - constexpr uint32_t DIV_HOTZONE = 20; + constexpr uint32_t WINDOW_FRAME_TOP_WIDTH = 1; // the frame width of top position + constexpr uint32_t HOTZONE = 20; constexpr uint32_t MIN_VERTICAL_FLOATING_WIDTH = 240; constexpr uint32_t MIN_VERTICAL_FLOATING_HEIGHT = 426; constexpr uint32_t MIN_VERTICAL_SPLIT_HEIGHT = 426; diff --git a/wm/src/window_impl.cpp b/wm/src/window_impl.cpp index 06de34ed394c227980afe3ee67c936bb394d3d01..c96e39b18204b58f53bcf813f369422b892a03fe 100644 --- a/wm/src/window_impl.cpp +++ b/wm/src/window_impl.cpp @@ -1008,25 +1008,27 @@ void WindowImpl::HandleDragEvent(int32_t posX, int32_t posY, int32_t pointId) int32_t diffX = posX - startPointPosX_; int32_t diffY = posY - startPointPosY_; Rect newRect = startPointRect_; - if (startPointPosX_ <= startPointRect_.posX_) { + if (startPointPosX_ <= startPointRect_.posX_ + static_cast(WINDOW_FRAME_WIDTH)) { if (diffX > static_cast(startPointRect_.width_)) { diffX = static_cast(startPointRect_.width_); } newRect.posX_ += diffX; newRect.width_ = static_cast(static_cast(newRect.width_) - diffX); - } else if (startPointPosX_ >= startPointRect_.posX_ + static_cast(startPointRect_.width_)) { + } else if (startPointPosX_ >= startPointRect_.posX_ + + static_cast(startPointRect_.width_ - WINDOW_FRAME_WIDTH)) { if (diffX < 0 && (-diffX > static_cast(startPointRect_.width_))) { diffX = -(static_cast(startPointRect_.width_)); } newRect.width_ = static_cast(static_cast(newRect.width_) + diffX); } - if (startPointPosY_ <= startPointRect_.posY_) { + if (startPointPosY_ <= startPointRect_.posY_ + static_cast(WINDOW_FRAME_TOP_WIDTH)) { if (diffY > static_cast(startPointRect_.height_)) { diffY = static_cast(startPointRect_.height_); } newRect.posY_ += diffY; newRect.height_ = static_cast(static_cast(newRect.height_) - diffY); - } else if (startPointPosY_ >= startPointRect_.posY_ + static_cast(startPointRect_.height_)) { + } else if (startPointPosY_ >= startPointRect_.posY_ + + static_cast(startPointRect_.height_ - WINDOW_FRAME_WIDTH)) { if (diffY < 0 && (-diffY > static_cast(startPointRect_.height_))) { diffY = -(static_cast(startPointRect_.height_)); } diff --git a/wmserver/src/window_layout_policy.cpp b/wmserver/src/window_layout_policy.cpp index 6f3c98fb87d3022178b702651aca2cf1251aa654..e5ee4b66081cb7ccd810dd63dce3a23438fcc1f4 100644 --- a/wmserver/src/window_layout_policy.cpp +++ b/wmserver/src/window_layout_policy.cpp @@ -241,15 +241,14 @@ void WindowLayoutPolicy::CalcAndSetNodeHotZone(Rect layoutOutRect, sptr(HOTZONE * virtualPixelRatio); - uint32_t divHotZone = static_cast(DIV_HOTZONE * virtualPixelRatio); if (node->GetWindowType() == WindowType::WINDOW_TYPE_DOCK_SLICE) { if (rect.width_ < rect.height_) { - rect.posX_ -= divHotZone; - rect.width_ += (divHotZone + divHotZone); + rect.posX_ -= hotZone; + rect.width_ += (hotZone + hotZone); } else { - rect.posY_ -= divHotZone; - rect.height_ += (divHotZone + divHotZone); + rect.posY_ -= hotZone; + rect.height_ += (hotZone + hotZone); } } else if (WindowHelper::IsMainFloatingWindow(node->GetWindowType(), node->GetWindowMode())) { rect.posX_ -= hotZone;