mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-07-20 20:20:13 -04:00
@@ -44,6 +44,7 @@ class RSSurfaceNode;
|
||||
class IWindowChangeListener : virtual public RefBase {
|
||||
public:
|
||||
virtual void OnSizeChange(Rect rect, WindowSizeChangeReason reason) = 0;
|
||||
virtual void OnModeChange(WindowMode mode) = 0;
|
||||
};
|
||||
|
||||
class IAvoidAreaChangedListener : virtual public RefBase {
|
||||
|
||||
@@ -105,6 +105,11 @@ void JsWindowListener::OnSizeChange(Rect rect, WindowSizeChangeReason reason)
|
||||
AsyncTask::Schedule(*engine_, std::make_unique<AsyncTask>(callback, std::move(execute), std::move(complete)));
|
||||
}
|
||||
|
||||
void JsWindowListener::OnModeChange(WindowMode mode)
|
||||
{
|
||||
WLOGFI("JsWindowListener::OnModeChange is called");
|
||||
}
|
||||
|
||||
void JsWindowListener::OnSystemBarPropertyChange(DisplayId displayId, const SystemBarRegionTints& tints)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mtx_);
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
void RemoveCallback(NativeValue* jsListenerObject);
|
||||
void OnSystemBarPropertyChange(DisplayId displayId, const SystemBarRegionTints& tints) override;
|
||||
void OnSizeChange(Rect rect, WindowSizeChangeReason reason) override;
|
||||
void OnModeChange(WindowMode mode) override;
|
||||
void OnAvoidAreaChanged(std::vector<Rect> avoidAreas) override;
|
||||
|
||||
private:
|
||||
|
||||
+11
-1
@@ -262,7 +262,12 @@ WMError WindowImpl::SetWindowMode(WindowMode mode)
|
||||
property_->SetWindowMode(mode);
|
||||
} else if (state_ == WindowState::STATE_SHOWN) {
|
||||
property_->SetWindowMode(mode);
|
||||
return SingletonContainer::Get<WindowAdapter>().SetWindowMode(property_->GetWindowId(), mode);
|
||||
WMError ret = SingletonContainer::Get<WindowAdapter>().SetWindowMode(property_->GetWindowId(), mode);
|
||||
if (ret == WMError::WM_OK && windowChangeListener_ != nullptr) {
|
||||
WLOGFE("notify window mode changed");
|
||||
windowChangeListener_->OnModeChange(mode);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
if (property_->GetWindowMode() != mode) {
|
||||
WLOGFE("set window mode filed! id: %{public}d", property_->GetWindowId());
|
||||
@@ -730,6 +735,7 @@ void WindowImpl::RegisterLifeCycleListener(sptr<IWindowLifeCycle>& listener)
|
||||
|
||||
void WindowImpl::RegisterWindowChangeListener(sptr<IWindowChangeListener>& listener)
|
||||
{
|
||||
WLOGFE("RegisterWindowChangeListener, windowId %{public}u", GetWindowId());
|
||||
windowChangeListener_ = listener;
|
||||
}
|
||||
|
||||
@@ -797,7 +803,11 @@ void WindowImpl::UpdateRect(const struct Rect& rect, WindowSizeChangeReason reas
|
||||
|
||||
void WindowImpl::UpdateMode(WindowMode mode)
|
||||
{
|
||||
WLOGI("UpdateMode %{public}d", mode);
|
||||
property_->SetWindowMode(mode);
|
||||
if (windowChangeListener_ != nullptr) {
|
||||
windowChangeListener_->OnModeChange(mode);
|
||||
}
|
||||
}
|
||||
|
||||
void WindowImpl::ConsumeKeyEvent(std::shared_ptr<MMI::KeyEvent>& keyEvent)
|
||||
|
||||
Reference in New Issue
Block a user