mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-27 00:51:35 +00:00
!5165 修复ui侧焦点回调多线程问题
Merge pull request !5165 from slarkwayne/remote_uiFocusLock0226
This commit is contained in:
commit
27ec938705
@ -529,6 +529,9 @@ private:
|
||||
mutable std::shared_mutex propertyMutex_;
|
||||
sptr<WindowSessionProperty> property_;
|
||||
|
||||
mutable std::shared_mutex uiRequestFocusMutex_;
|
||||
mutable std::shared_mutex uiLostFocusMutex_;
|
||||
|
||||
bool showRecent_ = false;
|
||||
bool bufferAvailable_ = false;
|
||||
WSRect preRect_;
|
||||
|
@ -1829,11 +1829,13 @@ void Session::SetRequestFocusStatusNotifyManagerListener(const NotifyRequestFocu
|
||||
|
||||
void Session::SetNotifyUIRequestFocusFunc(const NotifyUIRequestFocusFunc& func)
|
||||
{
|
||||
std::unique_lock<std::shared_mutex> lock(uiRequestFocusMutex_);
|
||||
requestFocusFunc_ = func;
|
||||
}
|
||||
|
||||
void Session::SetNotifyUILostFocusFunc(const NotifyUILostFocusFunc& func)
|
||||
{
|
||||
std::unique_lock<std::shared_mutex> lock(uiLostFocusMutex_);
|
||||
lostFocusFunc_ = func;
|
||||
}
|
||||
|
||||
@ -1930,6 +1932,7 @@ bool Session::GetStateFromManager(const ManagerState key)
|
||||
void Session::NotifyUIRequestFocus()
|
||||
{
|
||||
WLOGFD("NotifyUIRequestFocus id: %{public}d", GetPersistentId());
|
||||
std::shared_lock<std::shared_mutex> lock(uiRequestFocusMutex_);
|
||||
if (requestFocusFunc_) {
|
||||
requestFocusFunc_();
|
||||
}
|
||||
@ -1938,6 +1941,7 @@ void Session::NotifyUIRequestFocus()
|
||||
void Session::NotifyUILostFocus()
|
||||
{
|
||||
WLOGFD("NotifyUILostFocus id: %{public}d", GetPersistentId());
|
||||
std::shared_lock<std::shared_mutex> lock(uiLostFocusMutex_);
|
||||
if (lostFocusFunc_) {
|
||||
lostFocusFunc_();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user