mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
Fix crash on restart when app had been exited with some form other
than main on top. focusOwner was saved based on front form but on startup I tried to set it in the main form. This will need to be merged into a branch based on the 4.2.1 release for a 4.2.1.
This commit is contained in:
parent
693eeb6863
commit
c72d0fec65
3 changed files with 34 additions and 15 deletions
|
@ -466,7 +466,8 @@ positionBoard( PalmAppGlobals* globals )
|
|||
PALM_GRIDLESS_SCORE_LEFT+2) * doubler;
|
||||
|
||||
bounds.extent.x = (RECOMMENDED_SBAR_WIDTH + 2) * doubler;
|
||||
bounds.extent.y = (PALM_GRIDLESS_SCORE_TOP - bounds.topLeft.y - 2) * doubler;
|
||||
bounds.extent.y = (PALM_GRIDLESS_SCORE_TOP - bounds.topLeft.y - 2)
|
||||
* doubler;
|
||||
}
|
||||
globals->progress.boundsRect = bounds;
|
||||
#endif
|
||||
|
@ -1887,11 +1888,13 @@ drawFormButtons( PalmAppGlobals* globals )
|
|||
if ( globals->hasTreoFiveWay ) {
|
||||
focusItem = globals->gState.focusItem;
|
||||
if ( focusItem > 0 ) {
|
||||
/* XP_WARNF( "setting focus: %s", frmObjId_2str(focusItem) ); */
|
||||
setFormFocus( globals->mainForm, focusItem );
|
||||
if ( !isBoardObject( focusItem )
|
||||
&& buttonIsUsable( getActiveObjectPtr(focusItem) ) ) {
|
||||
drawFocusRingOnGadget( globals, focusItem, focusItem );
|
||||
if ( isFormObject( globals->mainForm, focusItem ) ) {
|
||||
/* XP_WARNF( "setting focus: %s", frmObjId_2str(focusItem) ); */
|
||||
setFormFocus( globals->mainForm, focusItem );
|
||||
if ( !isBoardObject( focusItem )
|
||||
&& buttonIsUsable( getActiveObjectPtr(focusItem) ) ) {
|
||||
drawFocusRingOnGadget( globals, focusItem, focusItem );
|
||||
}
|
||||
}
|
||||
globals->gState.focusItem = -1;
|
||||
} else {
|
||||
|
|
|
@ -55,9 +55,10 @@ MemPtr
|
|||
getActiveObjectPtr( UInt16 objectID )
|
||||
{
|
||||
FormPtr form = FrmGetActiveForm();
|
||||
XP_ASSERT( FrmGetObjectPtr(
|
||||
form, FrmGetObjectIndex( form, objectID ) )!= NULL );
|
||||
return FrmGetObjectPtr( form, FrmGetObjectIndex( form, objectID ) );
|
||||
Int16 index = FrmGetObjectIndex( form, objectID );
|
||||
XP_ASSERT( index >= 0 );
|
||||
XP_ASSERT( FrmGetObjectPtr( form, index )!= NULL );
|
||||
return FrmGetObjectPtr( form, index );
|
||||
} /* getActiveObjectPtr */
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -66,8 +67,10 @@ getActiveObjectPtr( UInt16 objectID )
|
|||
void
|
||||
getObjectBounds( UInt16 objectID, RectangleType* rectP )
|
||||
{
|
||||
FormPtr form = FrmGetActiveForm();
|
||||
FrmGetObjectBounds( form, FrmGetObjectIndex( form, objectID ), rectP );
|
||||
FormPtr form = FrmGetActiveForm();
|
||||
Int16 index = FrmGetObjectIndex( form, objectID );
|
||||
XP_ASSERT( index >= 0 );
|
||||
FrmGetObjectBounds( form, index, rectP );
|
||||
} /* getObjectBounds */
|
||||
|
||||
#if defined XW_FEATURE_UTILS
|
||||
|
@ -77,8 +80,10 @@ getObjectBounds( UInt16 objectID, RectangleType* rectP )
|
|||
void
|
||||
setObjectBounds( UInt16 objectID, RectangleType* rectP )
|
||||
{
|
||||
FormPtr form = FrmGetActiveForm();
|
||||
FrmSetObjectBounds( form, FrmGetObjectIndex( form, objectID ), rectP );
|
||||
FormPtr form = FrmGetActiveForm();
|
||||
Int16 index = FrmGetObjectIndex( form, objectID );
|
||||
XP_ASSERT( index >= 0 );
|
||||
FrmSetObjectBounds( form, index, rectP );
|
||||
} /* getObjectBounds */
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -172,7 +177,8 @@ void
|
|||
centerControl( FormPtr form, UInt16 id )
|
||||
{
|
||||
RectangleType cBounds, fBounds;
|
||||
UInt16 index = FrmGetObjectIndex( form, id );
|
||||
Int16 index = FrmGetObjectIndex( form, id );
|
||||
XP_ASSERT( index >= 0 );
|
||||
|
||||
FrmGetObjectBounds( form, index, &cBounds );
|
||||
FrmGetFormBounds( form, &fBounds );
|
||||
|
@ -423,9 +429,18 @@ getFocusOwner( void )
|
|||
void
|
||||
setFormFocus( FormPtr form, XP_U16 objectID )
|
||||
{
|
||||
FrmSetFocus( form, FrmGetObjectIndex( form, objectID ) );
|
||||
Int16 index = FrmGetObjectIndex( form, objectID );
|
||||
XP_ASSERT( index >= 0 );
|
||||
FrmSetFocus( form, index );
|
||||
} /* setFormFocus */
|
||||
|
||||
XP_Bool
|
||||
isFormObject( FormPtr form, XP_U16 objectID )
|
||||
{
|
||||
Int16 index = FrmGetObjectIndex( form, objectID );
|
||||
return index >= 0;
|
||||
}
|
||||
|
||||
#ifndef XW_TARGET_PNO
|
||||
/* Warning: gross hack. HsNavDrawFocusRing doesn't work on newer Palms,
|
||||
e.g. Tungsten T. It's been replaced by FrmNavDrawFocusRing. But that
|
||||
|
|
|
@ -81,6 +81,7 @@ void drawOneGadget( UInt16 id, const char* text, Boolean hilite );
|
|||
# ifdef XWFEATURE_FIVEWAY
|
||||
XP_S16 getFocusOwner( void );
|
||||
void setFormFocus( FormPtr form, XP_U16 objectID );
|
||||
XP_Bool isFormObject( FormPtr form, XP_U16 objectID );
|
||||
void drawFocusRingOnGadget( PalmAppGlobals* globals, XP_U16 idLow,
|
||||
XP_U16 idHigh );
|
||||
XP_Bool considerGadgetFocus( PalmAppGlobals* globals, const EventType* event,
|
||||
|
|
Loading…
Reference in a new issue