Fix to call imactivatefunc and imstatusfunc

This commit is contained in:
Kazuki Sakamoto
2017-11-29 22:15:24 -08:00
parent 28c6e2f1f7
commit 5689b8f5a4
3 changed files with 37 additions and 0 deletions
+25
View File
@@ -1290,6 +1290,15 @@ mch_set_mouse_shape(int shape)
// -- Input Method ----------------------------------------------------------
#if defined(FEAT_MBYTE)
# if defined(FEAT_EVAL)
# ifdef FEAT_GUI
# define USE_IMACTIVATEFUNC (!gui.in_use && *p_imaf != NUL)
# define USE_IMSTATUSFUNC (!gui.in_use && *p_imsf != NUL)
# else
# define USE_IMACTIVATEFUNC (*p_imaf != NUL)
# define USE_IMSTATUSFUNC (*p_imsf != NUL)
# endif
# endif
void
im_set_position(int row, int col)
@@ -1312,6 +1321,17 @@ im_set_control(int enable)
void
im_set_active(int active)
{
#if defined(FEAT_EVAL)
if (USE_IMACTIVATEFUNC)
{
if (active != im_get_status())
{
call_imactivatefunc(active);
}
return;
}
#endif
// Tell frontend to enable/disable IM (called e.g. when the mode changes).
if (!p_imdisable) {
int msgid = active ? ActivateKeyScriptMsgID : DeactivateKeyScriptMsgID;
@@ -1324,6 +1344,11 @@ im_set_active(int active)
int
im_get_status(void)
{
# ifdef FEAT_EVAL
if (USE_IMSTATUSFUNC)
return call_imstatusfunc();
# endif
return [[MMBackend sharedInstance] imState];
}
+8
View File
@@ -4791,7 +4791,11 @@ iconv_end(void)
#endif
#if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
# ifdef FEAT_GUI_MACVIM
void
# else
static void
# endif
call_imactivatefunc(int active)
{
char_u *argv[1];
@@ -4803,7 +4807,11 @@ call_imactivatefunc(int active)
(void)call_func_retnr(p_imaf, 1, argv, FALSE);
}
# ifdef FEAT_GUI_MACVIM
int
# else
static int
# endif
call_imstatusfunc(void)
{
int is_active;
+4
View File
@@ -98,4 +98,8 @@ int convert_input(char_u *ptr, int len, int maxlen);
int convert_input_safe(char_u *ptr, int len, int maxlen, char_u **restp, int *restlenp);
char_u *string_convert(vimconv_T *vcp, char_u *ptr, int *lenp);
char_u *string_convert_ext(vimconv_T *vcp, char_u *ptr, int *lenp, int *unconvlenp);
#ifdef FEAT_GUI_MACVIM
void call_imactivatefunc(int active);
int call_imstatusfunc(void);
#endif
/* vim: set ft=c : */