mirror of
https://github.com/zoriya/vim.git
synced 2025-12-19 21:55:18 +00:00
patch 8.0.1338: USE_IM_CONTROL is confusing and incomplete
Problem: USE_IM_CONTROL is confusing and incomplete. Solution: Just use FEAT_MBYTE. Call 'imactivatefunc' also without GUI.
This commit is contained in:
12
src/edit.c
12
src/edit.c
@@ -516,7 +516,7 @@ edit(
|
|||||||
*/
|
*/
|
||||||
if (curbuf->b_p_iminsert == B_IMODE_LMAP)
|
if (curbuf->b_p_iminsert == B_IMODE_LMAP)
|
||||||
State |= LANGMAP;
|
State |= LANGMAP;
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
im_set_active(curbuf->b_p_iminsert == B_IMODE_IM);
|
im_set_active(curbuf->b_p_iminsert == B_IMODE_IM);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -8372,7 +8372,7 @@ ins_reg(void)
|
|||||||
++no_u_sync;
|
++no_u_sync;
|
||||||
if (regname == '=')
|
if (regname == '=')
|
||||||
{
|
{
|
||||||
# ifdef USE_IM_CONTROL
|
# ifdef FEAT_MBYTE
|
||||||
int im_on = im_get_status();
|
int im_on = im_get_status();
|
||||||
# endif
|
# endif
|
||||||
/* Sync undo when evaluating the expression calls setline() or
|
/* Sync undo when evaluating the expression calls setline() or
|
||||||
@@ -8380,7 +8380,7 @@ ins_reg(void)
|
|||||||
u_sync_once = 2;
|
u_sync_once = 2;
|
||||||
|
|
||||||
regname = get_expr_register();
|
regname = get_expr_register();
|
||||||
# ifdef USE_IM_CONTROL
|
# ifdef FEAT_MBYTE
|
||||||
/* Restore the Input Method. */
|
/* Restore the Input Method. */
|
||||||
if (im_on)
|
if (im_on)
|
||||||
im_set_active(TRUE);
|
im_set_active(TRUE);
|
||||||
@@ -8509,12 +8509,12 @@ ins_ctrl_hat(void)
|
|||||||
{
|
{
|
||||||
curbuf->b_p_iminsert = B_IMODE_LMAP;
|
curbuf->b_p_iminsert = B_IMODE_LMAP;
|
||||||
State |= LANGMAP;
|
State |= LANGMAP;
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
im_set_active(FALSE);
|
im_set_active(FALSE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* There are no ":lmap" mappings, toggle IM */
|
/* There are no ":lmap" mappings, toggle IM */
|
||||||
@@ -8661,7 +8661,7 @@ ins_esc(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
/* Disable IM to allow typing English directly for Normal mode commands.
|
/* Disable IM to allow typing English directly for Normal mode commands.
|
||||||
* When ":lmap" is enabled don't change 'iminsert' (IM can be enabled as
|
* When ":lmap" is enabled don't change 'iminsert' (IM can be enabled as
|
||||||
* well). */
|
* well). */
|
||||||
|
|||||||
@@ -359,11 +359,11 @@ getcmdline(
|
|||||||
b_im_ptr = &curbuf->b_p_imsearch;
|
b_im_ptr = &curbuf->b_p_imsearch;
|
||||||
if (*b_im_ptr == B_IMODE_LMAP)
|
if (*b_im_ptr == B_IMODE_LMAP)
|
||||||
State |= LANGMAP;
|
State |= LANGMAP;
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
im_set_active(*b_im_ptr == B_IMODE_IM);
|
im_set_active(*b_im_ptr == B_IMODE_IM);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
else if (p_imcmdline)
|
else if (p_imcmdline)
|
||||||
im_set_active(TRUE);
|
im_set_active(TRUE);
|
||||||
#endif
|
#endif
|
||||||
@@ -1119,7 +1119,7 @@ getcmdline(
|
|||||||
{
|
{
|
||||||
/* ":lmap" mappings exists, toggle use of mappings. */
|
/* ":lmap" mappings exists, toggle use of mappings. */
|
||||||
State ^= LANGMAP;
|
State ^= LANGMAP;
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
im_set_active(FALSE); /* Disable input method */
|
im_set_active(FALSE); /* Disable input method */
|
||||||
#endif
|
#endif
|
||||||
if (b_im_ptr != NULL)
|
if (b_im_ptr != NULL)
|
||||||
@@ -1130,7 +1130,7 @@ getcmdline(
|
|||||||
*b_im_ptr = B_IMODE_NONE;
|
*b_im_ptr = B_IMODE_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* There are no ":lmap" mappings, toggle IM. When
|
/* There are no ":lmap" mappings, toggle IM. When
|
||||||
@@ -2143,7 +2143,7 @@ returncmd:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
State = save_State;
|
State = save_State;
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
if (b_im_ptr != NULL && *b_im_ptr != B_IMODE_LMAP)
|
if (b_im_ptr != NULL && *b_im_ptr != B_IMODE_LMAP)
|
||||||
im_save_status(b_im_ptr);
|
im_save_status(b_im_ptr);
|
||||||
im_set_active(FALSE);
|
im_set_active(FALSE);
|
||||||
|
|||||||
@@ -2890,7 +2890,7 @@ vgetorpeek(int advance)
|
|||||||
+ typebuf.tb_len] != NUL)
|
+ typebuf.tb_len] != NUL)
|
||||||
typebuf.tb_noremap[typebuf.tb_off
|
typebuf.tb_noremap[typebuf.tb_off
|
||||||
+ typebuf.tb_len++] = RM_YES;
|
+ typebuf.tb_len++] = RM_YES;
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
/* Get IM status right after getting keys, not after the
|
/* Get IM status right after getting keys, not after the
|
||||||
* timeout for a mapping (focus may be lost by then). */
|
* timeout for a mapping (focus may be lost by then). */
|
||||||
vgetc_im_active = im_get_status();
|
vgetc_im_active = im_get_status();
|
||||||
|
|||||||
@@ -1022,7 +1022,7 @@ EXTERN int stop_insert_mode; /* for ":stopinsert" and 'insertmode' */
|
|||||||
|
|
||||||
EXTERN int KeyTyped; /* TRUE if user typed current char */
|
EXTERN int KeyTyped; /* TRUE if user typed current char */
|
||||||
EXTERN int KeyStuffed; /* TRUE if current char from stuffbuf */
|
EXTERN int KeyStuffed; /* TRUE if current char from stuffbuf */
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
EXTERN int vgetc_im_active; /* Input Method was active for last
|
EXTERN int vgetc_im_active; /* Input Method was active for last
|
||||||
character obtained from vgetc() */
|
character obtained from vgetc() */
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1078,7 +1078,7 @@ gui_update_cursor(
|
|||||||
gui_undraw_cursor();
|
gui_undraw_cursor();
|
||||||
if (gui.row < 0)
|
if (gui.row < 0)
|
||||||
return;
|
return;
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
if (gui.row != gui.cursor_row || gui.col != gui.cursor_col)
|
if (gui.row != gui.cursor_row || gui.col != gui.cursor_col)
|
||||||
im_set_position(gui.row, gui.col);
|
im_set_position(gui.row, gui.col);
|
||||||
#endif
|
#endif
|
||||||
@@ -1136,7 +1136,7 @@ gui_update_cursor(
|
|||||||
if (id > 0)
|
if (id > 0)
|
||||||
{
|
{
|
||||||
cattr = syn_id2colors(id, &cfg, &cbg);
|
cattr = syn_id2colors(id, &cfg, &cbg);
|
||||||
#if defined(USE_IM_CONTROL) || defined(FEAT_HANGULIN)
|
#if defined(FEAT_MBYTE) || defined(FEAT_HANGULIN)
|
||||||
{
|
{
|
||||||
static int iid;
|
static int iid;
|
||||||
guicolor_T fg, bg;
|
guicolor_T fg, bg;
|
||||||
|
|||||||
@@ -2024,15 +2024,15 @@ gui_mac_handle_window_activate(
|
|||||||
switch (eventKind)
|
switch (eventKind)
|
||||||
{
|
{
|
||||||
case kEventWindowActivated:
|
case kEventWindowActivated:
|
||||||
#if defined(USE_IM_CONTROL)
|
# if defined(FEAT_MBYTE)
|
||||||
im_on_window_switch(TRUE);
|
im_on_window_switch(TRUE);
|
||||||
#endif
|
# endif
|
||||||
return noErr;
|
return noErr;
|
||||||
|
|
||||||
case kEventWindowDeactivated:
|
case kEventWindowDeactivated:
|
||||||
#if defined(USE_IM_CONTROL)
|
# if defined(FEAT_MBYTE)
|
||||||
im_on_window_switch(FALSE);
|
im_on_window_switch(FALSE);
|
||||||
#endif
|
# endif
|
||||||
return noErr;
|
return noErr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6230,7 +6230,7 @@ char_u *FullPathFromFSSpec_save(FSSpec file)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined(USE_IM_CONTROL) || defined(PROTO)) && defined(USE_CARBONKEYHANDLER)
|
#if (defined(FEAT_MBYTE) || defined(PROTO)) && defined(USE_CARBONKEYHANDLER)
|
||||||
/*
|
/*
|
||||||
* Input Method Control functions.
|
* Input Method Control functions.
|
||||||
*/
|
*/
|
||||||
@@ -6317,7 +6317,7 @@ im_set_active(int active)
|
|||||||
ScriptLanguageRecord *slptr = NULL;
|
ScriptLanguageRecord *slptr = NULL;
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
|
|
||||||
if (! gui.in_use)
|
if (!gui.in_use)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (im_initialized == 0)
|
if (im_initialized == 0)
|
||||||
@@ -6379,7 +6379,7 @@ im_get_status(void)
|
|||||||
return im_is_active;
|
return im_is_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(USE_IM_CONTROL) || defined(PROTO) */
|
#endif /* defined(FEAT_MBYTE) || defined(PROTO) */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -485,12 +485,10 @@ static void TrackUserActivity(UINT uMsg);
|
|||||||
* These LOGFONT used for IME.
|
* These LOGFONT used for IME.
|
||||||
*/
|
*/
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
# ifdef USE_IM_CONTROL
|
|
||||||
/* holds LOGFONT for 'guifontwide' if available, otherwise 'guifont' */
|
/* holds LOGFONT for 'guifontwide' if available, otherwise 'guifont' */
|
||||||
static LOGFONT norm_logfont;
|
static LOGFONT norm_logfont;
|
||||||
/* holds LOGFONT for 'guifont' always. */
|
/* holds LOGFONT for 'guifont' always. */
|
||||||
static LOGFONT sub_logfont;
|
static LOGFONT sub_logfont;
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE_IME
|
#ifdef FEAT_MBYTE_IME
|
||||||
|
|||||||
161
src/mbyte.c
161
src/mbyte.c
@@ -4794,6 +4794,26 @@ call_imactivatefunc(int active)
|
|||||||
argv[0] = (char_u *)"0";
|
argv[0] = (char_u *)"0";
|
||||||
(void)call_func_retnr(p_imaf, 1, argv, FALSE);
|
(void)call_func_retnr(p_imaf, 1, argv, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
call_imstatusfunc(void)
|
||||||
|
{
|
||||||
|
int is_active;
|
||||||
|
|
||||||
|
/* FIXME: Don't execute user function in unsafe situation. */
|
||||||
|
if (exiting
|
||||||
|
# ifdef FEAT_AUTOCMD
|
||||||
|
|| is_autocmd_blocked()
|
||||||
|
# endif
|
||||||
|
)
|
||||||
|
return FALSE;
|
||||||
|
/* FIXME: :py print 'xxx' is shown duplicate result.
|
||||||
|
* Use silent to avoid it. */
|
||||||
|
++msg_silent;
|
||||||
|
is_active = call_func_retnr(p_imsf, 0, NULL, FALSE);
|
||||||
|
--msg_silent;
|
||||||
|
return (is_active > 0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_XIM) || defined(PROTO)
|
#if defined(FEAT_XIM) || defined(PROTO)
|
||||||
@@ -4838,14 +4858,7 @@ im_set_active(int active)
|
|||||||
im_is_active = (active && !p_imdisable);
|
im_is_active = (active && !p_imdisable);
|
||||||
|
|
||||||
if (im_is_active != was_active)
|
if (im_is_active != was_active)
|
||||||
{
|
|
||||||
#ifdef FEAT_EVAL
|
|
||||||
if (p_imaf[0] != NUL)
|
|
||||||
call_imactivatefunc(im_is_active);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
xim_reset();
|
xim_reset();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -5675,6 +5688,11 @@ im_synthesize_keypress(unsigned int keyval, unsigned int state)
|
|||||||
void
|
void
|
||||||
xim_reset(void)
|
xim_reset(void)
|
||||||
{
|
{
|
||||||
|
#ifdef FEAT_EVAL
|
||||||
|
if (p_imaf[0] != NUL)
|
||||||
|
call_imactivatefunc(im_is_active);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
if (xic != NULL)
|
if (xic != NULL)
|
||||||
{
|
{
|
||||||
gtk_im_context_reset(xic);
|
gtk_im_context_reset(xic);
|
||||||
@@ -5685,11 +5703,6 @@ xim_reset(void)
|
|||||||
{
|
{
|
||||||
xim_set_focus(gui.in_focus);
|
xim_set_focus(gui.in_focus);
|
||||||
|
|
||||||
# ifdef FEAT_EVAL
|
|
||||||
if (p_imaf[0] != NUL)
|
|
||||||
call_imactivatefunc(im_is_active);
|
|
||||||
else
|
|
||||||
# endif
|
|
||||||
if (im_activatekey_keyval != GDK_VoidSymbol)
|
if (im_activatekey_keyval != GDK_VoidSymbol)
|
||||||
{
|
{
|
||||||
if (im_is_active)
|
if (im_is_active)
|
||||||
@@ -5856,23 +5869,7 @@ im_get_status(void)
|
|||||||
{
|
{
|
||||||
# ifdef FEAT_EVAL
|
# ifdef FEAT_EVAL
|
||||||
if (p_imsf[0] != NUL)
|
if (p_imsf[0] != NUL)
|
||||||
{
|
return call_imstatusfunc();
|
||||||
int is_active;
|
|
||||||
|
|
||||||
/* FIXME: Don't execute user function in unsafe situation. */
|
|
||||||
if (exiting
|
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
|| is_autocmd_blocked()
|
|
||||||
# endif
|
|
||||||
)
|
|
||||||
return FALSE;
|
|
||||||
/* FIXME: :py print 'xxx' is shown duplicate result.
|
|
||||||
* Use silent to avoid it. */
|
|
||||||
++msg_silent;
|
|
||||||
is_active = call_func_retnr(p_imsf, 0, NULL, FALSE);
|
|
||||||
--msg_silent;
|
|
||||||
return (is_active > 0);
|
|
||||||
}
|
|
||||||
# endif
|
# endif
|
||||||
return im_is_active;
|
return im_is_active;
|
||||||
}
|
}
|
||||||
@@ -5894,30 +5891,45 @@ im_is_preediting(void)
|
|||||||
static int xim_is_active = FALSE; /* XIM should be active in the current
|
static int xim_is_active = FALSE; /* XIM should be active in the current
|
||||||
mode */
|
mode */
|
||||||
static int xim_has_focus = FALSE; /* XIM is really being used for Vim */
|
static int xim_has_focus = FALSE; /* XIM is really being used for Vim */
|
||||||
#ifdef FEAT_GUI_X11
|
# ifdef FEAT_GUI_X11
|
||||||
static XIMStyle input_style;
|
static XIMStyle input_style;
|
||||||
static int status_area_enabled = TRUE;
|
static int status_area_enabled = TRUE;
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Switch using XIM on/off. This is used by the code that changes "State".
|
* Switch using XIM on/off. This is used by the code that changes "State".
|
||||||
|
* When 'imactivatefunc' is defined use that function instead.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
im_set_active(int active)
|
im_set_active(int active_arg)
|
||||||
{
|
{
|
||||||
if (xic == NULL)
|
int active = active_arg;
|
||||||
return;
|
|
||||||
|
|
||||||
/* If 'imdisable' is set, XIM is never active. */
|
/* If 'imdisable' is set, XIM is never active. */
|
||||||
if (p_imdisable)
|
if (p_imdisable)
|
||||||
active = FALSE;
|
active = FALSE;
|
||||||
#if !defined(FEAT_GUI_GTK)
|
# if !defined(FEAT_GUI_GTK)
|
||||||
else if (input_style & XIMPreeditPosition)
|
else if (input_style & XIMPreeditPosition)
|
||||||
/* There is a problem in switching XIM off when preediting is used,
|
/* There is a problem in switching XIM off when preediting is used,
|
||||||
* and it is not clear how this can be solved. For now, keep XIM on
|
* and it is not clear how this can be solved. For now, keep XIM on
|
||||||
* all the time, like it was done in Vim 5.8. */
|
* all the time, like it was done in Vim 5.8. */
|
||||||
active = TRUE;
|
active = TRUE;
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
|
# if defined(FEAT_EVAL)
|
||||||
|
if (p_imaf[0] != NUL)
|
||||||
|
{
|
||||||
|
if (active != im_get_status())
|
||||||
|
{
|
||||||
|
call_imactivatefunc(active);
|
||||||
|
im_is_active = active;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
if (xic == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Remember the active state, it is needed when Vim gets keyboard focus. */
|
/* Remember the active state, it is needed when Vim gets keyboard focus. */
|
||||||
xim_is_active = active;
|
xim_is_active = active;
|
||||||
@@ -6019,11 +6031,11 @@ xim_set_preedit(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FEAT_GUI_X11)
|
# if defined(FEAT_GUI_X11)
|
||||||
static char e_xim[] = N_("E285: Failed to create input context");
|
static char e_xim[] = N_("E285: Failed to create input context");
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#if defined(FEAT_GUI_X11) || defined(PROTO)
|
# if defined(FEAT_GUI_X11) || defined(PROTO)
|
||||||
# if defined(XtSpecificationRelease) && XtSpecificationRelease >= 6 && !defined(SUN_SYSTEM)
|
# if defined(XtSpecificationRelease) && XtSpecificationRelease >= 6 && !defined(SUN_SYSTEM)
|
||||||
# define USE_X11R6_XIM
|
# define USE_X11R6_XIM
|
||||||
# endif
|
# endif
|
||||||
@@ -6031,7 +6043,7 @@ static char e_xim[] = N_("E285: Failed to create input context");
|
|||||||
static int xim_real_init(Window x11_window, Display *x11_display);
|
static int xim_real_init(Window x11_window, Display *x11_display);
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_X11R6_XIM
|
# ifdef USE_X11R6_XIM
|
||||||
static void xim_destroy_cb(XIM im, XPointer client_data, XPointer call_data);
|
static void xim_destroy_cb(XIM im, XPointer client_data, XPointer call_data);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -6043,9 +6055,9 @@ xim_instantiate_cb(
|
|||||||
Window x11_window;
|
Window x11_window;
|
||||||
Display *x11_display;
|
Display *x11_display;
|
||||||
|
|
||||||
#ifdef XIM_DEBUG
|
# ifdef XIM_DEBUG
|
||||||
xim_log("xim_instantiate_cb()\n");
|
xim_log("xim_instantiate_cb()\n");
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
gui_get_x11_windis(&x11_window, &x11_display);
|
gui_get_x11_windis(&x11_window, &x11_display);
|
||||||
if (display != x11_display)
|
if (display != x11_display)
|
||||||
@@ -6067,9 +6079,9 @@ xim_destroy_cb(
|
|||||||
Window x11_window;
|
Window x11_window;
|
||||||
Display *x11_display;
|
Display *x11_display;
|
||||||
|
|
||||||
#ifdef XIM_DEBUG
|
# ifdef XIM_DEBUG
|
||||||
xim_log("xim_destroy_cb()\n");
|
xim_log("xim_destroy_cb()\n");
|
||||||
#endif
|
#endif
|
||||||
gui_get_x11_windis(&x11_window, &x11_display);
|
gui_get_x11_windis(&x11_window, &x11_display);
|
||||||
|
|
||||||
xic = NULL;
|
xic = NULL;
|
||||||
@@ -6080,7 +6092,7 @@ xim_destroy_cb(
|
|||||||
XRegisterIMInstantiateCallback(x11_display, NULL, NULL, NULL,
|
XRegisterIMInstantiateCallback(x11_display, NULL, NULL, NULL,
|
||||||
xim_instantiate_cb, NULL);
|
xim_instantiate_cb, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
void
|
void
|
||||||
xim_init(void)
|
xim_init(void)
|
||||||
@@ -6088,9 +6100,9 @@ xim_init(void)
|
|||||||
Window x11_window;
|
Window x11_window;
|
||||||
Display *x11_display;
|
Display *x11_display;
|
||||||
|
|
||||||
#ifdef XIM_DEBUG
|
# ifdef XIM_DEBUG
|
||||||
xim_log("xim_init()\n");
|
xim_log("xim_init()\n");
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
gui_get_x11_windis(&x11_window, &x11_display);
|
gui_get_x11_windis(&x11_window, &x11_display);
|
||||||
|
|
||||||
@@ -6101,10 +6113,10 @@ xim_init(void)
|
|||||||
|
|
||||||
gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH);
|
gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH);
|
||||||
|
|
||||||
#ifdef USE_X11R6_XIM
|
# ifdef USE_X11R6_XIM
|
||||||
XRegisterIMInstantiateCallback(x11_display, NULL, NULL, NULL,
|
XRegisterIMInstantiateCallback(x11_display, NULL, NULL, NULL,
|
||||||
xim_instantiate_cb, NULL);
|
xim_instantiate_cb, NULL);
|
||||||
#endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -6116,7 +6128,7 @@ xim_real_init(Window x11_window, Display *x11_display)
|
|||||||
*ns,
|
*ns,
|
||||||
*end,
|
*end,
|
||||||
tmp[1024];
|
tmp[1024];
|
||||||
#define IMLEN_MAX 40
|
# define IMLEN_MAX 40
|
||||||
char buf[IMLEN_MAX + 7];
|
char buf[IMLEN_MAX + 7];
|
||||||
XIM xim = NULL;
|
XIM xim = NULL;
|
||||||
XIMStyles *xim_styles;
|
XIMStyles *xim_styles;
|
||||||
@@ -6181,7 +6193,7 @@ xim_real_init(Window x11_window, Display *x11_display)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_X11R6_XIM
|
# ifdef USE_X11R6_XIM
|
||||||
{
|
{
|
||||||
XIMCallback destroy_cb;
|
XIMCallback destroy_cb;
|
||||||
|
|
||||||
@@ -6190,7 +6202,7 @@ xim_real_init(Window x11_window, Display *x11_display)
|
|||||||
if (XSetIMValues(xim, XNDestroyCallback, &destroy_cb, NULL))
|
if (XSetIMValues(xim, XNDestroyCallback, &destroy_cb, NULL))
|
||||||
EMSG(_("E287: Warning: Could not set destroy callback to IM"));
|
EMSG(_("E287: Warning: Could not set destroy callback to IM"));
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles)
|
if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles)
|
||||||
{
|
{
|
||||||
@@ -6266,7 +6278,7 @@ xim_real_init(Window x11_window, Display *x11_display)
|
|||||||
|
|
||||||
/* A crash was reported when trying to pass gui.norm_font as XNFontSet,
|
/* A crash was reported when trying to pass gui.norm_font as XNFontSet,
|
||||||
* thus that has been removed. Hopefully the default works... */
|
* thus that has been removed. Hopefully the default works... */
|
||||||
#ifdef FEAT_XFONTSET
|
# ifdef FEAT_XFONTSET
|
||||||
if (gui.fontset != NOFONTSET)
|
if (gui.fontset != NOFONTSET)
|
||||||
{
|
{
|
||||||
preedit_list = XVaCreateNestedList(0,
|
preedit_list = XVaCreateNestedList(0,
|
||||||
@@ -6282,7 +6294,7 @@ xim_real_init(Window x11_window, Display *x11_display)
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
# endif
|
||||||
{
|
{
|
||||||
preedit_list = XVaCreateNestedList(0,
|
preedit_list = XVaCreateNestedList(0,
|
||||||
XNSpotLocation, &over_spot,
|
XNSpotLocation, &over_spot,
|
||||||
@@ -6324,7 +6336,7 @@ xim_real_init(Window x11_window, Display *x11_display)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FEAT_GUI_X11 */
|
# endif /* FEAT_GUI_X11 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get IM status. When IM is on, return TRUE. Else return FALSE.
|
* Get IM status. When IM is on, return TRUE. Else return FALSE.
|
||||||
@@ -6335,6 +6347,10 @@ xim_real_init(Window x11_window, Display *x11_display)
|
|||||||
int
|
int
|
||||||
im_get_status(void)
|
im_get_status(void)
|
||||||
{
|
{
|
||||||
|
# ifdef FEAT_EVAL
|
||||||
|
if (p_imsf[0] != NUL)
|
||||||
|
return call_imstatusfunc();
|
||||||
|
# endif
|
||||||
return xim_has_focus;
|
return xim_has_focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6458,38 +6474,29 @@ xim_get_status_area_height(void)
|
|||||||
#else /* !defined(FEAT_XIM) */
|
#else /* !defined(FEAT_XIM) */
|
||||||
|
|
||||||
# ifndef FEAT_GUI_W32
|
# ifndef FEAT_GUI_W32
|
||||||
|
static int im_was_set_active = FALSE;
|
||||||
|
|
||||||
int
|
int
|
||||||
im_get_status()
|
im_get_status()
|
||||||
{
|
{
|
||||||
# ifdef FEAT_EVAL
|
# ifdef FEAT_EVAL
|
||||||
if (p_imsf[0] != NUL)
|
if (p_imsf[0] != NUL)
|
||||||
{
|
return call_imstatusfunc();
|
||||||
int is_active;
|
|
||||||
|
|
||||||
/* FIXME: Don't execute user function in unsafe situation. */
|
|
||||||
if (exiting
|
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
|| is_autocmd_blocked()
|
|
||||||
# endif
|
# endif
|
||||||
)
|
return im_was_set_active;
|
||||||
return FALSE;
|
|
||||||
/* FIXME: :py print 'xxx' is shown duplicate result.
|
|
||||||
* Use silent to avoid it. */
|
|
||||||
++msg_silent;
|
|
||||||
is_active = call_func_retnr(p_imsf, 0, NULL, FALSE);
|
|
||||||
--msg_silent;
|
|
||||||
return (is_active > 0);
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
im_set_active(int active)
|
im_set_active(int active_arg)
|
||||||
{
|
{
|
||||||
# if defined(USE_IM_CONTROL) && defined(FEAT_EVAL)
|
# if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
|
||||||
if (p_imaf[0] != NUL)
|
int active = !p_imdisable && active_arg;
|
||||||
call_imactivatefunc(p_imdisable ? FALSE : active);
|
|
||||||
|
if (p_imaf[0] != NUL && active != im_get_status())
|
||||||
|
{
|
||||||
|
call_imactivatefunc(active);
|
||||||
|
im_was_set_active = active;
|
||||||
|
}
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
@@ -892,7 +892,7 @@ getcount:
|
|||||||
int lit = FALSE; /* get extra character literally */
|
int lit = FALSE; /* get extra character literally */
|
||||||
int langmap_active = FALSE; /* using :lmap mappings */
|
int langmap_active = FALSE; /* using :lmap mappings */
|
||||||
int lang; /* getting a text character */
|
int lang; /* getting a text character */
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
int save_smd; /* saved value of p_smd */
|
int save_smd; /* saved value of p_smd */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -957,7 +957,7 @@ getcount:
|
|||||||
State = LANGMAP;
|
State = LANGMAP;
|
||||||
langmap_active = TRUE;
|
langmap_active = TRUE;
|
||||||
}
|
}
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
save_smd = p_smd;
|
save_smd = p_smd;
|
||||||
p_smd = FALSE; /* Don't let the IM code show the mode here */
|
p_smd = FALSE; /* Don't let the IM code show the mode here */
|
||||||
if (lang && curbuf->b_p_iminsert == B_IMODE_IM)
|
if (lang && curbuf->b_p_iminsert == B_IMODE_IM)
|
||||||
@@ -973,7 +973,7 @@ getcount:
|
|||||||
++allow_keys;
|
++allow_keys;
|
||||||
State = NORMAL_BUSY;
|
State = NORMAL_BUSY;
|
||||||
}
|
}
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
if (lang)
|
if (lang)
|
||||||
{
|
{
|
||||||
if (curbuf->b_p_iminsert != B_IMODE_LMAP)
|
if (curbuf->b_p_iminsert != B_IMODE_LMAP)
|
||||||
|
|||||||
10
src/option.c
10
src/option.c
@@ -1539,7 +1539,7 @@ static struct vimoption options[] =
|
|||||||
(char_u *)&p_ic, PV_NONE,
|
(char_u *)&p_ic, PV_NONE,
|
||||||
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
|
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
|
||||||
{"imactivatefunc","imaf",P_STRING|P_VI_DEF|P_SECURE,
|
{"imactivatefunc","imaf",P_STRING|P_VI_DEF|P_SECURE,
|
||||||
#if defined(FEAT_EVAL) && defined(USE_IM_CONTROL)
|
#if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
|
||||||
(char_u *)&p_imaf, PV_NONE,
|
(char_u *)&p_imaf, PV_NONE,
|
||||||
{(char_u *)"", (char_u *)NULL}
|
{(char_u *)"", (char_u *)NULL}
|
||||||
# else
|
# else
|
||||||
@@ -1555,14 +1555,14 @@ static struct vimoption options[] =
|
|||||||
#endif
|
#endif
|
||||||
{(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
|
{(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
|
||||||
{"imcmdline", "imc", P_BOOL|P_VI_DEF,
|
{"imcmdline", "imc", P_BOOL|P_VI_DEF,
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
(char_u *)&p_imcmdline, PV_NONE,
|
(char_u *)&p_imcmdline, PV_NONE,
|
||||||
#else
|
#else
|
||||||
(char_u *)NULL, PV_NONE,
|
(char_u *)NULL, PV_NONE,
|
||||||
#endif
|
#endif
|
||||||
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
|
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
|
||||||
{"imdisable", "imd", P_BOOL|P_VI_DEF,
|
{"imdisable", "imd", P_BOOL|P_VI_DEF,
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
(char_u *)&p_imdisable, PV_NONE,
|
(char_u *)&p_imdisable, PV_NONE,
|
||||||
#else
|
#else
|
||||||
(char_u *)NULL, PV_NONE,
|
(char_u *)NULL, PV_NONE,
|
||||||
@@ -1582,7 +1582,7 @@ static struct vimoption options[] =
|
|||||||
{(char_u *)B_IMODE_USE_INSERT, (char_u *)0L}
|
{(char_u *)B_IMODE_USE_INSERT, (char_u *)0L}
|
||||||
SCRIPTID_INIT},
|
SCRIPTID_INIT},
|
||||||
{"imstatusfunc","imsf",P_STRING|P_VI_DEF|P_SECURE,
|
{"imstatusfunc","imsf",P_STRING|P_VI_DEF|P_SECURE,
|
||||||
#if defined(FEAT_EVAL) && defined(USE_IM_CONTROL)
|
#if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
|
||||||
(char_u *)&p_imsf, PV_NONE,
|
(char_u *)&p_imsf, PV_NONE,
|
||||||
{(char_u *)"", (char_u *)NULL}
|
{(char_u *)"", (char_u *)NULL}
|
||||||
#else
|
#else
|
||||||
@@ -8469,7 +8469,7 @@ set_bool_option(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
/* 'imdisable' */
|
/* 'imdisable' */
|
||||||
else if ((int *)varp == &p_imdisable)
|
else if ((int *)varp == &p_imdisable)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -585,11 +585,11 @@ EXTERN char_u *p_imak; /* 'imactivatekey' */
|
|||||||
#define IM_OVER_THE_SPOT 1L
|
#define IM_OVER_THE_SPOT 1L
|
||||||
EXTERN long p_imst; /* 'imstyle' */
|
EXTERN long p_imst; /* 'imstyle' */
|
||||||
#endif
|
#endif
|
||||||
#if defined(FEAT_EVAL) && defined(USE_IM_CONTROL)
|
#if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
|
||||||
EXTERN char_u *p_imaf; /* 'imactivatefunc' */
|
EXTERN char_u *p_imaf; /* 'imactivatefunc' */
|
||||||
EXTERN char_u *p_imsf; /* 'imstatusfunc' */
|
EXTERN char_u *p_imsf; /* 'imstatusfunc' */
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_IM_CONTROL
|
#ifdef FEAT_MBYTE
|
||||||
EXTERN int p_imcmdline; /* 'imcmdline' */
|
EXTERN int p_imcmdline; /* 'imcmdline' */
|
||||||
EXTERN int p_imdisable; /* 'imdisable' */
|
EXTERN int p_imdisable; /* 'imdisable' */
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
2
src/ui.c
2
src/ui.c
@@ -3307,7 +3307,7 @@ ui_focus_change(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_IM_CONTROL) || defined(PROTO)
|
#if defined(FEAT_MBYTE) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
* Save current Input Method status to specified place.
|
* Save current Input Method status to specified place.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -771,6 +771,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1338,
|
||||||
/**/
|
/**/
|
||||||
1337,
|
1337,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
@@ -533,13 +533,6 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Check input method control.
|
|
||||||
*/
|
|
||||||
#if defined(FEAT_MBYTE)
|
|
||||||
# define USE_IM_CONTROL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For dynamically loaded gettext library. Currently, only for Win32.
|
* For dynamically loaded gettext library. Currently, only for Win32.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user