diff --git a/src/include/lib3270.h b/src/include/lib3270.h
index 8bdb91e..e3dae64 100644
--- a/src/include/lib3270.h
+++ b/src/include/lib3270.h
@@ -110,6 +110,7 @@
LIB3270_TOGGLE_KP_ALTERNATIVE, /**< Keypad +/- move to next/previous field */
LIB3270_TOGGLE_BEEP, /**< Beep on errors */
LIB3270_TOGGLE_VIEW_FIELD, /**< View Field attribute */
+ LIB3270_TOGGLE_ALTSCREEN, /**< auto resize on altscreen */
// LIB3270_TOGGLE_ALT_CURSOR,
// LIB3270_TOGGLE_AID_WAIT,
diff --git a/src/lib3270/ctlr.c b/src/lib3270/ctlr.c
index c628e4e..e6e61ed 100644
--- a/src/lib3270/ctlr.c
+++ b/src/lib3270/ctlr.c
@@ -129,9 +129,6 @@ void ctlr_init(H3270 *session, unsigned cmask unused)
*/
void ctlr_reinit(H3270 *session, unsigned cmask)
{
-// static struct ea *real_ea_buf = NULL;
-// static struct ea *real_aea_buf = NULL;
-
if (cmask & MODEL_CHANGE)
{
/* Allocate buffers */
@@ -177,7 +174,7 @@ int lib3270_set_model(H3270 *hSession, int model)
ctlr_set_rows_cols(hSession,model,hSession->ov_cols,hSession->ov_rows);
ctlr_reinit(hSession,MODEL_CHANGE);
-
+ screen_update(hSession,0,hSession->rows*hSession->cols);
return 0;
}
@@ -402,9 +399,9 @@ LIB3270_EXPORT int lib3270_get_next_unprotected(H3270 *hSession, int baddr0)
return 0;
}
-/*
- * Perform an erase command, which may include changing the (virtual) screen
- * size.
+/**
+ * Perform an erase command, which may include changing the (virtual) screen size.
+ *
*/
void ctlr_erase(H3270 *session, int alt)
{
@@ -421,6 +418,7 @@ void ctlr_erase(H3270 *session, int alt)
{
/* Going from 24x80 to maximum. */
session->display(session);
+
set_viewsize(session,session->maxROWS,session->maxCOLS);
}
else
@@ -433,7 +431,11 @@ void ctlr_erase(H3270 *session, int alt)
ctlr_blanks(session);
session->display(session);
}
- set_viewsize(session,24,80);
+
+ if(lib3270_get_toggle(session,LIB3270_TOGGLE_ALTSCREEN))
+ set_viewsize(session,24,80);
+ else
+ set_viewsize(session,session->maxROWS,80);
}
}
@@ -441,7 +443,6 @@ void ctlr_erase(H3270 *session, int alt)
}
-
/*
* Interpret an incoming 3270 command.
*/
@@ -466,7 +467,7 @@ enum pds process_ds(H3270 *hSession, unsigned char *buf, int buflen)
case CMD_EWA: /* erase/write alternate */
case SNA_CMD_EWA:
trace_ds(hSession,"EraseWriteAlternate");
- ctlr_erase(hSession,True);
+ ctlr_erase(hSession,1);
if ((rv = ctlr_write(hSession,buf, buflen, True)) < 0)
return rv;
return PDS_OKAY_NO_OUTPUT;
@@ -475,7 +476,7 @@ enum pds process_ds(H3270 *hSession, unsigned char *buf, int buflen)
case CMD_EW: /* erase/write */
case SNA_CMD_EW:
trace_ds(hSession,"EraseWrite");
- ctlr_erase(hSession,False);
+ ctlr_erase(hSession,0);
if ((rv = ctlr_write(hSession,buf, buflen, True)) < 0)
return rv;
return PDS_OKAY_NO_OUTPUT;
diff --git a/src/lib3270/sf.c b/src/lib3270/sf.c
index 827cb3e..a5251d7 100644
--- a/src/lib3270/sf.c
+++ b/src/lib3270/sf.c
@@ -403,12 +403,12 @@ static enum pds sf_erase_reset(H3270 *hSession, unsigned char buf[], int buflen)
{
case SF_ER_DEFAULT:
trace_ds(hSession," Default\n");
- ctlr_erase(hSession,False);
+ ctlr_erase(hSession,0);
break;
case SF_ER_ALT:
trace_ds(hSession," Alternate\n");
- ctlr_erase(hSession,True);
+ ctlr_erase(hSession,1);
break;
default:
diff --git a/src/lib3270/toggles.c b/src/lib3270/toggles.c
index 291c2aa..8eb1c8f 100644
--- a/src/lib3270/toggles.c
+++ b/src/lib3270/toggles.c
@@ -78,6 +78,8 @@ static const char *toggle_names[LIB3270_TOGGLE_COUNT] =
"kpalternative", /**< Keypad +/- move to next/previous field */
"beep", /**< Beep on errors */
"fieldattr", /**< View Field attribute */
+ "altscreen", /**< auto resize on altscreen */
+
};
@@ -141,6 +143,12 @@ LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix)
return (int) t->value;
}
+static void toggle_altscreen(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt)
+{
+ if(!session->screen_alt)
+ set_viewsize(session,t->value ? 24 : session->maxROWS,80);
+}
+
static void toggle_monocase(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt)
{
session->display(session);
@@ -165,6 +173,7 @@ void initialize_toggles(H3270 *session)
session->toggle[LIB3270_TOGGLE_RECTANGLE_SELECT].upcall = toggle_rectselect;
session->toggle[LIB3270_TOGGLE_MONOCASE].upcall = toggle_monocase;
+ session->toggle[LIB3270_TOGGLE_ALTSCREEN].upcall = toggle_altscreen;
/*
#if defined(X3270_TRACE)
@@ -183,13 +192,11 @@ void initialize_toggles(H3270 *session)
LIB3270_TOGGLE_CURSOR_BLINK,
LIB3270_TOGGLE_CURSOR_POS,
LIB3270_TOGGLE_BEEP,
+ LIB3270_TOGGLE_ALTSCREEN,
};
for(f=0;f< (sizeof(active_by_default)/sizeof(active_by_default[0])); f++)
- {
session->toggle[active_by_default[f]].value = True;
- }
-
for(f=0;f
+
--
libgit2 0.21.2