mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-13 08:01:33 +01:00
add fnav resource for password dialog, and use it if device has fiveway.
Otherwise use FrmSetFocus. This works around a bug where key event that leaks through from parent dialog dismisses dialog (whereupon another comes up, and eventually cursor is left flashing on parent.)
This commit is contained in:
parent
4aa1f8188b
commit
47c3b0f7bd
4 changed files with 44 additions and 32 deletions
|
@ -187,6 +187,14 @@ NAVIGATIONMAP
|
|||
XW_MAIN_TRADE_BUTTON_ID
|
||||
XW_MAIN_DONE_BUTTON_ID
|
||||
END
|
||||
|
||||
NAVIGATION ID XW_PASSWORD_DIALOG_ID
|
||||
INITIALSTATE kFrmNavHeaderFlagsObjectFocusStartState
|
||||
INITIALOBJECTID XW_PASSWORD_PASS_FIELD
|
||||
NAVIGATIONMAP
|
||||
ROW XW_PASSWORD_PASS_FIELD
|
||||
ROW XW_PASSWORD_OK_BUTTON XW_PASSWORD_CANCEL_BUTTON
|
||||
END
|
||||
#endif
|
||||
|
||||
STRING ID 1000 "/palm/programs/Crosswords/"
|
||||
|
|
|
@ -429,7 +429,7 @@ handlePasswordTrigger( PalmAppGlobals* globals, UInt16 controlID )
|
|||
name = (XP_UCHAR*)FldGetTextPtr( nameField );
|
||||
|
||||
len = sizeof(state->passwds[playerNum]);
|
||||
if ( askPassword( name, true, state->passwds[playerNum], &len )) {
|
||||
if ( askPassword( globals, name, true, state->passwds[playerNum], &len )) {
|
||||
showMaskedPwd( controlID, len > 0 );
|
||||
}
|
||||
} /* handlePasswordTrigger */
|
||||
|
|
|
@ -145,7 +145,7 @@ static XP_Bool palm_util_getTraySearchLimits( XW_UtilCtxt* uc, XP_U16* min,
|
|||
XP_U16* max );
|
||||
#endif
|
||||
static void userErrorFromStrId( PalmAppGlobals* globals, XP_U16 strID );
|
||||
static Boolean askFromStream( PalmAppGlobals* globals, XWStreamCtxt* stream,
|
||||
static XP_Bool askFromStream( PalmAppGlobals* globals, XWStreamCtxt* stream,
|
||||
XP_S16 titleID, Boolean closeAndDestroy );
|
||||
static void displayFinalScores( PalmAppGlobals* globals );
|
||||
static void updateScrollbar( PalmAppGlobals* globals, Int16 newValue );
|
||||
|
@ -2025,7 +2025,7 @@ askOnClose( XWStreamCtxt* stream, void* closure )
|
|||
{
|
||||
PalmAppGlobals* globals = (PalmAppGlobals*)closure;
|
||||
|
||||
askFromStream( globals, stream, -1, false );
|
||||
(void)askFromStream( globals, stream, -1, false );
|
||||
} /* askOnClose */
|
||||
#endif
|
||||
|
||||
|
@ -2655,7 +2655,7 @@ mainViewHandleEvent( EventPtr event )
|
|||
server_formatDictCounts( globals->game.server, stream,
|
||||
4 ); /* 4: ncols */
|
||||
|
||||
askFromStream( globals, stream, STR_VALUES_TITLE, true );
|
||||
(void)askFromStream( globals, stream, STR_VALUES_TITLE, true );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2663,7 +2663,7 @@ mainViewHandleEvent( EventPtr event )
|
|||
if ( !!globals->game.board ) {
|
||||
stream = makeSimpleStream( globals, NULL );
|
||||
board_formatRemainingTiles( globals->game.board, stream );
|
||||
askFromStream( globals, stream, STR_REMAINS_TITLE, true );
|
||||
(void)askFromStream( globals, stream, STR_REMAINS_TITLE, true );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2675,8 +2675,8 @@ mainViewHandleEvent( EventPtr event )
|
|||
model_writeGameHistory( globals->game.model, stream,
|
||||
globals->game.server, gameOver );
|
||||
if ( stream_getSize( stream ) > 0 ) {
|
||||
askFromStream( globals, stream, STR_HISTORY_TITLE,
|
||||
XP_FALSE );
|
||||
(void)askFromStream( globals, stream, STR_HISTORY_TITLE,
|
||||
XP_FALSE );
|
||||
} else {
|
||||
beep();
|
||||
}
|
||||
|
@ -2988,7 +2988,7 @@ displayFinalScores( PalmAppGlobals* globals )
|
|||
server_writeFinalScores( globals->game.server, stream );
|
||||
stream_putU8( stream, '\0' );
|
||||
|
||||
askFromStream( globals, stream, STR_FINAL_SCORES_TITLE, true );
|
||||
(void)askFromStream( globals, stream, STR_FINAL_SCORES_TITLE, true );
|
||||
} /* displayFinalScores */
|
||||
|
||||
XP_S16
|
||||
|
@ -3220,7 +3220,7 @@ moveLeftOf( UInt16 rightID, UInt16 leftID )
|
|||
|
||||
} /* moveLeftOf */
|
||||
|
||||
Boolean
|
||||
XP_Bool
|
||||
palmaskFromStrId( PalmAppGlobals* globals, XP_U16 strId, XP_S16 titleID )
|
||||
{
|
||||
const XP_UCHAR* message;
|
||||
|
@ -3231,9 +3231,9 @@ palmaskFromStrId( PalmAppGlobals* globals, XP_U16 strId, XP_S16 titleID )
|
|||
return palmask( globals, message, yes, titleID );
|
||||
} /* palmaskFromStrId */
|
||||
|
||||
Boolean
|
||||
palmask( PalmAppGlobals* globals, const XP_UCHAR* str, const XP_UCHAR* yesButton,
|
||||
XP_S16 titleID )
|
||||
XP_Bool
|
||||
palmask( PalmAppGlobals* globals, const XP_UCHAR* str,
|
||||
const XP_UCHAR* yesButton, XP_S16 titleID )
|
||||
{
|
||||
FormPtr form, prevForm;
|
||||
FieldPtr field;
|
||||
|
@ -3305,12 +3305,12 @@ palmask( PalmAppGlobals* globals, const XP_UCHAR* str, const XP_UCHAR* yesButton
|
|||
return buttonHit == XW_ASK_YES_BUTTON_ID;
|
||||
} /* palmask */
|
||||
|
||||
static Boolean
|
||||
static XP_Bool
|
||||
askFromStream( PalmAppGlobals* globals, XWStreamCtxt* stream, XP_S16 titleID,
|
||||
Boolean closeAndDestroy )
|
||||
{
|
||||
XP_U16 nBytes = stream_getSize( stream );
|
||||
Boolean result;
|
||||
XP_Bool result;
|
||||
XP_UCHAR* buffer;
|
||||
|
||||
XP_ASSERT( nBytes < maxFieldTextLen );
|
||||
|
@ -3335,11 +3335,11 @@ askFromStream( PalmAppGlobals* globals, XWStreamCtxt* stream, XP_S16 titleID,
|
|||
return result;
|
||||
} /* askFromStream */
|
||||
|
||||
Boolean
|
||||
askPassword( const XP_UCHAR* name, Boolean isNew, XP_UCHAR* retbuf,
|
||||
XP_U16* len )
|
||||
XP_Bool
|
||||
askPassword( PalmAppGlobals* globals, const XP_UCHAR* name, XP_Bool isNew,
|
||||
XP_UCHAR* retbuf, XP_U16* len )
|
||||
{
|
||||
Boolean result = false;
|
||||
XP_Bool result = XP_FALSE;
|
||||
FormPtr prevForm, form;
|
||||
FieldPtr field;
|
||||
UInt16 showMe;
|
||||
|
@ -3362,16 +3362,19 @@ askPassword( const XP_UCHAR* name, Boolean isNew, XP_UCHAR* retbuf,
|
|||
FldSetTextPtr( field, (char*)name );
|
||||
FldDrawField( field );
|
||||
}
|
||||
#ifdef XWFEATURE_FIVEWAY
|
||||
setFormFocus( form, XW_PASSWORD_PASS_FIELD );
|
||||
#endif
|
||||
field = getActiveObjectPtr( XW_PASSWORD_PASS_FIELD );
|
||||
|
||||
if ( !globals->hasTreoFiveWay ) {
|
||||
FrmSetFocus( form, FrmGetObjectIndex( form, XW_PASSWORD_PASS_FIELD ) );
|
||||
}
|
||||
|
||||
if ( FrmDoDialog( form ) == XW_PASSWORD_OK_BUTTON ) {
|
||||
char* enteredPass = FldGetTextPtr( field );
|
||||
XP_U16 enteredLen = !enteredPass? 0: StrLen(enteredPass);
|
||||
char* enteredPass;
|
||||
XP_U16 enteredLen;
|
||||
field = getActiveObjectPtr( XW_PASSWORD_PASS_FIELD );
|
||||
enteredPass = FldGetTextPtr( field );
|
||||
enteredLen = enteredPass? StrLen(enteredPass) : 0;
|
||||
if ( enteredLen < *len ) {
|
||||
result = true;
|
||||
result = XP_TRUE;
|
||||
if ( enteredLen > 0 ) {
|
||||
XP_MEMCPY( retbuf, enteredPass, enteredLen );
|
||||
}
|
||||
|
@ -3684,10 +3687,11 @@ palm_util_userPickTile( XW_UtilCtxt* uc, const PickInfo* pi,
|
|||
} /* palm_util_userPickTile */
|
||||
|
||||
static XP_Bool
|
||||
palm_util_askPassword( XW_UtilCtxt* XP_UNUSED(uc), const XP_UCHAR* name, XP_UCHAR* buf,
|
||||
XP_U16* len )
|
||||
palm_util_askPassword( XW_UtilCtxt* uc, const XP_UCHAR* name,
|
||||
XP_UCHAR* buf, XP_U16* len )
|
||||
{
|
||||
return askPassword( name, false, buf, len );
|
||||
PalmAppGlobals* globals = (PalmAppGlobals*)uc->closure;
|
||||
return askPassword( globals, name, false, buf, len );
|
||||
} /* palm_util_askPassword */
|
||||
|
||||
static void
|
||||
|
|
|
@ -412,9 +412,9 @@ void palm_drawctxt_destroy( DrawCtx* dctx );
|
|||
|
||||
void palm_warnf( char* format, ... );
|
||||
|
||||
Boolean askPassword( const XP_UCHAR* name, Boolean isNew, XP_UCHAR* retbuf,
|
||||
XP_U16* len );
|
||||
Boolean palmaskFromStrId( PalmAppGlobals* globals, XP_U16 strId,
|
||||
XP_Bool askPassword( PalmAppGlobals* globals, const XP_UCHAR* name,
|
||||
XP_Bool isNew, XP_UCHAR* retbuf, XP_U16* len );
|
||||
XP_Bool palmaskFromStrId( PalmAppGlobals* globals, XP_U16 strId,
|
||||
XP_S16 titleID );
|
||||
void freeSavedGamesData( MPFORMAL SavedGamesState* state );
|
||||
|
||||
|
@ -422,7 +422,7 @@ void writeNameToGameRecord( PalmAppGlobals* globals, XP_S16 index,
|
|||
char* newName, XP_U16 len );
|
||||
|
||||
const XP_UCHAR* getResString( PalmAppGlobals* globals, XP_U16 strID );
|
||||
Boolean palmask( PalmAppGlobals* globals, const XP_UCHAR* str,
|
||||
XP_Bool palmask( PalmAppGlobals* globals, const XP_UCHAR* str,
|
||||
const XP_UCHAR* altButton, XP_S16 titleID );
|
||||
void checkAndDeliver( PalmAppGlobals* globals, const CommsAddrRec* addr,
|
||||
XWStreamCtxt* instream );
|
||||
|
|
Loading…
Reference in a new issue