mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 02:17:36 +08:00
IME fix
This commit is contained in:
@@ -7141,7 +7141,7 @@ bool GFX_IsFullscreen(void) {
|
||||
|
||||
static bool CheckEnableImmOnKey(SDL_KeyboardEvent key)
|
||||
{
|
||||
if(key.keysym.sym == 0 || key.keysym.sym == 0x08 || key.keysym.sym == 0x113 || key.keysym.sym == 0x114) {
|
||||
if(key.keysym.sym == 0 || (!SDL_IM_Composition() && (key.keysym.sym == 0x08 || key.keysym.sym == 0x20 || key.keysym.sym == 0x113 || key.keysym.sym == 0x114))) {
|
||||
// BS, <-, ->
|
||||
return true;
|
||||
}
|
||||
|
@@ -347,6 +347,7 @@ extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void);
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);
|
||||
|
||||
extern DECLSPEC int SDL_IM_Composition();
|
||||
extern DECLSPEC int SDL_SetIMPosition( int x, int y );
|
||||
extern DECLSPEC char *SDL_SetIMValues(SDL_imvalue value, ...);
|
||||
extern DECLSPEC char *SDL_GetIMValues(SDL_imvalue value, ...);
|
||||
|
@@ -40,6 +40,7 @@
|
||||
SDL_EventFilter SDL_EventOK = NULL;
|
||||
Uint8 SDL_ProcessEvents[SDL_NUMEVENTS];
|
||||
static Uint32 SDL_eventstate = 0;
|
||||
Uint32 end_ticks = 0;
|
||||
|
||||
/* Private data -- event queue */
|
||||
#define MAXEVENTS 256
|
||||
@@ -596,7 +597,17 @@ int SDL_FlushIMString(void *buffer)
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#include "../video/wincommon/SDL_lowvideo.h"
|
||||
wchar_t CompositionFontName[LF_FACESIZE];
|
||||
int SDL_IM_Composition() {
|
||||
#ifdef ENABLE_IM_EVENT
|
||||
#define IME_END_CR_WAIT 50
|
||||
return IM_Context.bCompos||end_ticks&&(GetTickCount()-end_ticks<IME_END_CR_WAIT) ? 1 : 0;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void SDL_SetCompositionFontName(const char *name)
|
||||
|
@@ -96,6 +96,7 @@ static WNDPROCTYPE userWindowProc = NULL;
|
||||
int DIB_HandleComposition(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
/* data field required by DIB_HandleComposition */
|
||||
static COMPOSITIONFORM form;
|
||||
extern Uint32 end_ticks;
|
||||
extern wchar_t CompositionFontName[LF_FACESIZE];
|
||||
#endif
|
||||
|
||||
@@ -248,6 +249,8 @@ LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
|
||||
wParam = rotateKey(wParam, this->hidden->gapiInfo->coordinateTransform);
|
||||
}
|
||||
#endif
|
||||
/* Ignore repeated keys */
|
||||
// if ( lParam&REPEATED_KEYMASK ) return(0);
|
||||
switch (wParam) {
|
||||
case VK_CONTROL:
|
||||
if ( lParam&EXTENDED_KEYMASK )
|
||||
@@ -421,6 +424,7 @@ LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
|
||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
//FLIP_BREAK;
|
||||
case WM_IME_ENDCOMPOSITION:
|
||||
end_ticks = GetTickCount();
|
||||
IM_Context.bCompos = 0;
|
||||
FLIP_BREAK;
|
||||
case WM_IME_NOTIFY:
|
||||
|
@@ -73,7 +73,7 @@ static WNDPROCTYPE userWindowProc = NULL;
|
||||
int DX5_HandleComposition(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
/* data field required by DX5_HandleComposition */
|
||||
static COMPOSITIONFORM form;
|
||||
static DWORD end_ticks;
|
||||
extern Uint32 end_ticks;
|
||||
extern wchar_t CompositionFontName[LF_FACESIZE];
|
||||
#define IME_MESSAGE_WAIT 1
|
||||
#define IME_END_CR_WAIT 50
|
||||
|
Reference in New Issue
Block a user