Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turning off textinput when using SDL #16421

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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