Skip to content

Commit

Permalink
IME: better support
Browse files Browse the repository at this point in the history
  • Loading branch information
xfangfang committed Dec 14, 2023
1 parent d4458e1 commit 6545d6f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
9 changes: 6 additions & 3 deletions scripts/psv/sdl2/VITABUILD
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
pkgname=sdl2
pkgver=2.28.1
pkgver=2.28.5
pkgrel=1
gitrev=4761467b2e8cc7db3d6bc98747daca0051858f09
gitrev=15ead9a40d09a1eb9972215cceac2bf29c9b77f6
url='https://www.libsdl.org'
source=(
"https://github.com/libsdl-org/SDL/archive/${gitrev}.tar.gz"
"ime.patch"
)
sha256sums=(
SKIP
SKIP
)

prepare() {
cd "SDL-${gitrev}"
patch --strip=1 --input=${srcdir}/ime.patch
}

build() {
Expand All @@ -22,7 +25,7 @@ build() {
-DCMAKE_BUILD_TYPE=Release \
-DVIDEO_VITA_PVR=ON \
-DSDL_TEST=OFF
make -j$(nproc)
make -j12
}

package () {
Expand Down
24 changes: 24 additions & 0 deletions scripts/psv/sdl2/ime.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/src/video/vita/SDL_vitavideo.c b/src/video/vita/SDL_vitavideo.c
index 9e823996e..f887ca4d0 100644
--- a/src/video/vita/SDL_vitavideo.c
+++ b/src/video/vita/SDL_vitavideo.c
@@ -438,16 +438,11 @@ void VITA_ImeEventHandler(void *arg, const SceImeEventData *e)
switch (e->id) {
case SCE_IME_EVENT_UPDATE_TEXT:
if (e->param.text.caretIndex == 0) {
- SDL_SendKeyboardKeyAutoRelease(SDL_SCANCODE_BACKSPACE);
+ SDL_SendKeyboardKeyAutoRelease(SDL_SCANCODE_ESCAPE);
sceImeSetText((SceWChar16 *)libime_initval, 4);
} else {
- scancode = SDL_GetScancodeFromKey(*(SceWChar16 *)&libime_out[1]);
- if (scancode == SDL_SCANCODE_SPACE) {
- SDL_SendKeyboardKeyAutoRelease(SDL_SCANCODE_SPACE);
- } else {
- utf16_to_utf8((SceWChar16 *)&libime_out[1], utf8_buffer);
- SDL_SendKeyboardText((const char *)utf8_buffer);
- }
+ utf16_to_utf8((SceWChar16 *)&libime_out[1], utf8_buffer);
+ SDL_SendKeyboardText((const char *)utf8_buffer);
SDL_memset(&caret_rev, 0, sizeof(SceImeCaret));
SDL_memset(libime_out, 0, ((SCE_IME_MAX_PREEDIT_LENGTH + SCE_IME_MAX_TEXT_LENGTH + 1) * sizeof(SceWChar16)));
caret_rev.index = 1;
3 changes: 2 additions & 1 deletion wiliwili/source/activity/player_base_activity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ class DataSourceCommentList : public RecyclingGridDataSource,
if (!DialogHelper::checkLogin()) return;
// 回复评论
brls::Application::getImeManager()->openForText(
[this, recycler](std::string text) {
[this, recycler](const std::string& text) {
if (text.empty()) return ;
this->commentReply(
text, aid, 0, 0,
[this, recycler](
Expand Down

0 comments on commit 6545d6f

Please sign in to comment.