mirror of https://github.com/macssh/macssh.git
run sessions with modeless dialog opened
This commit is contained in:
parent
9a76876b3c
commit
59b4a0402c
|
@ -1008,7 +1008,7 @@ void SaveSet(short doSaveMacros, short dontSaveTitle)
|
|||
short j;
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
theColor = RSgetcolor( screens[i].vs, j);
|
||||
RSgetcolor( screens[i].vs, j, &theColor);
|
||||
sprintf(temp2, "rgb%d = {%u,%u,%u}\015",
|
||||
j, theColor.red, theColor.green, theColor.blue);
|
||||
CStringToFile(fn,(unsigned char *) temp2);
|
||||
|
|
|
@ -379,6 +379,7 @@ void Cftp(void)
|
|||
FInfo fi;
|
||||
Point where = {100,100};
|
||||
|
||||
SetUpMovableModalMenus();
|
||||
dptr = GetNewMySmallStrangeDialog( FTPDLOG, NULL, kInFront, (void *)ThirdCenterDialog);
|
||||
|
||||
SetCntrl(dptr, FTPServerOff, (gFTPServerPrefs->ServerState == 0));
|
||||
|
@ -407,7 +408,8 @@ void Cftp(void)
|
|||
ShowWindow(dptr);
|
||||
ditem=0; /* initially no hits */
|
||||
while((ditem>2) || (ditem==0)) {
|
||||
ModalDialog(DLOGwOK_CancelUPP,&ditem);
|
||||
/*ModalDialog(DLOGwOK_CancelUPP,&ditem);*/
|
||||
movableModalDialog(DLOGwOK_CancelUPP,&ditem);
|
||||
switch(ditem) {
|
||||
case FTPShowFTPlog:
|
||||
case FTPrevDNS:
|
||||
|
@ -458,6 +460,7 @@ void Cftp(void)
|
|||
|
||||
if (ditem==DLOGCancel) {
|
||||
DisposeDialog( dptr);
|
||||
ResetMenus();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1265,6 +1268,7 @@ Boolean EditTerminal(StringPtr PrefRecordNamePtr)
|
|||
{43, (MenuHandle) 0, 1},
|
||||
{0, (MenuHandle) 0, 0}};
|
||||
|
||||
SetUpMovableModalMenus();
|
||||
dptr = GetNewMySmallStrangeDialog(TermDLOG, NULL, kInFront, (void *)ThirdCenterDialog);
|
||||
ditem = 3;
|
||||
SetDialogDefaultItem(dptr, 1);
|
||||
|
@ -1546,6 +1550,7 @@ Boolean EditTerminal(StringPtr PrefRecordNamePtr)
|
|||
|
||||
TelInfo->lastPanelTerminal = currentPanel - 1;
|
||||
DisposeDialog(dptr);
|
||||
ResetMenus();
|
||||
return(FALSE); // No changes should be made.
|
||||
}
|
||||
|
||||
|
@ -1590,13 +1595,14 @@ Boolean EditTerminal(StringPtr PrefRecordNamePtr)
|
|||
StringToNum(scratchPstring, &scratchlong);
|
||||
/* NONO */
|
||||
/* BoundsCheck(&scratchlong, 133, 10);*/
|
||||
BoundsCheck(&scratchlong, 255, 10);
|
||||
BoundsCheck(&scratchlong, 255, 1);
|
||||
/* NONO */
|
||||
TermPrefsPtr->vtwidth = (short) scratchlong;
|
||||
|
||||
GetTEText(dptr, TermHeight, scratchPstring);
|
||||
StringToNum(scratchPstring, &scratchlong);
|
||||
BoundsCheck(&scratchlong, 80, 10);
|
||||
// BoundsCheck(&scratchlong, 80, 10);
|
||||
BoundsCheck(&scratchlong, 200, 1);
|
||||
TermPrefsPtr->vtheight = (short) scratchlong;
|
||||
|
||||
GetTEText(dptr, TermFontSize, scratchPstring);
|
||||
|
@ -1633,6 +1639,7 @@ Boolean EditTerminal(StringPtr PrefRecordNamePtr)
|
|||
|
||||
TelInfo->lastPanelTerminal = currentPanel - 1;
|
||||
DisposeDialog(dptr);
|
||||
ResetMenus();
|
||||
return(TRUE); // A resource has changed or been added.
|
||||
}
|
||||
|
||||
|
@ -1788,6 +1795,7 @@ Boolean EditSession(StringPtr PrefRecordNamePtr)
|
|||
{SessTransTablePopup, (MenuHandle) 0, 1},
|
||||
{0, (MenuHandle) 0, 0}};
|
||||
|
||||
SetUpMovableModalMenus();
|
||||
dptr = GetNewMySmallStrangeDialog(SessionConfigDLOG, NULL, kInFront, (void *)ThirdCenterDialog);
|
||||
ditem = 3;
|
||||
SetDialogDefaultItem(dptr, 1);
|
||||
|
@ -2219,6 +2227,7 @@ Boolean EditSession(StringPtr PrefRecordNamePtr)
|
|||
else ReleaseResource((Handle) SessPrefsHdl);
|
||||
TelInfo->lastPanelSession = currentPanel - 1;
|
||||
DisposeDialog(dptr);
|
||||
ResetMenus();
|
||||
return(FALSE); // No changes should be made.
|
||||
}
|
||||
|
||||
|
@ -2243,6 +2252,7 @@ Boolean EditSession(StringPtr PrefRecordNamePtr)
|
|||
|
||||
TelInfo->lastPanelSession = currentPanel - 1;
|
||||
DisposeDialog(dptr);
|
||||
ResetMenus();
|
||||
return(TRUE); // A resource has changed or been added.
|
||||
}
|
||||
|
||||
|
@ -2385,6 +2395,7 @@ Boolean EditFTPUser(StringPtr PrefRecordNamePtr)
|
|||
FTPUser* FTPUptr;
|
||||
Str255 scratchPstring, scratchPstring2;
|
||||
|
||||
SetUpMovableModalMenus();
|
||||
dptr = GetNewMySmallStrangeDialog(FTPUserDLOG, NULL, kInFront, (void *)ThirdCenterDialog);
|
||||
ditem = 3;
|
||||
|
||||
|
@ -2420,7 +2431,8 @@ Boolean EditFTPUser(StringPtr PrefRecordNamePtr)
|
|||
ShowWindow(dptr);
|
||||
|
||||
while (ditem > 2) {
|
||||
ModalDialog(DLOGwOK_CancelUPP, &ditem);
|
||||
/*ModalDialog(DLOGwOK_CancelUPP, &ditem);*/
|
||||
movableModalDialog(DLOGwOK_CancelUPP, &ditem);
|
||||
switch (ditem) {
|
||||
case FTPUcanchangeCWD:
|
||||
FlipCheckBox(dptr, ditem);
|
||||
|
@ -2443,6 +2455,7 @@ Boolean EditFTPUser(StringPtr PrefRecordNamePtr)
|
|||
else ReleaseResource((Handle) FTPUHdl);
|
||||
|
||||
DisposeDialog(dptr);
|
||||
ResetMenus();
|
||||
return(FALSE); // No changes should be made.
|
||||
}
|
||||
|
||||
|
@ -2477,6 +2490,7 @@ Boolean EditFTPUser(StringPtr PrefRecordNamePtr)
|
|||
}
|
||||
|
||||
DisposeDialog(dptr);
|
||||
ResetMenus();
|
||||
return(TRUE); // A resource has changed or been added.
|
||||
}
|
||||
|
||||
|
@ -2491,6 +2505,7 @@ short AnsiPrompt(short allowDefaultBoldSelect, short *defaultBoldColor)
|
|||
Boolean UserLikesNewColor;
|
||||
RGBColorPtr scratchRGB;
|
||||
|
||||
SetUpMovableModalMenus();
|
||||
scratchRGB = (RGBColorPtr) myNewPtr(sizeof(RGBColor));
|
||||
dptr = GetNewMySmallDialog(ANSIColorDLOG, NULL, kInFront, (void *)ThirdCenterDialog);
|
||||
SetDialogDefaultItem(dptr, 1);
|
||||
|
@ -2574,6 +2589,7 @@ short AnsiPrompt(short allowDefaultBoldSelect, short *defaultBoldColor)
|
|||
if (ditem == DLOGCancel)
|
||||
{
|
||||
DisposeDialog(dptr);
|
||||
ResetMenus();
|
||||
return -1;
|
||||
}
|
||||
if (allowDefaultBoldSelect)
|
||||
|
@ -2585,6 +2601,7 @@ short AnsiPrompt(short allowDefaultBoldSelect, short *defaultBoldColor)
|
|||
SetEntryColor(TelInfo->AnsiColors, scratchshort, &(BoxColorData[scratchshort]));
|
||||
|
||||
DisposeDialog(dptr);
|
||||
ResetMenus();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -35,7 +35,9 @@ pascal void movableModalDialog(ModalFilterUPP filter, short *theItem)
|
|||
WaitNextEvent(everyEvent, &theEvent, gApplicationPrefs->TimeSlice, 0L);
|
||||
|
||||
DoNetEvents();
|
||||
|
||||
ssh2_sched();
|
||||
|
||||
SetPort(thisDialog);
|
||||
|
||||
if ((*theItem = preFilterEvent(thisDialog, &theEvent)) != 0)
|
||||
|
|
|
@ -694,6 +694,7 @@ short ModalMacros(NewMacroInfo *macrost)
|
|||
Str255 temp;
|
||||
Handle MacString[10], rubbish;
|
||||
|
||||
SetUpMovableModalMenus();
|
||||
dtemp=GetNewMyDialog( MacroDLOG + 2, NULL, kInFront, (void *)ThirdCenterDialog);
|
||||
SetDialogDefaultItem(dtemp, 1);
|
||||
SetDialogCancelItem(dtemp, 2);
|
||||
|
@ -731,6 +732,7 @@ short ModalMacros(NewMacroInfo *macrost)
|
|||
|
||||
if (dItem == 2) CancelMacros(macrost, dtemp);
|
||||
else CloseMacros(macrost, dtemp);
|
||||
ResetMenus();
|
||||
return dItem;
|
||||
}
|
||||
|
||||
|
|
|
@ -501,6 +501,7 @@ Boolean PresentOpenConnectionDialog(void)
|
|||
{
|
||||
DisposeMenu(SessPopupHdl); // drh Ñ Bug fix: memory leak
|
||||
DisposeDialog(dptr);
|
||||
ResetMenus();
|
||||
OutOfMemory(1000);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "maclook.proto.h"
|
||||
#include "DlogUtils.proto.h"
|
||||
#include "telneterrors.h"
|
||||
#include "movableModal.h"
|
||||
|
||||
extern Cursor *theCursors[];
|
||||
extern WindRec
|
||||
|
@ -249,6 +250,7 @@ void setupkeys( void)
|
|||
if (tempspot == NULL)
|
||||
return; //BUGG signal error here
|
||||
|
||||
SetUpMovableModalMenus();
|
||||
dtemp=GetNewMyDialog( SetupDLOG, NULL, kInFront, (void *)ThirdCenterDialog);
|
||||
|
||||
SetCursor(theCursors[normcurs]);
|
||||
|
@ -279,7 +281,8 @@ void setupkeys( void)
|
|||
|
||||
dItem=0; /* initially no hits */
|
||||
while((dItem>3) || (dItem==0)) { /* While we are in the loop */
|
||||
ModalDialog(DLOGwOK_CancelUPP,&dItem);
|
||||
/*ModalDialog(DLOGwOK_CancelUPP,&dItem);*/
|
||||
movableModalDialog(DLOGwOK_CancelUPP,&dItem);
|
||||
|
||||
/*
|
||||
* intermediate check. If they hit a key, put its number in the box.
|
||||
|
@ -314,6 +317,7 @@ void setupkeys( void)
|
|||
|
||||
if (dItem==DLOGCancel) {
|
||||
DisposeDialog( dtemp);
|
||||
ResetMenus();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -339,5 +343,6 @@ void setupkeys( void)
|
|||
screens[scrn].TELgo = toupper(*(tempspot+1)) ^ 64;
|
||||
|
||||
DisposeDialog( dtemp);
|
||||
ResetMenus();
|
||||
updateCursor(1);
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ unsigned long gPresentOpenConnectionTicks;
|
|||
|
||||
|
||||
extern void ssh2_sched();
|
||||
extern Boolean gThreadModal;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -111,7 +112,9 @@ void main(void)
|
|||
|
||||
do { /* BYU - Do this forever */
|
||||
UnloadSegments();
|
||||
DoEvents(NULL);
|
||||
if (!gThreadModal) {
|
||||
DoEvents(NULL);
|
||||
}
|
||||
ssh2_sched();
|
||||
if (!TelInfo->done) {
|
||||
DoNetEvents();
|
||||
|
|
|
@ -2123,6 +2123,7 @@ long SetOtherFontSize(short currentSize)
|
|||
Boolean GoodValue;
|
||||
short ditem;
|
||||
|
||||
SetUpMovableModalMenus();
|
||||
dtemp=GetNewMyDialog( OtherFontDLOG, NULL, kInFront, (void *)ThirdCenterDialog);
|
||||
InitCursor();
|
||||
|
||||
|
@ -2135,9 +2136,11 @@ long SetOtherFontSize(short currentSize)
|
|||
SetTEText(dtemp, FontSizeTE, currentSizeStr);
|
||||
|
||||
ditem = 0;
|
||||
while(ditem != DLOGOk && ditem != DLOGCancel)
|
||||
ModalDialog(DLOGwOK_CancelUPP, &ditem);
|
||||
|
||||
while(ditem != DLOGOk && ditem != DLOGCancel) {
|
||||
//ModalDialog(DLOGwOK_CancelUPP, &ditem);
|
||||
movableModalDialog(DLOGwOK_CancelUPP, &ditem);
|
||||
}
|
||||
|
||||
if (ditem == DLOGCancel) {
|
||||
DisposeDialog( dtemp);
|
||||
return currentSize;
|
||||
|
@ -2152,7 +2155,7 @@ long SetOtherFontSize(short currentSize)
|
|||
if (!GoodValue) SysBeep(4);
|
||||
}
|
||||
DisposeDialog( dtemp);
|
||||
|
||||
ResetMenus();
|
||||
return (newSize);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
@ -2171,6 +2174,7 @@ void SetScreenDimensions(short scrn, short modifiers)
|
|||
short oldlines;
|
||||
short oldcols;
|
||||
|
||||
SetUpMovableModalMenus();
|
||||
dtemp=GetNewMyDialog( SizeDLOG, NULL, kInFront, (void *)ThirdCenterDialog);
|
||||
|
||||
SetCursor(theCursors[normcurs]);
|
||||
|
@ -2188,9 +2192,11 @@ void SetScreenDimensions(short scrn, short modifiers)
|
|||
SelectDialogItemText( dtemp, ColumnsNumber, 0, 32767);
|
||||
|
||||
ditem = 3;
|
||||
while(ditem>2)
|
||||
ModalDialog(DLOGwOK_CancelUPP, &ditem);
|
||||
|
||||
while(ditem>2) {
|
||||
/*ModalDialog(DLOGwOK_CancelUPP, &ditem);*/
|
||||
movableModalDialog(DLOGwOK_CancelUPP, &ditem);
|
||||
}
|
||||
|
||||
if (ditem == DLOGCancel) {
|
||||
DisposeDialog( dtemp);
|
||||
return;
|
||||
|
@ -2228,8 +2234,8 @@ void SetScreenDimensions(short scrn, short modifiers)
|
|||
|
||||
if (notgood) SysBeep(4);
|
||||
}
|
||||
|
||||
DisposeDialog( dtemp);
|
||||
ResetMenus();
|
||||
|
||||
oldlines = VSgetlines(screens[scrn].vs);
|
||||
oldcols = VSgetcols(screens[scrn].vs);
|
||||
|
@ -2260,6 +2266,7 @@ void ChangeWindowName(WindowPtr theWindow)
|
|||
|
||||
if( theWindow != NULL) {
|
||||
InitCursor();
|
||||
SetUpMovableModalMenus();
|
||||
dptr = GetNewMySmallDialog(WinTitlDLOG, NULL, kInFront, (void *)ThirdCenterDialog );
|
||||
|
||||
GetWTitle(theWindow, theName);
|
||||
|
@ -2267,14 +2274,16 @@ void ChangeWindowName(WindowPtr theWindow)
|
|||
SelectDialogItemText( dptr, kWinNameTE, 0, 250 );
|
||||
|
||||
itemHit = 0;
|
||||
while(itemHit != DLOGOk && itemHit != DLOGCancel)
|
||||
ModalDialog(DLOGwOK_CancelUPP, &itemHit);
|
||||
|
||||
while(itemHit != DLOGOk && itemHit != DLOGCancel) {
|
||||
//ModalDialog(DLOGwOK_CancelUPP, &itemHit);
|
||||
movableModalDialog(DLOGwOK_CancelUPP, &itemHit);
|
||||
}
|
||||
|
||||
if(itemHit == DLOGOk) {
|
||||
GetTEText(dptr, kWinNameTE, theName);
|
||||
set_new_window_name(theName, theWindow);
|
||||
}
|
||||
|
||||
ResetMenus();
|
||||
DisposeDialog(dptr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -776,6 +776,27 @@ void clearcachedpassphrase()
|
|||
|
||||
/* let the user deal with only one dialog at a time */
|
||||
pthread_mutex_t dialock = NULL;
|
||||
Boolean gThreadModal = false;
|
||||
|
||||
/*
|
||||
* getpass
|
||||
*/
|
||||
|
||||
void LockDialog()
|
||||
{
|
||||
pthread_mutex_lock( &dialock );
|
||||
gThreadModal = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* getpass
|
||||
*/
|
||||
|
||||
void UnlockDialog()
|
||||
{
|
||||
gThreadModal = false;
|
||||
pthread_mutex_unlock( &dialock );
|
||||
}
|
||||
|
||||
/*
|
||||
* getpass
|
||||
|
@ -809,9 +830,9 @@ char *getpass( const char *prompt )
|
|||
valid = 1;
|
||||
} else {
|
||||
ppassword[0] = 0;
|
||||
pthread_mutex_lock( &dialock );
|
||||
LockDialog();
|
||||
valid = SSH2PasswordDialog(prompt, ppassword);
|
||||
pthread_mutex_unlock( &dialock );
|
||||
UnlockDialog();
|
||||
if (valid) {
|
||||
memcpy(password, ppassword + 1, ppassword[0]);
|
||||
password[ppassword[0]] = '\0';
|
||||
|
@ -831,9 +852,9 @@ char *getpass( const char *prompt )
|
|||
return context->_kpassword;
|
||||
}
|
||||
context->_kpassword[0] = 0;
|
||||
pthread_mutex_lock( &dialock );
|
||||
LockDialog();
|
||||
valid = SSH2PasswordDialog(prompt, (StringPtr)context->_kpassword);
|
||||
pthread_mutex_unlock( &dialock );
|
||||
UnlockDialog();
|
||||
if (valid) {
|
||||
plen = context->_kpassword[0];
|
||||
password = (wind != NULL) ? wind->sshdata.currentpass : context->_kpassword;
|
||||
|
@ -872,9 +893,9 @@ short save_once_cancel1(char *fingerprint)
|
|||
{
|
||||
short result;
|
||||
|
||||
pthread_mutex_lock( &dialock );
|
||||
LockDialog();
|
||||
result = SSH2SOC1Dialog(fingerprint);
|
||||
pthread_mutex_unlock( &dialock );
|
||||
UnlockDialog();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -886,9 +907,9 @@ short save_once_cancel2(char *fingerprint)
|
|||
{
|
||||
short result;
|
||||
|
||||
pthread_mutex_lock( &dialock );
|
||||
LockDialog();
|
||||
result = SSH2SOC2Dialog(fingerprint);
|
||||
pthread_mutex_unlock( &dialock );
|
||||
UnlockDialog();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -912,9 +933,9 @@ int yes_or_no(struct lsh_string *s, int def, int free)
|
|||
pprompt[i] = 0x0d;
|
||||
}
|
||||
}
|
||||
pthread_mutex_lock( &dialock );
|
||||
LockDialog();
|
||||
def = YesNoDialog( pprompt );
|
||||
pthread_mutex_unlock( &dialock );
|
||||
UnlockDialog();
|
||||
}
|
||||
lsh_string_free(prompt);
|
||||
}
|
||||
|
@ -986,7 +1007,9 @@ void ssh2_doevent(long sleepTime)
|
|||
extern Boolean haveNotifiedLowMemory;
|
||||
|
||||
if ( key_gen == 0 ) {
|
||||
DoEvents(NULL);
|
||||
if (!gThreadModal) {
|
||||
DoEvents(NULL);
|
||||
}
|
||||
if (!TelInfo->done) {
|
||||
DoNetEvents();
|
||||
}
|
||||
|
@ -998,12 +1021,14 @@ void ssh2_doevent(long sleepTime)
|
|||
haveNotifiedLowMemory = true;
|
||||
}
|
||||
} else {
|
||||
static unsigned long lastTicks = 0L;
|
||||
if ( (LMGetTicks() - lastTicks) >= 10 ) {
|
||||
EventRecord myEvent;
|
||||
lastTicks = LMGetTicks();
|
||||
if ( WaitNextEvent(everyEvent, &myEvent, 0, 0L) ) {
|
||||
HandleEvent(&myEvent);
|
||||
if (!gThreadModal) {
|
||||
static unsigned long lastTicks = 0L;
|
||||
if ( (LMGetTicks() - lastTicks) >= 10 ) {
|
||||
EventRecord myEvent;
|
||||
lastTicks = LMGetTicks();
|
||||
if ( WaitNextEvent(everyEvent, &myEvent, 0, 0L) ) {
|
||||
HandleEvent(&myEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue