diff --git a/CHANGELOG b/CHANGELOG index d790eefc7..7820d3a4b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ 0.83.21 - Pausing the emulation will automatically release the mouse and prevent mouse capture. (Wengier) + - Improved IME support for CJK languages on the + Windows SDL2 builds. (Wengier) - The selected text will be highlighted when you try to select text for copying in J-3100 mode. (Wengier) - Config option "pixelshader" now allows a shader file @@ -9,7 +11,9 @@ - Added config options (in "ethernet, slirp" section) "tcp_port_forwards" and "tcp_port_forwards" for port forwarding when using the Slirp backend. (kcgen) - - Added hidden code page 951 for Big5-HKSCS. (Wengier) + - Added hidden code page 951 for Big5-HKSCS encoding. + If ChinaSea is enabled, ChinaSea characters will be + used instead of the original characters. (Wengier) - Mac OS X builds from now on will use an in-tree tool to replace dylib references in all executable files. XCode install_name_tool is no longer used, it became diff --git a/src/dosbox.cpp b/src/dosbox.cpp index 7d416a1f1..38a8f46e0 100644 --- a/src/dosbox.cpp +++ b/src/dosbox.cpp @@ -1102,6 +1102,9 @@ void DOSBOX_RealInit() { } #elif (defined(WIN32) && !defined(HX_DOS) || defined(LINUX) && C_X11) && defined(C_SDL2) if (enableime && !control->opt_silent) { +#if !defined(SDL_DOSBOX_X_IME) + LOG_MSG("Note: The linked SDL 2.x library is not compiled with enhanced IME functions.") +#endif dos.im_enable_flag = true; SDL_StartTextInput(); #if defined(LINUX) diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index cfdbfa59f..cc400d364 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -7488,7 +7488,11 @@ static bool CheckEnableImmOnKey(SDL_KeyboardEvent key) #elif defined(WIN32) && !defined(HX_DOS) && defined(C_SDL2) static bool CheckEnableImmOnKey(SDL_KeyboardEvent key) { - if(key.keysym.scancode == 0x29 || (key.keysym.scancode >= 0x49 && key.keysym.scancode <= 0x52) || (key.keysym.scancode >= 0xe0 && key.keysym.scancode <= 0xe6) || (strPasteBuffer.length() && key.keysym.sym >= 0x20)) { + if(key.keysym.scancode == 0x29 || +#if defined(SDL_DOSBOX_X_IME) + (!SDL_IM_Composition() && (key.keysym.sym == 0x08 || key.keysym.sym == 0x09 || key.keysym.sym >= 0x20 && key.keysym.sym <= 0x7F || key.keysym.sym >= 0x111 && key.keysym.sym <= 0x119)) || +#endif + (key.keysym.scancode >= 0x49 && key.keysym.scancode <= 0x52) || (key.keysym.scancode >= 0xe0 && key.keysym.scancode <= 0xe6) || (strPasteBuffer.length() && key.keysym.sym >= 0x20)) { // ESC, shift, control, alt, PgUp, PgDn, etc. return true; } else if((key.keysym.mod & 0x03) != 0 && key.keysym.scancode == 0x2c) { diff --git a/src/shell/shell_misc.cpp b/src/shell/shell_misc.cpp index c8f84bc5d..259e1cd99 100644 --- a/src/shell/shell_misc.cpp +++ b/src/shell/shell_misc.cpp @@ -50,9 +50,8 @@ bool clearline=false, inshell=false; int autofixwarn=3; extern int lfn_filefind_handle; -extern bool ctrlbrk, gbk, rtl; -extern bool DOS_BreakFlag; -extern bool DOS_BreakConioFlag; +extern bool ctrlbrk, gbk, rtl, dbcs_sbcs; +extern bool DOS_BreakFlag, DOS_BreakConioFlag; extern uint16_t cmd_line_seg; #if defined(USE_TTF) extern bool ttf_dosv; @@ -558,7 +557,7 @@ void DOS_Shell::InputCommand(char * line) { break; case 0x4B00: /* LEFT */ - if(IS_PC98_ARCH || (isDBCSCP() && IS_DOS_JAPANESE)) { + if(IS_PC98_ARCH || (isDBCSCP() && dbcs_sbcs && IS_DOS_JAPANESE)) { if (str_index) { uint16_t count = GetWideCount(line, str_index); uint8_t ch = line[str_index - 1]; @@ -572,7 +571,7 @@ void DOS_Shell::InputCommand(char * line) { } } } else { - if (isDBCSCP()&&str_index>1&&(line[str_index-1]<0||((dos.loaded_codepage==932||(dos.loaded_codepage==936&&gbk)||dos.loaded_codepage==950||dos.loaded_codepage==951)&&line[str_index-1]>=0x40))&&line[str_index-2]<0) { + if (isDBCSCP()&&dbcs_sbcs&&str_index>1&&(line[str_index-1]<0||((dos.loaded_codepage==932||(dos.loaded_codepage==936&&gbk)||dos.loaded_codepage==950||dos.loaded_codepage==951)&&line[str_index-1]>=0x40))&&line[str_index-2]<0) { backone(); str_index --; MoveCaretBackwards(); @@ -631,7 +630,7 @@ void DOS_Shell::InputCommand(char * line) { } break; case 0x4D00: /* RIGHT */ - if(IS_PC98_ARCH || (isDBCSCP() && IS_DOS_JAPANESE)) { + if(IS_PC98_ARCH || (isDBCSCP() && dbcs_sbcs && IS_DOS_JAPANESE)) { if (str_index < str_len) { uint16_t count = 1; if(str_index < str_len - 1) { @@ -643,7 +642,7 @@ void DOS_Shell::InputCommand(char * line) { } } } else { - if (isDBCSCP()&&str_index=0x40))) { + if (isDBCSCP()&&dbcs_sbcs&&str_index=0x40))) { outc((uint8_t)line[str_index++]); } if (str_index < str_len) { @@ -735,14 +734,14 @@ void DOS_Shell::InputCommand(char * line) { break; case 0x5300:/* DELETE */ - if(IS_PC98_ARCH || (isDBCSCP() && IS_DOS_JAPANESE)) { + if(IS_PC98_ARCH || (isDBCSCP() && dbcs_sbcs && IS_DOS_JAPANESE)) { if(str_len) { size += DeleteBackspace(true, line, str_index, str_len); } } else { if(str_index>=str_len) break; int k=1; - if (isDBCSCP()&&str_index=0x40))) + if (isDBCSCP()&&dbcs_sbcs&&str_index=0x40))) k=2; for (int i=0; i1&&(line[str_index-1]<0||((dos.loaded_codepage==932||(dos.loaded_codepage==936&&gbk)||dos.loaded_codepage==950||dos.loaded_codepage==951)&&line[str_index-1]>=0x40))&&line[str_index-2]<0) + if (isDBCSCP()&&dbcs_sbcs&&str_index>1&&(line[str_index-1]<0||((dos.loaded_codepage==932||(dos.loaded_codepage==936&&gbk)||dos.loaded_codepage==950||dos.loaded_codepage==951)&&line[str_index-1]>=0x40))&&line[str_index-2]<0) k=2; for (int i=0; i #ifndef SDL_DISABLE_WINDOWS_IME +static Uint32 end_ticks = 0; +static SDL_bool ime_incompos; static void IME_Init(SDL_VideoData *videodata, HWND hwnd); static void IME_Enable(SDL_VideoData *videodata, HWND hwnd); static void IME_Disable(SDL_VideoData *videodata, HWND hwnd); @@ -157,6 +159,15 @@ WIN_QuitKeyboard(_THIS) #endif } +SDL_bool SDL_IM_Composition() { +#ifndef SDL_DISABLE_WINDOWS_IME +#define IME_END_CR_WAIT 50 + return ime_incompos||end_ticks&&(GetTickCount()-end_ticksime_composition[0] = 0; videodata->ime_readingstring[0] = 0; videodata->ime_cursor = 0;