From 99d54a6cba1582d0f702c4175cda29f139f1ffac Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Mon, 9 Sep 2019 16:26:40 -0300 Subject: [PATCH] Adjustments on screen size changes. --- src/core/ctlr.c | 6 +++--- src/core/screen.c | 10 ++++++++++ src/core/trace_ds.c | 11 +++++++++++ src/include/lib3270.h | 4 ++++ src/include/lib3270/trace.h | 11 +++++++++++ 5 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/core/ctlr.c b/src/core/ctlr.c index 4240e4d..1607c45 100644 --- a/src/core/ctlr.c +++ b/src/core/ctlr.c @@ -24,8 +24,6 @@ * * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * licinio@bb.com.br (Licínio Luis Branco) - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) * */ @@ -565,12 +563,13 @@ void ctlr_erase(H3270 *session, int alt) if (alt) { // Going from 24x80 to maximum. - session->cbk.display(session); + lib3270_write_screen_trace(session,"Going from 24x80 to %dx%d",session->max.rows,session->max.cols); set_viewsize(session,session->max.rows,session->max.cols); } else { // Going from maximum to 24x80. + lib3270_write_screen_trace(session,"Going from %dx%d to 24x80",session->max.rows,session->max.cols); if (session->max.rows > 24 || session->max.cols > 80) { if(session->vcontrol) @@ -587,6 +586,7 @@ void ctlr_erase(H3270 *session, int alt) } session->screen_alt = alt; + session->cbk.display(session); } diff --git a/src/core/screen.c b/src/core/screen.c index 205be44..655525f 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -266,6 +266,16 @@ LIB3270_EXPORT unsigned int lib3270_get_height(const H3270 *h) return h->view.rows; } +LIB3270_EXPORT unsigned int lib3270_get_max_width(const H3270 *h) +{ + return h->max.cols; +} + +LIB3270_EXPORT unsigned int lib3270_get_max_height(const H3270 *h) +{ + return h->max.rows; +} + void update_model_info(H3270 *session, unsigned int model, unsigned int cols, unsigned int rows) { if(model == session->model_num && session->max.rows == rows && session->max.cols == cols) diff --git a/src/core/trace_ds.c b/src/core/trace_ds.c index 64070bb..7fdfe6e 100644 --- a/src/core/trace_ds.c +++ b/src/core/trace_ds.c @@ -236,6 +236,17 @@ LIB3270_EXPORT void lib3270_write_nettrace(H3270 *session, const char *fmt, ...) va_end(args); } +LIB3270_EXPORT void lib3270_write_screen_trace(H3270 *session, const char *fmt, ...) +{ + va_list args; + + if(!lib3270_get_toggle(session,LIB3270_TOGGLE_SCREEN_TRACE)) + return; + + va_start(args, fmt); + session->trace.handler(session,session->trace.userdata,fmt, args); + va_end(args); +} LIB3270_EXPORT void lib3270_trace_event(H3270 *session, const char *fmt, ...) { diff --git a/src/include/lib3270.h b/src/include/lib3270.h index 06c8721..89681f9 100644 --- a/src/include/lib3270.h +++ b/src/include/lib3270.h @@ -437,6 +437,8 @@ */ LIB3270_EXPORT unsigned int lib3270_get_width(const H3270 *h); + LIB3270_EXPORT unsigned int lib3270_get_max_width(const H3270 *h); + /** * Get current screen width in rows. * @@ -447,6 +449,8 @@ */ LIB3270_EXPORT unsigned int lib3270_get_height(const H3270 *h); + LIB3270_EXPORT unsigned int lib3270_get_max_height(const H3270 *h); + LIB3270_EXPORT unsigned int lib3270_get_length(const H3270 *h); /** diff --git a/src/include/lib3270/trace.h b/src/include/lib3270/trace.h index 4c98865..e542a2c 100644 --- a/src/include/lib3270/trace.h +++ b/src/include/lib3270/trace.h @@ -97,6 +97,17 @@ */ LIB3270_EXPORT void lib3270_write_nettrace(H3270 *session, const char *fmt, ...) LIB3270_AS_PRINTF(2,3); + /** + * @brief Write on trace file. + * + * Write text on trace file, if screen trace is enabled. + * + * @param fmt String format. + * @param ... Arguments. + * + */ + LIB3270_EXPORT void lib3270_write_screen_trace(H3270 *session, const char *fmt, ...) LIB3270_AS_PRINTF(2,3); + /** * @brief Write on trace file. * -- libgit2 0.21.2