MText *mt = NULL;
mplist_push (ic->plist, Minteger, (void *) len);
- if (minput__callback (ic, Minput_get_surrounding_text) >= 0
+ if (minput_callback (ic, Minput_get_surrounding_text) >= 0
&& MPLIST_MTEXT_P (ic->plist))
mt = MPLIST_MTEXT (ic->plist);
mplist_pop (ic->plist);
MInputContextInfo *ic_info = (MInputContextInfo *) ic->info;
mplist_push (ic->plist, Minteger, (void *) pos);
- minput__callback (ic, Minput_delete_surrounding_text);
+ minput_callback (ic, Minput_delete_surrounding_text);
mplist_pop (ic->plist);
if (pos < 0)
{
{
M17N_OBJECT_UNREF (ic->candidate_list);
ic->candidate_list = NULL;
+ ic->candidate_index = 0;
+ ic->candidate_from = ic->candidate_to = 0;
ic->candidates_changed = MINPUT_CANDIDATES_LIST_CHANGED;
if (ic->candidate_show)
{
}
/* Perform list of actions in ACTION_LIST for the current input
- context IC. If all actions are performed without error, return 0.
+ context IC. If unhandle action was not performed, return 0.
Otherwise, return -1. */
static int
}
-int
-minput__callback (MInputContext *ic, MSymbol command)
-{
- MInputCallbackFunc func;
-
- if (! ic->im->driver.callback_list)
- return -1;
- func = (MInputCallbackFunc) mplist_get (ic->im->driver.callback_list,
- command);
- if (! func)
- return -1;
- (func) (ic, command);
- return 0;
-}
-
MSymbol
minput__char_to_key (int c)
{
it specifies the number of characters following the current cursor
position. If the value is negative, the absolute value specifies
the number of characters preceding the current cursor position.
+ If the value is zero, it means that the caller just wants to know
+ if the surrounding text is currently supported or not.
If the surrounding text is currently supported, the callback
function must set the key of this element to #Mtext and the value
¤Æ#Minteger ¤ò¤È¤ê¡¢¤½¤ÎÃͤϥµ¥é¥¦¥ó¥Ç¥£¥ó¥°¥Æ¥¥¹¥È¤Î¤¦¤Á¤É¤ÎÉôʬ
¤ò¼è¤Ã¤ÆÍè¤ë¤«¤ò»ØÄꤹ¤ë¡£Ãͤ¬Àµ¤Ç¤¢¤ì¤Ð¡¢¸½ºß¤Î¥«¡¼¥½¥ë°ÌÃ֤˳¤¯
ÃͤθĿôʬ¤Îʸ»ú¤ò¼è¤ë¡£Éé¤Ç¤¢¤ì¤Ð¡¢¥«¡¼¥½¥ë°ÌÃÖ¤ËÀè¹Ô¤¹¤ëÃͤÎÀäÂÐ
- ÃÍʬ¤Îʸ»ú¤ò¼è¤ë¡£
+ ÃÍʬ¤Îʸ»ú¤ò¼è¤ë¡£¸½ºß¥µ¥é¥¦¥ó¥É¥Æ¥¥¹¥È¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦
+ ¤«¤òÃΤꤿ¤¤¤À¤±¤Ç¤¢¤ì¤Ð¡¢¤³¤ÎÃͤϥ¼¥í¤Ç¤âÎɤ¤¡£
¥µ¥é¥¦¥ó¥Ç¥£¥ó¥°¥Æ¥¥¹¥È¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ì¤Ð¡¢¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Ï
¤³¤ÎÍ×ÁǤΥ¡¼¤ò #Mtext ¤Ë¡¢Ãͤò¼è¤ê¹þ¤ó¤ÀM-text ¤ËÀßÄꤷ¤Ê¤¯¤Æ¤Ï¤Ê
¥·¥ç¥ó¦¤ÇɬÍפǸúΨŪ¤À¤È»×¤¨¤ÐŤ¯¤Æ¤âÎɤ¤¡£
¥µ¥é¥¦¥ó¥Ç¥£¥ó¥°¥Æ¥¥¹¥È¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢¥³¡¼¥ë¥Ð¥Ã¥¯´Ø
- ¿ô¤Ï #MInputContext::plist ¤ÎÂè°ìÍ×ÁǤòÊѲ½¤µ¤»¤ë¤³¤È¤Ê¤¯ÊÖ¤µ¤Ê¤¯¤Æ
- ¤Ï¤Ê¤é¤Ê¤¤¡£
+ ¿ô¤Ï #MInputContext::plist ¤ÎÂè°ìÍ×ÁǤòÊѹ¹¤·¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
Minput_delete_surrounding_text: ¤³¤Î¥³¥Þ¥ó¥É¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿¥³¡¼¥ë
¥Ð¥Ã¥¯´Ø¿ô¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¤Ï¡¢#MInputContext::plist ¤ÎÂè°ìÍ×ÁǤϡ¢¥¡¼
if (im->driver.callback_list)
{
- minput__callback (ic, Minput_preedit_start);
- minput__callback (ic, Minput_status_start);
- minput__callback (ic, Minput_status_draw);
+ minput_callback (ic, Minput_preedit_start);
+ minput_callback (ic, Minput_status_start);
+ minput_callback (ic, Minput_status_draw);
}
MDEBUG_PRINT (" ok\n");
msymbol_name (ic->im->name), msymbol_name (ic->im->language));
if (ic->im->driver.callback_list)
{
- minput__callback (ic, Minput_preedit_done);
- minput__callback (ic, Minput_status_done);
- minput__callback (ic, Minput_candidates_done);
+ minput_callback (ic, Minput_preedit_done);
+ minput_callback (ic, Minput_status_done);
+ minput_callback (ic, Minput_candidates_done);
}
(*ic->im->driver.destroy_ic) (ic);
M17N_OBJECT_UNREF (ic->preedit);
if (! ic
|| ! ic->active)
return 0;
+ if (ic->im->driver.callback_list
+ && mtext_nchars (ic->preedit) > 0)
+ minput_callback (ic, Minput_preedit_draw);
+
ret = (*ic->im->driver.filter) (ic, key, arg);
if (ic->im->driver.callback_list)
{
if (ic->preedit_changed)
- minput__callback (ic, Minput_preedit_draw);
+ minput_callback (ic, Minput_preedit_draw);
if (ic->status_changed)
- minput__callback (ic, Minput_status_draw);
+ minput_callback (ic, Minput_status_draw);
if (ic->candidates_changed)
- minput__callback (ic, Minput_candidates_draw);
+ minput_callback (ic, Minput_candidates_draw);
}
return ret;
ic->spot.mt = mt;
ic->spot.pos = pos;
if (ic->im->driver.callback_list)
- minput__callback (ic, Minput_set_spot);
+ minput_callback (ic, Minput_set_spot);
}
/*=*/
minput_toggle (MInputContext *ic)
{
if (ic->im->driver.callback_list)
- minput__callback (ic, Minput_toggle);
+ minput_callback (ic, Minput_toggle);
ic->active = ! ic->active;
}
minput_reset_ic (MInputContext *ic)
{
if (ic->im->driver.callback_list)
- minput__callback (ic, Minput_reset);
+ minput_callback (ic, Minput_reset);
}
/*=*/
return ret;
}
+/*=*/
+
+/***en
+ @brief Call a callback function
+
+ The minput_callback () functions calls a callback function
+ $COMMAND assigned for the input context $IC. The caller must set
+ specific elements in $IC->plist if the callback function requires.
+
+ @return
+ If there exists a specified callback function, 0 is returned.
+ Otherwise -1 is returned. By side effects, $IC->plist may be
+ modified. */
+
+int
+minput_callback (MInputContext *ic, MSymbol command)
+{
+ MInputCallbackFunc func;
+
+ if (! ic->im->driver.callback_list)
+ return -1;
+ func = (MInputCallbackFunc) mplist_get (ic->im->driver.callback_list,
+ command);
+ if (! func)
+ return -1;
+ (func) (ic, command);
+ return 0;
+}
+
/*** @} */
/*** @} */
/*=*/