mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
track lang code of last dict sent and don't send repeats.
This commit is contained in:
parent
3b3a822dcc
commit
09100dcb2c
1 changed files with 11 additions and 6 deletions
|
@ -32,6 +32,7 @@ typedef struct _AndDraw {
|
||||||
DrawCtxVTable* vtable;
|
DrawCtxVTable* vtable;
|
||||||
JNIEnv** env;
|
JNIEnv** env;
|
||||||
jobject jdraw; /* global ref; free it! */
|
jobject jdraw; /* global ref; free it! */
|
||||||
|
XP_LangCode curLang;
|
||||||
jobject jCache[JCACHE_COUNT];
|
jobject jCache[JCACHE_COUNT];
|
||||||
XP_UCHAR miniTextBuf[128];
|
XP_UCHAR miniTextBuf[128];
|
||||||
MPSLOT
|
MPSLOT
|
||||||
|
@ -385,12 +386,16 @@ static void
|
||||||
and_draw_dictChanged( DrawCtx* dctx, XP_S16 playerNum,
|
and_draw_dictChanged( DrawCtx* dctx, XP_S16 playerNum,
|
||||||
const DictionaryCtxt* dict )
|
const DictionaryCtxt* dict )
|
||||||
{
|
{
|
||||||
/* We'll always have a dict for the game itself ( playerNum==-1) and it'll
|
AndDraw* draw = (AndDraw*)dctx;
|
||||||
have the same lang as the others so it's the only one that needs to
|
if ( NULL != draw->jdraw ) {
|
||||||
make it through. */
|
XP_LangCode code = 0; /* A null dict means no-lang */
|
||||||
if ( playerNum < 0 ) {
|
if ( NULL != dict ) {
|
||||||
AndDraw* draw = (AndDraw*)dctx;
|
code = dict_getLangCode( dict );
|
||||||
if ( NULL != draw->jdraw ) {
|
}
|
||||||
|
/* Don't bother sending repeats. */
|
||||||
|
if ( code != draw->curLang ) {
|
||||||
|
draw->curLang = code;
|
||||||
|
|
||||||
DRAW_CBK_HEADER( "dictChanged", "(II)V" );
|
DRAW_CBK_HEADER( "dictChanged", "(II)V" );
|
||||||
(*env)->CallVoidMethod( env, draw->jdraw, mid, playerNum,
|
(*env)->CallVoidMethod( env, draw->jdraw, mid, playerNum,
|
||||||
(jint)dict );
|
(jint)dict );
|
||||||
|
|
Loading…
Reference in a new issue