Commit 5787185d38536adf4915d270b1deb5aeaabbbc5b
1 parent
c7743bf8
Exists in
master
and in
3 other branches
Android - Permitindo substituição do método de desenho da tela
Showing
8 changed files
with
58 additions
and
60 deletions
Show diff stats
@@ -388,7 +388,7 @@ | @@ -388,7 +388,7 @@ | ||
388 | /* Screen calls */ | 388 | /* Screen calls */ |
389 | // LOCAL_EXTERN void screen_resume(H3270 *session); | 389 | // LOCAL_EXTERN void screen_resume(H3270 *session); |
390 | // LOCAL_EXTERN void screen_suspend(H3270 *session); | 390 | // LOCAL_EXTERN void screen_suspend(H3270 *session); |
391 | - LOCAL_EXTERN void screen_disp(H3270 *session); | 391 | +// LOCAL_EXTERN void screen_disp(H3270 *session); |
392 | 392 | ||
393 | #include <lib3270/actions.h> | 393 | #include <lib3270/actions.h> |
394 | 394 |
ctlr.c
@@ -459,7 +459,7 @@ void ctlr_erase(H3270 *session, int alt) | @@ -459,7 +459,7 @@ void ctlr_erase(H3270 *session, int alt) | ||
459 | 459 | ||
460 | kybd_inhibit(False); | 460 | kybd_inhibit(False); |
461 | ctlr_clear(session,True); | 461 | ctlr_clear(session,True); |
462 | - screen_erase(session); | 462 | + session->erase(session); |
463 | 463 | ||
464 | if(alt == session->screen_alt) | 464 | if(alt == session->screen_alt) |
465 | return; | 465 | return; |
@@ -467,7 +467,7 @@ void ctlr_erase(H3270 *session, int alt) | @@ -467,7 +467,7 @@ void ctlr_erase(H3270 *session, int alt) | ||
467 | if (alt) | 467 | if (alt) |
468 | { | 468 | { |
469 | /* Going from 24x80 to maximum. */ | 469 | /* Going from 24x80 to maximum. */ |
470 | - screen_disp(session); | 470 | + session->display(session); |
471 | set_viewsize(session,session->maxROWS,session->maxCOLS); | 471 | set_viewsize(session,session->maxROWS,session->maxCOLS); |
472 | } | 472 | } |
473 | else | 473 | else |
@@ -478,7 +478,7 @@ void ctlr_erase(H3270 *session, int alt) | @@ -478,7 +478,7 @@ void ctlr_erase(H3270 *session, int alt) | ||
478 | if(session->vcontrol) | 478 | if(session->vcontrol) |
479 | { | 479 | { |
480 | ctlr_blanks(); | 480 | ctlr_blanks(); |
481 | - screen_disp(session); | 481 | + session->display(session); |
482 | } | 482 | } |
483 | set_viewsize(session,24,80); | 483 | set_viewsize(session,24,80); |
484 | } | 484 | } |
@@ -2574,7 +2574,7 @@ void ctlr_scroll(void) | @@ -2574,7 +2574,7 @@ void ctlr_scroll(void) | ||
2574 | /* Clear the last line. */ | 2574 | /* Clear the last line. */ |
2575 | (void) memset((char *) &h3270.ea_buf[qty], 0, h3270.cols * sizeof(struct ea)); | 2575 | (void) memset((char *) &h3270.ea_buf[qty], 0, h3270.cols * sizeof(struct ea)); |
2576 | 2576 | ||
2577 | - screen_disp(&h3270); | 2577 | + h3270.display(&h3270); |
2578 | 2578 | ||
2579 | } | 2579 | } |
2580 | #endif /*]*/ | 2580 | #endif /*]*/ |
@@ -2672,7 +2672,7 @@ ctlr_shrink(void) | @@ -2672,7 +2672,7 @@ ctlr_shrink(void) | ||
2672 | h3270.ea_buf[baddr].cc = h3270.vcontrol ? EBC_space : EBC_null; | 2672 | h3270.ea_buf[baddr].cc = h3270.vcontrol ? EBC_space : EBC_null; |
2673 | } | 2673 | } |
2674 | ALL_CHANGED; | 2674 | ALL_CHANGED; |
2675 | - screen_disp(&h3270); | 2675 | + h3270.display(&h3270); |
2676 | } | 2676 | } |
2677 | 2677 | ||
2678 | #if defined(X3270_DBCS) /*[*/ | 2678 | #if defined(X3270_DBCS) /*[*/ |
kybd.c
@@ -1721,7 +1721,7 @@ LIB3270_ACTION( delete ) | @@ -1721,7 +1721,7 @@ LIB3270_ACTION( delete ) | ||
1721 | if (!hSession->ea_buf[baddr].fa) | 1721 | if (!hSession->ea_buf[baddr].fa) |
1722 | cursor_move(hSession,baddr); | 1722 | cursor_move(hSession,baddr); |
1723 | } | 1723 | } |
1724 | - screen_disp(hSession); | 1724 | + hSession->display(hSession); |
1725 | return 0; | 1725 | return 0; |
1726 | } | 1726 | } |
1727 | 1727 | ||
@@ -1753,7 +1753,7 @@ LIB3270_ACTION( backspace ) | @@ -1753,7 +1753,7 @@ LIB3270_ACTION( backspace ) | ||
1753 | DEC_BA(baddr); | 1753 | DEC_BA(baddr); |
1754 | cursor_move(hSession,baddr); | 1754 | cursor_move(hSession,baddr); |
1755 | } | 1755 | } |
1756 | - screen_disp(hSession); | 1756 | + hSession->display(hSession); |
1757 | return 0; | 1757 | return 0; |
1758 | } | 1758 | } |
1759 | 1759 | ||
@@ -1815,7 +1815,7 @@ do_erase(void) | @@ -1815,7 +1815,7 @@ do_erase(void) | ||
1815 | cursor_move(&h3270,baddr); | 1815 | cursor_move(&h3270,baddr); |
1816 | (void) do_delete(); | 1816 | (void) do_delete(); |
1817 | } | 1817 | } |
1818 | - screen_disp(&h3270); | 1818 | + h3270.display(&h3270); |
1819 | } | 1819 | } |
1820 | 1820 | ||
1821 | LIB3270_ACTION( erase ) | 1821 | LIB3270_ACTION( erase ) |
@@ -2261,7 +2261,7 @@ LIB3270_ACTION( dup ) | @@ -2261,7 +2261,7 @@ LIB3270_ACTION( dup ) | ||
2261 | #endif | 2261 | #endif |
2262 | if (key_Character(EBC_dup, False, False, NULL)) | 2262 | if (key_Character(EBC_dup, False, False, NULL)) |
2263 | { | 2263 | { |
2264 | - screen_disp(hSession); | 2264 | + hSession->display(hSession); |
2265 | cursor_move(hSession,next_unprotected(hSession,hSession->cursor_addr)); | 2265 | cursor_move(hSession,next_unprotected(hSession,hSession->cursor_addr)); |
2266 | } | 2266 | } |
2267 | } | 2267 | } |
@@ -2527,7 +2527,7 @@ LIB3270_ACTION( eraseeol ) | @@ -2527,7 +2527,7 @@ LIB3270_ACTION( eraseeol ) | ||
2527 | h3270.ea_buf[h3270.cursor_addr].cc = EBC_si; | 2527 | h3270.ea_buf[h3270.cursor_addr].cc = EBC_si; |
2528 | } | 2528 | } |
2529 | (void) ctlr_dbcs_postprocess(); | 2529 | (void) ctlr_dbcs_postprocess(); |
2530 | - screen_disp(&h3270); | 2530 | + h3270.display(&h3270); |
2531 | return 0; | 2531 | return 0; |
2532 | } | 2532 | } |
2533 | 2533 | ||
@@ -2582,7 +2582,7 @@ LIB3270_ACTION( eraseeof ) | @@ -2582,7 +2582,7 @@ LIB3270_ACTION( eraseeof ) | ||
2582 | h3270.ea_buf[hSession->cursor_addr].cc = EBC_si; | 2582 | h3270.ea_buf[hSession->cursor_addr].cc = EBC_si; |
2583 | } | 2583 | } |
2584 | (void) ctlr_dbcs_postprocess(); | 2584 | (void) ctlr_dbcs_postprocess(); |
2585 | - screen_disp(hSession); | 2585 | + hSession->display(hSession); |
2586 | return 0; | 2586 | return 0; |
2587 | } | 2587 | } |
2588 | 2588 | ||
@@ -2637,7 +2637,7 @@ LIB3270_ACTION( eraseinput ) | @@ -2637,7 +2637,7 @@ LIB3270_ACTION( eraseinput ) | ||
2637 | ctlr_clear(hSession,True); | 2637 | ctlr_clear(hSession,True); |
2638 | cursor_move(hSession,0); | 2638 | cursor_move(hSession,0); |
2639 | } | 2639 | } |
2640 | - screen_disp(hSession); | 2640 | + hSession->display(hSession); |
2641 | return 0; | 2641 | return 0; |
2642 | } | 2642 | } |
2643 | 2643 | ||
@@ -2704,7 +2704,7 @@ LIB3270_ACTION( deleteword ) | @@ -2704,7 +2704,7 @@ LIB3270_ACTION( deleteword ) | ||
2704 | else | 2704 | else |
2705 | do_erase(); | 2705 | do_erase(); |
2706 | } | 2706 | } |
2707 | - screen_disp(hSession); | 2707 | + hSession->display(hSession); |
2708 | return 0; | 2708 | return 0; |
2709 | } | 2709 | } |
2710 | 2710 | ||
@@ -2752,7 +2752,7 @@ LIB3270_ACTION( deletefield ) | @@ -2752,7 +2752,7 @@ LIB3270_ACTION( deletefield ) | ||
2752 | ctlr_add(baddr, EBC_null, 0); | 2752 | ctlr_add(baddr, EBC_null, 0); |
2753 | INC_BA(baddr); | 2753 | INC_BA(baddr); |
2754 | } | 2754 | } |
2755 | - screen_disp(hSession); | 2755 | + hSession->display(hSession); |
2756 | return 0; | 2756 | return 0; |
2757 | } | 2757 | } |
2758 | 2758 | ||
@@ -3321,7 +3321,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | @@ -3321,7 +3321,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | ||
3321 | break; | 3321 | break; |
3322 | } | 3322 | } |
3323 | 3323 | ||
3324 | - screen_disp(session); | 3324 | + session->display(session); |
3325 | return len; | 3325 | return len; |
3326 | } | 3326 | } |
3327 | 3327 |
screen.c
@@ -80,7 +80,6 @@ static int (*popup_handler)(H3270 *, void *, LIB3270_NOTIFY, const char *, const | @@ -80,7 +80,6 @@ static int (*popup_handler)(H3270 *, void *, LIB3270_NOTIFY, const char *, const | ||
80 | 80 | ||
81 | enum ts { TS_AUTO, TS_ON, TS_OFF }; | 81 | enum ts { TS_AUTO, TS_ON, TS_OFF }; |
82 | 82 | ||
83 | -static void screen_update(H3270 *session, int bstart, int bend); | ||
84 | static void status_connect(H3270 *session, int ignored, void *dunno); | 83 | static void status_connect(H3270 *session, int ignored, void *dunno); |
85 | static void status_3270_mode(H3270 *session, int ignored, void *dunno); | 84 | static void status_3270_mode(H3270 *session, int ignored, void *dunno); |
86 | // static void status_printer(H3270 *session, int on, void *dunno); | 85 | // static void status_printer(H3270 *session, int on, void *dunno); |
@@ -290,7 +289,7 @@ LIB3270_EXPORT int lib3270_get_contents(H3270 *h, int first, int last, unsigned | @@ -290,7 +289,7 @@ LIB3270_EXPORT int lib3270_get_contents(H3270 *h, int first, int last, unsigned | ||
290 | } | 289 | } |
291 | 290 | ||
292 | /* Display what's in the buffer. */ | 291 | /* Display what's in the buffer. */ |
293 | -static void screen_update(H3270 *session, int bstart, int bend) | 292 | +void screen_update(H3270 *session, int bstart, int bend) |
294 | { | 293 | { |
295 | int baddr; | 294 | int baddr; |
296 | unsigned short a; | 295 | unsigned short a; |
@@ -368,12 +367,6 @@ static void screen_update(H3270 *session, int bstart, int bend) | @@ -368,12 +367,6 @@ static void screen_update(H3270 *session, int bstart, int bend) | ||
368 | trace("%s ends",__FUNCTION__); | 367 | trace("%s ends",__FUNCTION__); |
369 | } | 368 | } |
370 | 369 | ||
371 | -void screen_disp(H3270 *session) | ||
372 | -{ | ||
373 | - CHECK_SESSION_HANDLE(session); | ||
374 | - screen_update(session,0,session->rows*session->cols); | ||
375 | -} | ||
376 | - | ||
377 | LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h) | 370 | LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h) |
378 | { | 371 | { |
379 | CHECK_SESSION_HANDLE(h); | 372 | CHECK_SESSION_HANDLE(h); |
@@ -476,7 +469,7 @@ void status_reset(H3270 *session) | @@ -476,7 +469,7 @@ void status_reset(H3270 *session) | ||
476 | status_changed(session,LIB3270_STATUS_BLANK); | 469 | status_changed(session,LIB3270_STATUS_BLANK); |
477 | } | 470 | } |
478 | 471 | ||
479 | - screen_disp(session); | 472 | + session->display(session); |
480 | 473 | ||
481 | } | 474 | } |
482 | 475 | ||
@@ -789,7 +782,7 @@ LIB3270_ACTION( testpattern ) | @@ -789,7 +782,7 @@ LIB3270_ACTION( testpattern ) | ||
789 | hSession->ea_buf[f].cc = pat[row].cc[pos++]; | 782 | hSession->ea_buf[f].cc = pat[row].cc[pos++]; |
790 | } | 783 | } |
791 | 784 | ||
792 | - screen_disp(hSession); | 785 | + hSession->display(hSession); |
793 | 786 | ||
794 | return 0; | 787 | return 0; |
795 | } | 788 | } |
screen.h
@@ -16,10 +16,7 @@ | @@ -16,10 +16,7 @@ | ||
16 | 16 | ||
17 | // #define SELECTED(baddr) False | 17 | // #define SELECTED(baddr) False |
18 | LIB3270_INTERNAL int *char_width, *char_height; | 18 | LIB3270_INTERNAL int *char_width, *char_height; |
19 | -// LIB3270_INTERNAL Boolean screen_has_changes; | ||
20 | - | ||
21 | -// LIB3270_INTERNAL void screen_update(H3270 *session, int bstart, int bend); | ||
22 | 19 | ||
20 | +LIB3270_INTERNAL void screen_update(H3270 *session, int bstart, int bend); | ||
23 | LIB3270_INTERNAL void status_connecting(H3270 *session, Boolean on); | 21 | LIB3270_INTERNAL void status_connecting(H3270 *session, Boolean on); |
24 | -// LIB3270_INTERNAL void status_resolving(H3270 *session, Boolean on); | ||
25 | 22 |
screenc.h
@@ -22,17 +22,17 @@ | @@ -22,17 +22,17 @@ | ||
22 | #define display_widthMM() 100 | 22 | #define display_widthMM() 100 |
23 | #define display_width() 1 | 23 | #define display_width() 1 |
24 | // #define screen_obscured() False | 24 | // #define screen_obscured() False |
25 | -#define screen_scroll() screen_disp() | 25 | +// #define screen_scroll() screen_disp() |
26 | #define screen_132() /* */ | 26 | #define screen_132() /* */ |
27 | #define screen_80() /* */ | 27 | #define screen_80() /* */ |
28 | 28 | ||
29 | -#define screen_erase(x) x->erase(x) | 29 | +// #define screen_erase(x) x->erase(x) |
30 | // LIB3270_INTERNAL void screen_erase(H3270 *session); | 30 | // LIB3270_INTERNAL void screen_erase(H3270 *session); |
31 | 31 | ||
32 | -LIB3270_INTERNAL void screen_changed(H3270 *session, int bstart, int bend); | 32 | +// LIB3270_INTERNAL void screen_changed(H3270 *session, int bstart, int bend); |
33 | LIB3270_INTERNAL int screen_init(H3270 *session); | 33 | LIB3270_INTERNAL int screen_init(H3270 *session); |
34 | // LIB3270_INTERNAL void screen_flip(void); | 34 | // LIB3270_INTERNAL void screen_flip(void); |
35 | -LIB3270_INTERNAL FILE *start_pager(void); | 35 | +// LIB3270_INTERNAL FILE *start_pager(void); |
36 | LIB3270_INTERNAL Boolean screen_new_display_charsets(char *cslist, char *csname); | 36 | LIB3270_INTERNAL Boolean screen_new_display_charsets(char *cslist, char *csname); |
37 | 37 | ||
38 | LIB3270_INTERNAL void mcursor_set(H3270 *session,LIB3270_CURSOR m); | 38 | LIB3270_INTERNAL void mcursor_set(H3270 *session,LIB3270_CURSOR m); |
session.c
@@ -139,6 +139,12 @@ static void update_ssl(H3270 *session, LIB3270_SSL_STATE state) | @@ -139,6 +139,12 @@ static void update_ssl(H3270 *session, LIB3270_SSL_STATE state) | ||
139 | { | 139 | { |
140 | } | 140 | } |
141 | 141 | ||
142 | +static void screen_disp(H3270 *session) | ||
143 | +{ | ||
144 | + CHECK_SESSION_HANDLE(session); | ||
145 | + screen_update(session,0,session->rows*session->cols); | ||
146 | +} | ||
147 | + | ||
142 | static void lib3270_session_init(H3270 *hSession, const char *model) | 148 | static void lib3270_session_init(H3270 *hSession, const char *model) |
143 | { | 149 | { |
144 | int ovc, ovr; | 150 | int ovc, ovr; |
@@ -148,6 +154,23 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | @@ -148,6 +154,23 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | ||
148 | memset(hSession,0,sizeof(H3270)); | 154 | memset(hSession,0,sizeof(H3270)); |
149 | hSession->sz = sizeof(H3270); | 155 | hSession->sz = sizeof(H3270); |
150 | 156 | ||
157 | + // Default calls | ||
158 | + hSession->update = update_char; | ||
159 | + hSession->update_model = update_model; | ||
160 | + hSession->update_cursor = update_cursor; | ||
161 | + hSession->set_selection = nop_char; | ||
162 | + hSession->ctlr_done = nop; | ||
163 | + hSession->changed = changed; | ||
164 | + hSession->erase = screen_disp; | ||
165 | + hSession->suspend = nop; | ||
166 | + hSession->resume = screen_disp; | ||
167 | + hSession->update_oia = update_oia; | ||
168 | + hSession->update_selection = update_selection; | ||
169 | + hSession->cursor = set_cursor; | ||
170 | + hSession->message = message; | ||
171 | + hSession->update_ssl = update_ssl; | ||
172 | + hSession->display = screen_disp; | ||
173 | + | ||
151 | // Set the defaults. | 174 | // Set the defaults. |
152 | hSession->extended = 1; | 175 | hSession->extended = 1; |
153 | hSession->typeahead = 1; | 176 | hSession->typeahead = 1; |
@@ -156,6 +179,16 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | @@ -156,6 +179,16 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | ||
156 | hSession->icrnl = 1; | 179 | hSession->icrnl = 1; |
157 | hSession->onlcr = 1; | 180 | hSession->onlcr = 1; |
158 | hSession->host_charset = "bracket"; | 181 | hSession->host_charset = "bracket"; |
182 | + hSession->sock = -1; | ||
183 | + hSession->model_num = -1; | ||
184 | + hSession->cstate = LIB3270_NOT_CONNECTED; | ||
185 | + hSession->oia_status = -1; | ||
186 | + | ||
187 | + | ||
188 | +#ifdef _WIN32 | ||
189 | + hSession->sockEvent = NULL; | ||
190 | +#endif // _WIN32 | ||
191 | + | ||
159 | 192 | ||
160 | /* | 193 | /* |
161 | #if !defined(_WIN32) | 194 | #if !defined(_WIN32) |
@@ -173,31 +206,6 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | @@ -173,31 +206,6 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | ||
173 | // Initialize toggles | 206 | // Initialize toggles |
174 | initialize_toggles(hSession); | 207 | initialize_toggles(hSession); |
175 | 208 | ||
176 | - // Dummy calls to avoid "ifs" | ||
177 | - hSession->update = update_char; | ||
178 | - hSession->update_model = update_model; | ||
179 | - hSession->update_cursor = update_cursor; | ||
180 | - hSession->set_selection = nop_char; | ||
181 | - hSession->ctlr_done = nop; | ||
182 | - hSession->changed = changed; | ||
183 | - hSession->erase = screen_disp; | ||
184 | - hSession->suspend = nop; | ||
185 | - hSession->resume = screen_disp; | ||
186 | - hSession->update_oia = update_oia; | ||
187 | - hSession->update_selection = update_selection; | ||
188 | - hSession->cursor = set_cursor; | ||
189 | - hSession->message = message; | ||
190 | - hSession->update_ssl = update_ssl; | ||
191 | - hSession->sock = -1; | ||
192 | - | ||
193 | -#ifdef _WIN32 | ||
194 | - hSession->sockEvent = NULL; | ||
195 | -#endif // _WIN32 | ||
196 | - | ||
197 | - hSession->model_num = -1; | ||
198 | - hSession->cstate = NOT_CONNECTED; | ||
199 | - hSession->oia_status = -1; | ||
200 | - | ||
201 | strncpy(hSession->full_model_name,"IBM-",LIB3270_FULL_MODEL_NAME_LENGTH); | 209 | strncpy(hSession->full_model_name,"IBM-",LIB3270_FULL_MODEL_NAME_LENGTH); |
202 | hSession->model_name = &hSession->full_model_name[4]; | 210 | hSession->model_name = &hSession->full_model_name[4]; |
203 | 211 |
toggles.c
@@ -140,7 +140,7 @@ LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix) | @@ -140,7 +140,7 @@ LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix) | ||
140 | 140 | ||
141 | static void toggle_monocase(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt) | 141 | static void toggle_monocase(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt) |
142 | { | 142 | { |
143 | - screen_disp(session); | 143 | + session->display(session); |
144 | } | 144 | } |
145 | 145 | ||
146 | /* | 146 | /* |