Skip to content

Commit

Permalink
Turning off textinput when using SDL (#16421)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuguohua authored Oct 13, 2023
1 parent a731681 commit f8b5d13
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 6 additions & 0 deletions native/cocos/platform/SDLHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ int SDLHelper::init() {
CC_LOG_ERROR("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
return -1;
}
// (1) Disable IDE on windows platform.
// (2) On mac platform, SDL has an internal implementation of textinput ,
// which internally sends the SDL_TEXTINPUT event. Causing two events to be sent.
// So we need to stop the implementation of TextInput.
// (3) Other platforms do not use textinput in sdl.
stopTextInput();
return 0;
}

Expand Down
4 changes: 0 additions & 4 deletions native/cocos/ui/edit-box/EditBox-mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,6 @@ void initTextField(const cc::EditBox::ShowInfo &showInfo) {
}

void init(const cc::EditBox::ShowInfo &showInfo) {
// SDL has an internal implementation of textinput ,
// which internally sends the SDL_TEXTINPUT event. Causing two events to be sent.
// So we need to stop the implementation of TextInput.
cc::SDLHelper::stopTextInput();
if (showInfo.isMultiline)
initTextView(showInfo);
else
Expand Down

0 comments on commit f8b5d13

Please sign in to comment.