!10945 输入法事务同步增强

Merge pull request !10945 from wulehui/ModifyKeyboardSync-1
This commit is contained in:
openharmony_ci 2024-11-21 12:30:00 +00:00 committed by Gitee
commit 750556dc70
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -533,12 +533,18 @@ void KeyboardSession::RelayoutKeyBoard()
void KeyboardSession::OpenKeyboardSyncTransaction()
{
if (isKeyboardSyncTransactionOpen_) {
TLOGI(WmsLogTag::WMS_KEYBOARD, "Keyboard sync transaction is already open");
return;
}
isKeyboardSyncTransactionOpen_ = true;
auto task = []() {
auto task = [weakThis = wptr(this)]() {
auto session = weakThis.promote();
if (!session) {
TLOGNE(WmsLogTag::WMS_KEYBOARD, "keyboard session is null");
return WSError::WS_ERROR_DESTROYED_OBJECT;
}
if (session->isKeyboardSyncTransactionOpen_) {
TLOGNI(WmsLogTag::WMS_KEYBOARD, "Keyboard sync transaction is already open");
return WSError::WS_OK;
}
TLOGNI(WmsLogTag::WMS_KEYBOARD, "Open keyboard sync");
session->isKeyboardSyncTransactionOpen_ = true;
auto transactionController = RSSyncTransactionController::GetInstance();
if (transactionController) {
transactionController->OpenSyncTransaction();
@ -551,14 +557,14 @@ void KeyboardSession::OpenKeyboardSyncTransaction()
void KeyboardSession::CloseKeyboardSyncTransaction(const WSRect& keyboardPanelRect,
bool isKeyboardShow, bool isRotating)
{
TLOGI(WmsLogTag::WMS_KEYBOARD, "keyboardPanelRect: %{public}s, isKeyboardShow: %{public}d, isRotating: %{public}d",
keyboardPanelRect.ToString().c_str(), isKeyboardShow, isRotating);
auto task = [weakThis = wptr(this), keyboardPanelRect, isKeyboardShow, isRotating]() {
auto session = weakThis.promote();
if (!session) {
TLOGE(WmsLogTag::WMS_KEYBOARD, "keyboard session is null");
return WSError::WS_ERROR_DESTROYED_OBJECT;
}
TLOGNI(WmsLogTag::WMS_KEYBOARD, "Close keyboard sync, isKeyboardShow: %{public}d, isRotating: %{public}d",
isKeyboardShow, isRotating);
std::shared_ptr<RSTransaction> rsTransaction = nullptr;
if (!isRotating && session->isKeyboardSyncTransactionOpen_) {
rsTransaction = session->GetRSTransaction();