mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-24 07:20:09 +00:00
commit
dc4ceda59f
@ -628,18 +628,19 @@ WMError WindowImpl::Show()
|
||||
if (!IsWindowValid()) {
|
||||
return WMError::WM_ERROR_INVALID_WINDOW;
|
||||
}
|
||||
if (state_ == WindowState::STATE_SHOWN && property_->GetWindowType() == WindowType::WINDOW_TYPE_DESKTOP) {
|
||||
WLOGFI("Minimize all app windows");
|
||||
SingletonContainer::Get<WindowAdapter>().MinimizeAllAppWindows(property_->GetDisplayId());
|
||||
for (auto& listener : lifecycleListeners_) {
|
||||
if (listener != nullptr) {
|
||||
listener->AfterForeground();
|
||||
}
|
||||
}
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
if (state_ == WindowState::STATE_SHOWN) {
|
||||
WLOGFI("window is already shown id: %{public}d", property_->GetWindowId());
|
||||
if (property_->GetWindowType() == WindowType::WINDOW_TYPE_DESKTOP) {
|
||||
WLOGFI("desktop window [id:%{public}d] is shown, minimize all app windows", property_->GetWindowId());
|
||||
SingletonContainer::Get<WindowAdapter>().MinimizeAllAppWindows(property_->GetDisplayId());
|
||||
for (auto& listener : lifecycleListeners_) {
|
||||
if (listener != nullptr) {
|
||||
listener->AfterForeground();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
WLOGFI("window is already shown id: %{public}d, raise to top", property_->GetWindowId());
|
||||
SingletonContainer::Get<WindowAdapter>().ProcessWindowTouchedEvent(property_->GetWindowId());
|
||||
}
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
SetDefaultOption();
|
||||
|
@ -179,7 +179,6 @@ WMError WindowController::SetWindowMode(uint32_t windowId, WindowMode dstMode)
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
WMError res = WMError::WM_OK;
|
||||
node->SetWindowMode(dstMode);
|
||||
if ((srcMode == WindowMode::WINDOW_MODE_FULLSCREEN) && (dstMode == WindowMode::WINDOW_MODE_FLOATING)) {
|
||||
node->SetWindowSizeChangeReason(WindowSizeChangeReason::RECOVER);
|
||||
} else if (dstMode == WindowMode::WINDOW_MODE_FULLSCREEN) {
|
||||
@ -190,9 +189,13 @@ WMError WindowController::SetWindowMode(uint32_t windowId, WindowMode dstMode)
|
||||
if (WindowHelper::IsSplitWindowMode(srcMode)) {
|
||||
// change split mode to other
|
||||
res = windowRoot_->ExitSplitWindowMode(node);
|
||||
node->SetWindowMode(dstMode);
|
||||
} else if (!WindowHelper::IsSplitWindowMode(srcMode) && WindowHelper::IsSplitWindowMode(dstMode)) {
|
||||
// change other mode to split
|
||||
node->SetWindowMode(dstMode);
|
||||
res = windowRoot_->EnterSplitWindowMode(node);
|
||||
} else {
|
||||
node->SetWindowMode(dstMode);
|
||||
}
|
||||
if (res != WMError::WM_OK) {
|
||||
node->GetWindowProperty()->ResumeLastWindowMode();
|
||||
|
@ -38,6 +38,7 @@ namespace Rosen {
|
||||
namespace {
|
||||
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowNodeContainer"};
|
||||
constexpr int WINDOW_NAME_MAX_LENGTH = 10;
|
||||
const std::string SPLIT_SCREEN_EVENT_NAME = "common.event.SPLIT_SCREEN";
|
||||
}
|
||||
|
||||
WindowNodeContainer::WindowNodeContainer(DisplayId displayId, uint32_t width, uint32_t height) : displayId_(displayId)
|
||||
@ -821,19 +822,18 @@ void WindowNodeContainer::MinimizeAllAppWindows()
|
||||
|
||||
void WindowNodeContainer::SendSplitScreenEvent(WindowMode mode)
|
||||
{
|
||||
// should define in common_event_support.h and @ohos.commonEvent.d.ts
|
||||
WLOGFI("send split sceen event , trigger mode is %{public}d", mode);
|
||||
const std::string eventName = "common.event.SPLIT_SCREEN";
|
||||
// reset ipc identity
|
||||
std::string identity = IPCSkeleton::ResetCallingIdentity();
|
||||
AAFwk::Want want;
|
||||
want.SetAction(eventName);
|
||||
want.SetAction(SPLIT_SCREEN_EVENT_NAME);
|
||||
EventFwk::CommonEventData commonEventData;
|
||||
commonEventData.SetWant(want);
|
||||
if (mode == WindowMode::WINDOW_MODE_SPLIT_PRIMARY) {
|
||||
commonEventData.SetData("Secondary");
|
||||
} else {
|
||||
commonEventData.SetData("Primary");
|
||||
}
|
||||
std::string eventData = (mode == WindowMode::WINDOW_MODE_SPLIT_PRIMARY) ? "Secondary" : "Primary";
|
||||
commonEventData.SetData(eventData);
|
||||
EventFwk::CommonEventManager::PublishCommonEvent(commonEventData);
|
||||
// set ipc identity to raw
|
||||
IPCSkeleton::SetCallingIdentity(identity);
|
||||
WLOGFI("send split sceen event finish.");
|
||||
}
|
||||
|
||||
sptr<WindowNode> WindowNodeContainer::FindSplitPairNode(sptr<WindowNode>& triggerNode) const
|
||||
|
Loading…
Reference in New Issue
Block a user