mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-23 06:50:40 +00:00
commit
95815f5405
@ -1066,8 +1066,8 @@ struct VsyncCallback {
|
||||
};
|
||||
|
||||
struct WindowLimits {
|
||||
uint32_t maxWidth_ = INT32_MAX;
|
||||
uint32_t maxHeight_ = INT32_MAX;
|
||||
uint32_t maxWidth_ = UINT32_MAX;
|
||||
uint32_t maxHeight_ = UINT32_MAX;
|
||||
uint32_t minWidth_ = 1;
|
||||
uint32_t minHeight_ = 1;
|
||||
float maxRatio_ = FLT_MAX;
|
||||
|
@ -823,7 +823,7 @@ napi_value JsWindow::KeepKeyboardOnFocus(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_value JsWindow::EnableDrag(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_LAYOUT, "[NAPI] EnableDrag");
|
||||
TLOGD(WmsLogTag::WMS_LAYOUT, "[NAPI]");
|
||||
JsWindow* me = CheckParamsAndGetThis<JsWindow>(env, info);
|
||||
return (me != nullptr) ? me->OnEnableDrag(env, info) : nullptr;
|
||||
}
|
||||
@ -958,7 +958,7 @@ napi_value JsWindow::RequestFocus(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_value JsWindow::StartMoving(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_IMMS, "[NAPI]StartMoving");
|
||||
TLOGD(WmsLogTag::WMS_IMMS, "[NAPI]");
|
||||
JsWindow* me = CheckParamsAndGetThis<JsWindow>(env, info);
|
||||
return (me != nullptr) ? me->OnStartMoving(env, info) : nullptr;
|
||||
}
|
||||
@ -2281,7 +2281,7 @@ napi_value JsWindow::OnSetDialogBackGestureEnabled(napi_env env, napi_callback_i
|
||||
|
||||
wptr<Window> weakToken(windowToken_);
|
||||
std::shared_ptr<WmErrorCode> errCodePtr = std::make_shared<WmErrorCode>(WmErrorCode::WM_OK);
|
||||
NapiAsyncTask::ExecuteCallback execute = [weakToken, isEnabled, errCodePtr]() {
|
||||
NapiAsyncTask::ExecuteCallback execute = [weakToken, isEnabled, errCodePtr] {
|
||||
if (errCodePtr == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -2996,7 +2996,7 @@ napi_value JsWindow::OnSetSystemBarProperties(napi_env env, napi_callback_info i
|
||||
{
|
||||
WMError errCode = WMError::WM_OK;
|
||||
if (windowToken_ == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_IMMS, "windowToken_ is nullptr");
|
||||
TLOGE(WmsLogTag::WMS_IMMS, "windowToken is nullptr");
|
||||
errCode = WMError::WM_ERROR_NULLPTR;
|
||||
}
|
||||
size_t argc = 4;
|
||||
@ -3791,7 +3791,7 @@ napi_value JsWindow::OnSetTopmost(napi_env env, napi_callback_info info)
|
||||
|
||||
wptr<Window> weakToken(windowToken_);
|
||||
std::shared_ptr<WmErrorCode> errCodePtr = std::make_shared<WmErrorCode>(WmErrorCode::WM_OK);
|
||||
NapiAsyncTask::ExecuteCallback execute = [weakToken, topmost, errCodePtr]() {
|
||||
NapiAsyncTask::ExecuteCallback execute = [weakToken, topmost, errCodePtr] {
|
||||
if (errCodePtr == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -3954,7 +3954,7 @@ napi_value JsWindow::OnSetWindowKeepScreenOn(napi_env env, napi_callback_info in
|
||||
}
|
||||
wptr<Window> weakToken(windowToken_);
|
||||
std::shared_ptr<WmErrorCode> errCodePtr = std::make_shared<WmErrorCode>(WmErrorCode::WM_OK);
|
||||
NapiAsyncTask::ExecuteCallback execute = [weakToken, keepScreenOn, errCodePtr] () {
|
||||
NapiAsyncTask::ExecuteCallback execute = [weakToken, keepScreenOn, errCodePtr] {
|
||||
if (errCodePtr == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -5751,7 +5751,7 @@ napi_value JsWindow::OnSetHandwritingFlag(napi_env env, napi_callback_info info)
|
||||
napi_get_value_bool(env, nativeBool, &isAddFlag);
|
||||
wptr<Window> weakToken(windowToken_);
|
||||
std::shared_ptr<WmErrorCode> errCodePtr = std::make_shared<WmErrorCode>(WmErrorCode::WM_OK);
|
||||
NapiAsyncTask::ExecuteCallback execute = [weakToken, isAddFlag, errCodePtr]() {
|
||||
NapiAsyncTask::ExecuteCallback execute = [weakToken, isAddFlag, errCodePtr] {
|
||||
if (errCodePtr == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -6124,10 +6124,10 @@ napi_value JsWindow::OnEnableDrag(napi_env env, napi_callback_info info)
|
||||
}
|
||||
|
||||
NapiAsyncTask::ExecuteCallback JsWindow::GetEnableDragExecuteCallback(bool enableDrag, const wptr<Window>& weakToken,
|
||||
std::shared_ptr<WmErrorCode> &errCodePtr) const
|
||||
std::shared_ptr<WmErrorCode>& errCodePtr) const
|
||||
{
|
||||
NapiAsyncTask::ExecuteCallback execute =
|
||||
[weakToken, enableDrag, errCodePtr]() {
|
||||
[weakToken, enableDrag, errCodePtr] {
|
||||
if (errCodePtr == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -6169,16 +6169,12 @@ napi_value JsWindow::OnSetWindowLimits(napi_env env, napi_callback_info info)
|
||||
size_t argc = 4;
|
||||
napi_value argv[4] = {nullptr};
|
||||
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
|
||||
if (argc < 1) {
|
||||
if (argc < 1 || argv[0] == nullptr) {
|
||||
WLOGFE("Argc is invalid: %{public}zu", argc);
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM);
|
||||
}
|
||||
napi_value nativeObj = argv[0];
|
||||
if (nativeObj == nullptr) {
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM);
|
||||
}
|
||||
WindowLimits windowLimits;
|
||||
if (!ParseWindowLimits(env, nativeObj, windowLimits)) {
|
||||
if (!ParseWindowLimits(env, argv[0], windowLimits)) {
|
||||
WLOGFE("Failed to convert object to windowLimits");
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM);
|
||||
}
|
||||
@ -6253,7 +6249,7 @@ napi_value JsWindow::OnSetWindowDecorVisible(napi_env env, napi_callback_info in
|
||||
size_t argc = 4;
|
||||
napi_value argv[4] = {nullptr};
|
||||
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
|
||||
if (argc < 1) {
|
||||
if (argc < 1 || argv[0] == nullptr) {
|
||||
WLOGFE("Argc is invalid: %{public}zu", argc);
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM);
|
||||
}
|
||||
@ -6261,15 +6257,10 @@ napi_value JsWindow::OnSetWindowDecorVisible(napi_env env, napi_callback_info in
|
||||
WLOGFE("WindowToken_ is nullptr");
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY);
|
||||
}
|
||||
napi_value nativeVal = argv[0];
|
||||
if (nativeVal == nullptr) {
|
||||
WLOGFE("Failed to convert parameter to visible");
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM);
|
||||
}
|
||||
bool isVisible = true;
|
||||
WmErrorCode errCode = WmErrorCode::WM_OK;
|
||||
CHECK_NAPI_RETCODE(errCode, WmErrorCode::WM_ERROR_INVALID_PARAM,
|
||||
napi_get_value_bool(env, nativeVal, &isVisible));
|
||||
napi_get_value_bool(env, argv[0], &isVisible));
|
||||
if (errCode == WmErrorCode::WM_ERROR_INVALID_PARAM) {
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM);
|
||||
}
|
||||
@ -6670,7 +6661,7 @@ void SetWindowGrayScaleTask(const wptr<Window>& weakToken, double grayScale,
|
||||
NapiAsyncTask::ExecuteCallback& execute, NapiAsyncTask::CompleteCallback& complete)
|
||||
{
|
||||
std::shared_ptr<WmErrorCode> err = std::make_shared<WmErrorCode>(WmErrorCode::WM_OK);
|
||||
execute = [weakToken, grayScale, err]() {
|
||||
execute = [weakToken, grayScale, err] {
|
||||
if (err == nullptr) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "wm error code is null");
|
||||
return;
|
||||
@ -6906,7 +6897,7 @@ napi_value JsWindow::OnStartMoving(napi_env env, napi_callback_info info)
|
||||
}
|
||||
wptr<Window> weakToken(windowToken_);
|
||||
std::shared_ptr<WmErrorCode> err = std::make_shared<WmErrorCode>(WmErrorCode::WM_OK);
|
||||
NapiAsyncTask::ExecuteCallback execute = [this, weakToken, err] () {
|
||||
NapiAsyncTask::ExecuteCallback execute = [this, weakToken, err] {
|
||||
if (err == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_SYSTEM, "wm error code is null.");
|
||||
return;
|
||||
|
@ -338,7 +338,7 @@ private:
|
||||
std::shared_ptr<NativeReference> jsTransControllerObj_ = nullptr;
|
||||
|
||||
NapiAsyncTask::ExecuteCallback GetEnableDragExecuteCallback(bool enableDrag, const wptr<Window>& weakToken,
|
||||
std::shared_ptr<WmErrorCode> &errCodePtr) const;
|
||||
std::shared_ptr<WmErrorCode>& errCodePtr) const;
|
||||
NapiAsyncTask::CompleteCallback GetEnableDragCompleteCallback(const std::shared_ptr<WmErrorCode>& errCodePtr) const;
|
||||
};
|
||||
} // namespace Rosen
|
||||
|
@ -316,9 +316,9 @@ public:
|
||||
virtual WmErrorCode KeepKeyboardOnFocus(bool keepKeyboardFlag) = 0;
|
||||
virtual WMError RegisterWindowVisibilityChangeListener(const WindowVisibilityListenerSptr& listener) = 0;
|
||||
virtual WMError UnregisterWindowVisibilityChangeListener(const WindowVisibilityListenerSptr& listener) = 0;
|
||||
virtual WMError SetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_OK; };
|
||||
virtual WMError GetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_OK; };
|
||||
virtual WMError EnableDrag(bool enableDrag) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; };
|
||||
virtual WMError SetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_OK; }
|
||||
virtual WMError GetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_OK; }
|
||||
virtual WMError EnableDrag(bool enableDrag) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
|
||||
virtual WMError RegisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener)
|
||||
{
|
||||
return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
|
||||
@ -379,7 +379,7 @@ public:
|
||||
{
|
||||
return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
|
||||
}
|
||||
virtual WMError Recover(uint32_t reason = 0) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; };
|
||||
virtual WMError Recover(uint32_t reason = 0) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
|
||||
|
||||
virtual WMError Maximize(MaximizePresentation present) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
|
||||
|
||||
|
@ -662,8 +662,8 @@ enum class WindowUpdateType : int32_t {
|
||||
};
|
||||
|
||||
struct WindowLimits {
|
||||
uint32_t maxWidth_ = INT32_MAX;
|
||||
uint32_t maxHeight_ = INT32_MAX;
|
||||
uint32_t maxWidth_ = UINT32_MAX;
|
||||
uint32_t maxHeight_ = UINT32_MAX;
|
||||
uint32_t minWidth_ = 1;
|
||||
uint32_t minHeight_ = 1;
|
||||
float maxRatio_ = FLT_MAX;
|
||||
|
@ -50,8 +50,8 @@ public:
|
||||
/**
|
||||
* @brief Receive session event from application.
|
||||
*
|
||||
* This function provides the ability for applications to move window.\n
|
||||
* This interface will take effect after touch down event.\n
|
||||
* This function provides the ability for applications to move window.
|
||||
* This interface will take effect after touch down event.
|
||||
*
|
||||
* @param event Indicates the {@link SessionEvent}
|
||||
* @return Returns WSError::WS_OK if called success, otherwise failed.
|
||||
@ -214,8 +214,8 @@ public:
|
||||
* @brief Update the required params to system.
|
||||
*
|
||||
* Update the required rect and reason to determine the final size of pip window. Called when start pip,
|
||||
* show pip window, update pip size and pip restore.\n
|
||||
* Make sure the caller's process is same with the process which created pip window.\n
|
||||
* show pip window, update pip size and pip restore.
|
||||
* Make sure the caller's process is same with the process which created pip window.
|
||||
*
|
||||
* @param rect Indicates the {@link Rect} structure containing required size and position.
|
||||
* @param reason Indicates the {@link SizeChangeReason} reason.
|
||||
@ -226,8 +226,8 @@ public:
|
||||
/**
|
||||
* @brief Update the pip control status to pip control panel.
|
||||
*
|
||||
* Called when the specified component's status needs to be updated.\n
|
||||
* Make sure the caller's process is same with the process which created pip window.\n
|
||||
* Called when the specified component's status needs to be updated.
|
||||
* Make sure the caller's process is same with the process which created pip window.
|
||||
*
|
||||
* @param controlType Indicates the {@link WsPiPControlType} component in pip control panel.
|
||||
* @param status Indicates the {@link WsPiPControlStatus} status of specified component.
|
||||
|
@ -2291,8 +2291,8 @@ WSError SceneSession::TransferPointerEventInner(const std::shared_ptr<MMI::Point
|
||||
TLOGD(WmsLogTag::WMS_LAYOUT, "moveDragController_ is null");
|
||||
return Session::TransferPointerEvent(pointerEvent, needNotifyClient);
|
||||
}
|
||||
if ((property->GetWindowMode() == WindowMode::WINDOW_MODE_FLOATING && property->GetDragEnabled())
|
||||
|| isDragEnabledSystemWindow) {
|
||||
if ((property->GetWindowMode() == WindowMode::WINDOW_MODE_FLOATING && property->GetDragEnabled()) ||
|
||||
isDragEnabledSystemWindow) {
|
||||
if ((systemConfig_.IsPcWindow() || IsFreeMultiWindowMode() ||
|
||||
(property->GetIsPcAppInPad() && !isMainWindow)) &&
|
||||
moveDragController_->ConsumeDragEvent(pointerEvent, winRect_, property, systemConfig_)) {
|
||||
|
@ -333,7 +333,7 @@ void SceneInputManager::FlushChangeInfoToMMI(const std::map<uint64_t, std::vecto
|
||||
bool SceneInputManager::CheckNeedUpdate(const std::vector<MMI::DisplayInfo>& displayInfos,
|
||||
const std::vector<MMI::WindowInfo>& windowInfoList)
|
||||
{
|
||||
int32_t focusId = Rosen::SceneSessionManager::GetInstance().GetFocusedSessionId();
|
||||
int32_t focusId = SceneSessionManager::GetInstance().GetFocusedSessionId();
|
||||
if (focusId != lastFocusId_) {
|
||||
lastFocusId_ = focusId;
|
||||
lastDisplayInfos_ = displayInfos;
|
||||
@ -380,7 +380,7 @@ void SceneInputManager::UpdateFocusedSessionId(int32_t focusedSessionId)
|
||||
|
||||
void DumpUIExtentionWindowInfo(const MMI::WindowInfo& windowInfo)
|
||||
{
|
||||
auto sceneSession = Rosen::SceneSessionManager::GetInstance().GetSceneSession(windowInfo.id);
|
||||
auto sceneSession = SceneSessionManager::GetInstance().GetSceneSession(windowInfo.id);
|
||||
if (sceneSession == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_EVENT, "sceneSession is null");
|
||||
return;
|
||||
@ -410,7 +410,7 @@ void SceneInputManager::PrintWindowInfo(const std::vector<MMI::WindowInfo>& wind
|
||||
if (windowEventID == UINT32_MAX) {
|
||||
windowEventID = 0;
|
||||
}
|
||||
focusedSessionId_ = Rosen::SceneSessionManager::GetInstance().GetFocusedSessionId();
|
||||
focusedSessionId_ = SceneSessionManager::GetInstance().GetFocusedSessionId();
|
||||
std::unordered_map<int32_t, MMI::Rect> currWindowDefaultHotArea;
|
||||
static std::unordered_map<int32_t, MMI::Rect> lastWindowDefaultHotArea;
|
||||
for (auto& e : windowInfoList) {
|
||||
|
@ -144,7 +144,7 @@ void SceneSessionDirtyManager::CalTransform(const sptr<SceneSession>& sceneSessi
|
||||
}
|
||||
transform = Matrix3f::IDENTITY;
|
||||
bool isRotate = sceneSession->GetSessionInfo().isRotable_;
|
||||
auto displayMode = Rosen::ScreenSessionManagerClient::GetInstance().GetFoldDisplayMode();
|
||||
auto displayMode = ScreenSessionManagerClient::GetInstance().GetFoldDisplayMode();
|
||||
if (isRotate || !sceneSession->GetSessionInfo().isSystem_ ||
|
||||
static_cast<MMI::DisplayMode>(displayMode) == MMI::DisplayMode::FULL ||
|
||||
(static_cast<MMI::DisplayMode>(displayMode) == MMI::DisplayMode::MAIN &&
|
||||
@ -366,7 +366,7 @@ bool SceneSessionDirtyManager::IsFilterSession(const sptr<SceneSession>& sceneSe
|
||||
} else if (sceneSession->IsSystemSession() && sceneSession->IsVisible() && sceneSession->IsSystemActive()) {
|
||||
return false;
|
||||
}
|
||||
if (!Rosen::SceneSessionManager::GetInstance().IsSessionVisible(sceneSession)) {
|
||||
if (!SceneSessionManager::GetInstance().IsSessionVisible(sceneSession)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -453,7 +453,7 @@ std::pair<std::vector<MMI::WindowInfo>, std::vector<std::shared_ptr<Media::Pixel
|
||||
{
|
||||
std::vector<MMI::WindowInfo> windowInfoList;
|
||||
std::vector<std::shared_ptr<Media::PixelMap>> pixelMapList;
|
||||
const auto sceneSessionMap = Rosen::SceneSessionManager::GetInstance().GetSceneSessionMap();
|
||||
const auto sceneSessionMap = SceneSessionManager::GetInstance().GetSceneSessionMap();
|
||||
// all input event should trans to dialog window if dialog exists
|
||||
const auto dialogMap = GetDialogSessionMap(sceneSessionMap);
|
||||
uint32_t maxHotAreasNum = 0;
|
||||
|
@ -1113,7 +1113,7 @@ HWTEST_F(SceneSessionTest, TransferPointerEvent, Function | SmallTest | Level2)
|
||||
EXPECT_NE(sceneSession, nullptr);
|
||||
std::shared_ptr<MMI::PointerEvent> pointerEvent = nullptr;
|
||||
ASSERT_EQ(sceneSession->TransferPointerEvent(pointerEvent), WSError::WS_ERROR_NULLPTR);
|
||||
std::shared_ptr<MMI::PointerEvent> pointerEvent_ = MMI::PointerEvent::Create();
|
||||
std::shared_ptr<MMI::PointerEvent> pointerEvent_ = MMI::PointerEvent::Create();
|
||||
sptr<WindowSessionProperty> property = new WindowSessionProperty();
|
||||
property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
property->SetMaximizeMode(MaximizeMode::MODE_FULL_FILL);
|
||||
|
@ -159,7 +159,7 @@ HWTEST_F(SystemSessionTest, NotifyClientToUpdateRect01, Function | SmallTest | L
|
||||
*/
|
||||
HWTEST_F(SystemSessionTest, CheckPointerEventDispatch, Function | SmallTest | Level1)
|
||||
{
|
||||
std::shared_ptr<MMI::PointerEvent> pointerEvent_ = MMI::PointerEvent::Create();
|
||||
std::shared_ptr<MMI::PointerEvent> pointerEvent_ = MMI::PointerEvent::Create();
|
||||
SessionInfo info;
|
||||
info.abilityName_ = "CheckPointerEventDispatch";
|
||||
info.bundleName_ = "CheckPointerEventDispatchBundleName";
|
||||
|
@ -752,7 +752,7 @@ bool WindowSceneSessionImpl::HandlePointDownEvent(const std::shared_ptr<MMI::Poi
|
||||
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)) {
|
||||
if (!isFixedSubWin && windowType != WindowType::WINDOW_TYPE_DIALOG) {
|
||||
hostSession->SendPointEventForMoveDrag(pointerEvent);
|
||||
} else {
|
||||
hostSession->ProcessPointDownSession(pointerItem.GetDisplayX(), pointerItem.GetDisplayY());
|
||||
|
Loading…
Reference in New Issue
Block a user