mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-27 00:51:35 +00:00
startMoveing 拖拽判断
Signed-off-by: tanchenghao <tanchenghao@h-partners.com>
This commit is contained in:
parent
4cbe433ffe
commit
3863651059
@ -2302,8 +2302,10 @@ WSError SceneSession::TransferPointerEventInner(const std::shared_ptr<MMI::Point
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
}
|
||||
if ((IsDecorEnable() || isMovableSystemWindow) && moveDragController_->
|
||||
ConsumeMoveEvent(pointerEvent, winRect_)) {
|
||||
if ((WindowHelper::IsMainWindow(windowType) ||
|
||||
WindowHelper::IsSubWindow(windowType) ||
|
||||
WindowHelper::IsSystemWindow(windowType)) &&
|
||||
moveDragController_->ConsumeMoveEvent(pointerEvent, winRect_)) {
|
||||
PresentFoucusIfNeed(pointerEvent->GetPointerAction());
|
||||
pointerEvent->MarkProcessed();
|
||||
return WSError::WS_OK;
|
||||
|
@ -744,30 +744,17 @@ bool WindowSceneSessionImpl::HandlePointDownEvent(const std::shared_ptr<MMI::Poi
|
||||
dragType = SessionHelper::GetAreaType(winX, winY, sourceType, outside, vpr, rect);
|
||||
}
|
||||
TLOGD(WmsLogTag::WMS_EVENT, "dragType: %{public}d", dragType);
|
||||
bool isDecorDialog = windowType == WindowType::WINDOW_TYPE_DIALOG && property_->IsDecorEnable();
|
||||
bool isFixedSubWin = WindowHelper::IsSubWindow(windowType) && !property_->GetDragEnabled();
|
||||
bool isFixedSystemWin = WindowHelper::IsSystemWindow(windowType) && !property_->GetDragEnabled();
|
||||
auto hostSession = GetHostSession();
|
||||
CHECK_HOST_SESSION_RETURN_ERROR_IF_NULL(hostSession, needNotifyEvent);
|
||||
TLOGD(WmsLogTag::WMS_EVENT, "isFixedSystemWin %{public}d, isFixedSubWin %{public}d, isDecorDialog %{public}d",
|
||||
isFixedSystemWin, isFixedSubWin, isDecorDialog);
|
||||
if ((isFixedSystemWin || isFixedSubWin) && !isDecorDialog) {
|
||||
if (!isFixedSubWin && !(windowType == WindowType::WINDOW_TYPE_DIALOG)) {
|
||||
hostSession->SendPointEventForMoveDrag(pointerEvent);
|
||||
} else {
|
||||
hostSession->ProcessPointDownSession(pointerItem.GetDisplayX(), pointerItem.GetDisplayY());
|
||||
}
|
||||
if (dragType != AreaType::UNDEFINED) {
|
||||
hostSession->SendPointEventForMoveDrag(pointerEvent);
|
||||
needNotifyEvent = false;
|
||||
} else if (WindowHelper::IsMainWindow(windowType) ||
|
||||
WindowHelper::IsSubWindow(windowType) ||
|
||||
WindowHelper::IsSystemWindow(windowType)) {
|
||||
hostSession->SendPointEventForMoveDrag(pointerEvent);
|
||||
} else {
|
||||
if (dragType != AreaType::UNDEFINED) {
|
||||
hostSession->SendPointEventForMoveDrag(pointerEvent);
|
||||
needNotifyEvent = false;
|
||||
} else if (WindowHelper::IsMainWindow(windowType) ||
|
||||
WindowHelper::IsSubWindow(windowType) ||
|
||||
WindowHelper::IsSystemWindow(windowType)) {
|
||||
hostSession->SendPointEventForMoveDrag(pointerEvent);
|
||||
} else {
|
||||
hostSession->ProcessPointDownSession(pointerItem.GetDisplayX(), pointerItem.GetDisplayY());
|
||||
}
|
||||
hostSession->ProcessPointDownSession(pointerItem.GetDisplayX(), pointerItem.GetDisplayY());
|
||||
}
|
||||
return needNotifyEvent;
|
||||
}
|
||||
|
@ -300,34 +300,28 @@ HWTEST_F(WindowSceneSessionImplTest4, HandlePointDownEvent, Function | SmallTest
|
||||
windowSceneSessionImpl->hostSession_ = session;
|
||||
ASSERT_NE(nullptr, windowSceneSessionImpl->property_);
|
||||
windowSceneSessionImpl->property_->SetWindowType(WindowType::BELOW_APP_SYSTEM_WINDOW_BASE);
|
||||
|
||||
windowSceneSessionImpl->property_->SetDragEnabled(false);
|
||||
windowSceneSessionImpl->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
|
||||
windowSceneSessionImpl->property_->SetWindowMode(Rosen::WindowMode::WINDOW_MODE_FLOATING);
|
||||
windowSceneSessionImpl->property_->SetDragEnabled(true);
|
||||
auto ret = windowSceneSessionImpl->HandlePointDownEvent(pointerEvent, pointerItem, sourceType, vpr, rect);
|
||||
EXPECT_EQ(true, ret);
|
||||
|
||||
ASSERT_NE(nullptr, windowSceneSessionImpl->property_);
|
||||
windowSceneSessionImpl->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
|
||||
ASSERT_NE(nullptr, windowSceneSessionImpl->property_);
|
||||
EXPECT_EQ(false, ret);
|
||||
windowSceneSessionImpl->property_->SetDragEnabled(false);
|
||||
ret = windowSceneSessionImpl->HandlePointDownEvent(pointerEvent, pointerItem, sourceType, vpr, rect);
|
||||
EXPECT_EQ(true, ret);
|
||||
ASSERT_NE(nullptr, windowSceneSessionImpl->property_);
|
||||
windowSceneSessionImpl->property_->SetWindowType(WindowType::WINDOW_TYPE_DIALOG);
|
||||
ASSERT_NE(nullptr, windowSceneSessionImpl->property_);
|
||||
|
||||
windowSceneSessionImpl->property_->SetWindowMode(Rosen::WindowMode::WINDOW_MODE_FLOATING);
|
||||
ret = windowSceneSessionImpl->HandlePointDownEvent(pointerEvent, pointerItem, sourceType, vpr, rect);
|
||||
EXPECT_EQ(true, ret);
|
||||
ASSERT_NE(nullptr, windowSceneSessionImpl->property_);
|
||||
|
||||
EXPECT_EQ(false, ret);
|
||||
windowSceneSessionImpl->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
|
||||
ret = windowSceneSessionImpl->HandlePointDownEvent(pointerEvent, pointerItem, sourceType, vpr, rect);
|
||||
EXPECT_EQ(false, ret);
|
||||
windowSceneSessionImpl->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
|
||||
ret = windowSceneSessionImpl->HandlePointDownEvent(pointerEvent, pointerItem, sourceType, vpr, rect);
|
||||
EXPECT_EQ(false, ret);
|
||||
pointerItem.SetWindowX(100);
|
||||
pointerItem.SetWindowY(100);
|
||||
ret = windowSceneSessionImpl->HandlePointDownEvent(pointerEvent, pointerItem, sourceType, vpr, rect);
|
||||
EXPECT_EQ(true, ret);
|
||||
pointerItem.SetWindowX(1);
|
||||
ret = windowSceneSessionImpl->HandlePointDownEvent(pointerEvent, pointerItem, sourceType, vpr, rect);
|
||||
EXPECT_EQ(true, ret);
|
||||
EXPECT_EQ(false, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user