Work around an issue where the top and bottom of the LineEdit caret could blink out of sync.

This could happen when the caret had been partially obscured by another window.
This commit is contained in:
Stephen Heumann 2017-04-12 23:57:37 -05:00
parent ed3292dbc1
commit 079ab7e00a
1 changed files with 24 additions and 7 deletions

View File

@ -308,11 +308,13 @@ void DoConnect(void)
Word i; Word i;
char *lastColon; char *lastColon;
AFPURLParts urlParts; AFPURLParts urlParts;
Boolean completedOK = FALSE;
CtlRecHndl ctl;
GetLETextByID(wPtr, urlLine, (StringPtr)&urlBuf); GetLETextByID(wPtr, urlLine, (StringPtr)&urlBuf);
urlParts = prepareURL(urlBuf+1); urlParts = prepareURL(urlBuf+1);
if (urlParts.protocol == proto_invalid) if (urlParts.protocol == proto_invalid)
return; goto fixcaret;
/* Generate the path name for the temp file in same dir as the CDev */ /* Generate the path name for the temp file in same dir as the CDev */
getRefInfoRec.pCount = 3; getRefInfoRec.pCount = 3;
@ -331,12 +333,20 @@ void DoConnect(void)
filename.bufString.length = strlen(filename.bufString.text); filename.bufString.length = strlen(filename.bufString.text);
ConnectOrSave(&urlParts, (GSString255Ptr)&filename.bufString, TRUE); ConnectOrSave(&urlParts, (GSString255Ptr)&filename.bufString, TRUE);
return; completedOK = TRUE;
err: err:
/* Most error cases here should be impossible or very unlikely. */ /* Most error cases here should be impossible or very unlikely. */
AlertWindow(awResource+awButtonLayout, NULL, tempFileNameError); if (!completedOK)
return; AlertWindow(awResource+awButtonLayout, NULL, tempFileNameError);
fixcaret:
/* Work around issue where parts of the LE caret may flash out of sync */
ctl = GetCtlHandleFromID(wPtr, urlLine);
LEDeactivate((LERecHndl) GetCtlTitle(ctl));
if (FindTargetCtl() == ctl) {
LEActivate((LERecHndl) GetCtlTitle(ctl));
}
} }
void DoSave(void) void DoSave(void)
@ -344,6 +354,7 @@ void DoSave(void)
Boolean loadedSF = FALSE, startedSF = FALSE, completedOK = FALSE; Boolean loadedSF = FALSE, startedSF = FALSE, completedOK = FALSE;
Handle dpSpace; Handle dpSpace;
AFPURLParts urlParts; AFPURLParts urlParts;
CtlRecHndl ctl;
GetLETextByID(wPtr, urlLine, (StringPtr)&urlBuf); GetLETextByID(wPtr, urlLine, (StringPtr)&urlBuf);
urlParts = prepareURL(urlBuf+1); urlParts = prepareURL(urlBuf+1);
@ -401,11 +412,19 @@ err:
if (loadedSF) if (loadedSF)
UnloadOneTool(0x17); UnloadOneTool(0x17);
return; /* Work around issue where parts of the LE caret may flash out of sync */
ctl = GetCtlHandleFromID(wPtr, urlLine);
LEDeactivate((LERecHndl) GetCtlTitle(ctl));
if (FindTargetCtl() == ctl) {
LEActivate((LERecHndl) GetCtlTitle(ctl));
}
} }
void DoHit(long ctlID) void DoHit(long ctlID)
{ {
if (!wPtr) /* shouldn't happen */
return;
if (ctlID == connectBtn) { if (ctlID == connectBtn) {
DoConnect(); DoConnect();
} else if (ctlID == saveAliasBtn) { } else if (ctlID == saveAliasBtn) {
@ -439,8 +458,6 @@ void DoEdit(Word op)
{ {
CtlRecHndl ctl; CtlRecHndl ctl;
GrafPortPtr port; GrafPortPtr port;
LERecHndl leHandle;
LongWord ctlParams;
if (!wPtr) if (!wPtr)
return; return;