From 09100dcb2cd47c264411ff57069f2fdc879d95e1 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Thu, 28 Apr 2011 18:41:39 -0700 Subject: [PATCH] track lang code of last dict sent and don't send repeats. --- xwords4/android/XWords4/jni/drawwrapper.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/xwords4/android/XWords4/jni/drawwrapper.c b/xwords4/android/XWords4/jni/drawwrapper.c index b3bdc566b..c80b7d95a 100644 --- a/xwords4/android/XWords4/jni/drawwrapper.c +++ b/xwords4/android/XWords4/jni/drawwrapper.c @@ -32,6 +32,7 @@ typedef struct _AndDraw { DrawCtxVTable* vtable; JNIEnv** env; jobject jdraw; /* global ref; free it! */ + XP_LangCode curLang; jobject jCache[JCACHE_COUNT]; XP_UCHAR miniTextBuf[128]; MPSLOT @@ -385,12 +386,16 @@ static void and_draw_dictChanged( DrawCtx* dctx, XP_S16 playerNum, const DictionaryCtxt* dict ) { - /* We'll always have a dict for the game itself ( playerNum==-1) and it'll - have the same lang as the others so it's the only one that needs to - make it through. */ - if ( playerNum < 0 ) { - AndDraw* draw = (AndDraw*)dctx; - if ( NULL != draw->jdraw ) { + AndDraw* draw = (AndDraw*)dctx; + if ( NULL != draw->jdraw ) { + XP_LangCode code = 0; /* A null dict means no-lang */ + if ( NULL != dict ) { + code = dict_getLangCode( dict ); + } + /* Don't bother sending repeats. */ + if ( code != draw->curLang ) { + draw->curLang = code; + DRAW_CBK_HEADER( "dictChanged", "(II)V" ); (*env)->CallVoidMethod( env, draw->jdraw, mid, playerNum, (jint)dict );