Commit 89693dd5a8048c7a75ee1b71819617c8212e7d2f
1 parent
853ed0a3
Exists in
master
Atualizando callbacks de configuração do tamanho da tela
Showing
4 changed files
with
17 additions
and
14 deletions
Show diff stats
src/gtk2/screen.c
@@ -83,7 +83,7 @@ | @@ -83,7 +83,7 @@ | ||
83 | static gchar * convert_monocase(int c, gsize *sz); | 83 | static gchar * convert_monocase(int c, gsize *sz); |
84 | static gchar * convert_regular(int c, gsize *sz); | 84 | static gchar * convert_regular(int c, gsize *sz); |
85 | static int popup_dialog(H3270 *session, PW3270_DIALOG type, const char *title, const char *msg, const char *fmt, va_list arg); | 85 | static int popup_dialog(H3270 *session, PW3270_DIALOG type, const char *title, const char *msg, const char *fmt, va_list arg); |
86 | - static void model_changed(H3270 *session, const char *name, int model, int cols, int rows); | 86 | + static void model_changed(H3270 *session, const char *name, int model, int rows, int cols); |
87 | 87 | ||
88 | #ifdef HAVE_ALTSCREEN | 88 | #ifdef HAVE_ALTSCREEN |
89 | static void view_changed(H3270 *session, unsigned short rows, unsigned short cols); | 89 | static void view_changed(H3270 *session, unsigned short rows, unsigned short cols); |
@@ -102,7 +102,7 @@ | @@ -102,7 +102,7 @@ | ||
102 | warning, // void (*Warning)(const char *fmt, va_list arg); | 102 | warning, // void (*Warning)(const char *fmt, va_list arg); |
103 | syserror, // void (*SysError)(const char *title, const char *message, const char *system); | 103 | syserror, // void (*SysError)(const char *title, const char *message, const char *system); |
104 | 104 | ||
105 | - model_changed, // void (*model_changed)(H3270 *session, const char *name, int model, int cols, int rows); | 105 | + model_changed, // void (*model_changed)(H3270 *session, const char *name, int model, int rows, int cols); |
106 | 106 | ||
107 | addch, // void (*addch)(int row, int col, unsigned char c, int attr); | 107 | addch, // void (*addch)(int row, int col, unsigned char c, int attr); |
108 | set_charset, // void (*charset)(char *dcs); | 108 | set_charset, // void (*charset)(char *dcs); |
@@ -874,7 +874,7 @@ | @@ -874,7 +874,7 @@ | ||
874 | 874 | ||
875 | } | 875 | } |
876 | 876 | ||
877 | - static void model_changed(H3270 *session, const char *name, int model, int cols, int rows) | 877 | + static void model_changed(H3270 *session, const char *name, int model, int rows, int cols) |
878 | { | 878 | { |
879 | int length = rows*cols; | 879 | int length = rows*cols; |
880 | 880 |
src/include/lib3270/api.h
@@ -274,7 +274,7 @@ | @@ -274,7 +274,7 @@ | ||
274 | void (*update_luname)(H3270 *session, const char *name); | 274 | void (*update_luname)(H3270 *session, const char *name); |
275 | void (*update_status)(H3270 *session, LIB3270_STATUS id); | 275 | void (*update_status)(H3270 *session, LIB3270_STATUS id); |
276 | void (*update_connect)(H3270 *session, unsigned char connected); | 276 | void (*update_connect)(H3270 *session, unsigned char connected); |
277 | - void (*update_model)(H3270 *session, int model); | 277 | + void (*update_model)(H3270 *session, const char *name, int model, int rows, int cols); |
278 | 278 | ||
279 | void (*set_timer)(H3270 *session, unsigned char on); | 279 | void (*set_timer)(H3270 *session, unsigned char on); |
280 | void (*erase)(H3270 *session); | 280 | void (*erase)(H3270 *session); |
@@ -496,7 +496,7 @@ | @@ -496,7 +496,7 @@ | ||
496 | void (*Error)(const char *fmt, va_list arg); | 496 | void (*Error)(const char *fmt, va_list arg); |
497 | void (*Warning)(const char *fmt, va_list arg); | 497 | void (*Warning)(const char *fmt, va_list arg); |
498 | void (*SysError)(const char *title, const char *message, const char *system); | 498 | void (*SysError)(const char *title, const char *message, const char *system); |
499 | - void (*model_changed)(H3270 *session, const char *name, int model, int cols, int rows); | 499 | + void (*model_changed)(H3270 *session, const char *name, int model, int rows, int cols); |
500 | int (*addch)(int row, int col, unsigned char c, unsigned short attr); | 500 | int (*addch)(int row, int col, unsigned char c, unsigned short attr); |
501 | void (*charset)(char *dcs); | 501 | void (*charset)(char *dcs); |
502 | void (*title)(char *text); | 502 | void (*title)(char *text); |
src/lib/ctlr.c
@@ -200,14 +200,9 @@ int lib3270_set_model(H3270 *session, int model) | @@ -200,14 +200,9 @@ int lib3270_set_model(H3270 *session, int model) | ||
200 | if(CONNECTED) | 200 | if(CONNECTED) |
201 | return EBUSY; | 201 | return EBUSY; |
202 | 202 | ||
203 | - if(session->model_num != model) | ||
204 | - { | ||
205 | - ctlr_set_rows_cols(session,model,session->ov_cols,session->ov_rows); | ||
206 | - ctlr_reinit(session,MODEL_CHANGE); | 203 | + ctlr_set_rows_cols(session,model,session->ov_cols,session->ov_rows); |
204 | + ctlr_reinit(session,MODEL_CHANGE); | ||
207 | 205 | ||
208 | - if(session->update_model) | ||
209 | - session->update_model(session,model); | ||
210 | - } | ||
211 | return 0; | 206 | return 0; |
212 | } | 207 | } |
213 | 208 |
src/lib/screen.c
@@ -153,6 +153,9 @@ int screen_init(H3270 *session) | @@ -153,6 +153,9 @@ int screen_init(H3270 *session) | ||
153 | if(callbacks->toggle_changed) | 153 | if(callbacks->toggle_changed) |
154 | session->update_toggle = callbacks->toggle_changed; | 154 | session->update_toggle = callbacks->toggle_changed; |
155 | 155 | ||
156 | + if(callbacks->model_changed) | ||
157 | + session->update_model = callbacks->model_changed; | ||
158 | + | ||
156 | if(callbacks->init()) | 159 | if(callbacks->init()) |
157 | { | 160 | { |
158 | popup_an_error("Can't initialize terminal."); | 161 | popup_an_error("Can't initialize terminal."); |
@@ -312,8 +315,13 @@ void update_model_info(H3270 *session, int model, int cols, int rows) | @@ -312,8 +315,13 @@ void update_model_info(H3270 *session, int model, int cols, int rows) | ||
312 | /* Update the model name. */ | 315 | /* Update the model name. */ |
313 | (void) sprintf(session->model_name, "327%c-%d%s",appres.m3279 ? '9' : '8',session->model_num,appres.extended ? "-E" : ""); | 316 | (void) sprintf(session->model_name, "327%c-%d%s",appres.m3279 ? '9' : '8',session->model_num,appres.extended ? "-E" : ""); |
314 | 317 | ||
315 | - if(callbacks && callbacks->model_changed) | ||
316 | - callbacks->model_changed(session, session->model_name,session->model_num,cols,rows); | 318 | + if(session->configure) |
319 | + session->configure(session,rows,cols); | ||
320 | + | ||
321 | + if(session->update_model) | ||
322 | + session->update_model(session, session->model_name,session->model_num,rows,cols); | ||
323 | + else if(callbacks && callbacks->model_changed) | ||
324 | + callbacks->model_changed(session, session->model_name,session->model_num,rows,cols); | ||
317 | } | 325 | } |
318 | 326 | ||
319 | LIB3270_EXPORT int lib3270_get_contents(H3270 *h, int first, int last, unsigned char *chr, unsigned short *attr) | 327 | LIB3270_EXPORT int lib3270_get_contents(H3270 *h, int first, int last, unsigned char *chr, unsigned short *attr) |