Commit 4fd1f48a1ec090a7f87063d576a204d742f499d1

Authored by perry.werneck@gmail.com
1 parent 62840312

Android - Permitindo substituição do método de desenho da tela

src/include/lib3270/session.h
... ... @@ -191,6 +191,7 @@
191 191 void (*configure)(H3270 *session, unsigned short rows, unsigned short cols);
192 192 void (*update)(H3270 *session, int baddr, unsigned char c, unsigned short attr, unsigned char cursor);
193 193 void (*changed)(H3270 *session, int offset, int len);
  194 + void (*display)(H3270 *session);
194 195  
195 196 void (*update_cursor)(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr);
196 197 void (*update_oia)(H3270 *session, LIB3270_FLAG id, unsigned char on);
... ...
src/lib3270/api.h
... ... @@ -388,7 +388,7 @@
388 388 /* Screen calls */
389 389 // LOCAL_EXTERN void screen_resume(H3270 *session);
390 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 393 #include <lib3270/actions.h>
394 394  
... ...
src/lib3270/ctlr.c
... ... @@ -459,7 +459,7 @@ void ctlr_erase(H3270 *session, int alt)
459 459  
460 460 kybd_inhibit(False);
461 461 ctlr_clear(session,True);
462   - screen_erase(session);
  462 + session->erase(session);
463 463  
464 464 if(alt == session->screen_alt)
465 465 return;
... ... @@ -467,7 +467,7 @@ void ctlr_erase(H3270 *session, int alt)
467 467 if (alt)
468 468 {
469 469 /* Going from 24x80 to maximum. */
470   - screen_disp(session);
  470 + session->display(session);
471 471 set_viewsize(session,session->maxROWS,session->maxCOLS);
472 472 }
473 473 else
... ... @@ -478,7 +478,7 @@ void ctlr_erase(H3270 *session, int alt)
478 478 if(session->vcontrol)
479 479 {
480 480 ctlr_blanks();
481   - screen_disp(session);
  481 + session->display(session);
482 482 }
483 483 set_viewsize(session,24,80);
484 484 }
... ... @@ -2574,7 +2574,7 @@ void ctlr_scroll(void)
2574 2574 /* Clear the last line. */
2575 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 2580 #endif /*]*/
... ... @@ -2672,7 +2672,7 @@ ctlr_shrink(void)
2672 2672 h3270.ea_buf[baddr].cc = h3270.vcontrol ? EBC_space : EBC_null;
2673 2673 }
2674 2674 ALL_CHANGED;
2675   - screen_disp(&h3270);
  2675 + h3270.display(&h3270);
2676 2676 }
2677 2677  
2678 2678 #if defined(X3270_DBCS) /*[*/
... ...
src/lib3270/kybd.c
... ... @@ -1721,7 +1721,7 @@ LIB3270_ACTION( delete )
1721 1721 if (!hSession->ea_buf[baddr].fa)
1722 1722 cursor_move(hSession,baddr);
1723 1723 }
1724   - screen_disp(hSession);
  1724 + hSession->display(hSession);
1725 1725 return 0;
1726 1726 }
1727 1727  
... ... @@ -1753,7 +1753,7 @@ LIB3270_ACTION( backspace )
1753 1753 DEC_BA(baddr);
1754 1754 cursor_move(hSession,baddr);
1755 1755 }
1756   - screen_disp(hSession);
  1756 + hSession->display(hSession);
1757 1757 return 0;
1758 1758 }
1759 1759  
... ... @@ -1815,7 +1815,7 @@ do_erase(void)
1815 1815 cursor_move(&h3270,baddr);
1816 1816 (void) do_delete();
1817 1817 }
1818   - screen_disp(&h3270);
  1818 + h3270.display(&h3270);
1819 1819 }
1820 1820  
1821 1821 LIB3270_ACTION( erase )
... ... @@ -2261,7 +2261,7 @@ LIB3270_ACTION( dup )
2261 2261 #endif
2262 2262 if (key_Character(EBC_dup, False, False, NULL))
2263 2263 {
2264   - screen_disp(hSession);
  2264 + hSession->display(hSession);
2265 2265 cursor_move(hSession,next_unprotected(hSession,hSession->cursor_addr));
2266 2266 }
2267 2267 }
... ... @@ -2527,7 +2527,7 @@ LIB3270_ACTION( eraseeol )
2527 2527 h3270.ea_buf[h3270.cursor_addr].cc = EBC_si;
2528 2528 }
2529 2529 (void) ctlr_dbcs_postprocess();
2530   - screen_disp(&h3270);
  2530 + h3270.display(&h3270);
2531 2531 return 0;
2532 2532 }
2533 2533  
... ... @@ -2582,7 +2582,7 @@ LIB3270_ACTION( eraseeof )
2582 2582 h3270.ea_buf[hSession->cursor_addr].cc = EBC_si;
2583 2583 }
2584 2584 (void) ctlr_dbcs_postprocess();
2585   - screen_disp(hSession);
  2585 + hSession->display(hSession);
2586 2586 return 0;
2587 2587 }
2588 2588  
... ... @@ -2637,7 +2637,7 @@ LIB3270_ACTION( eraseinput )
2637 2637 ctlr_clear(hSession,True);
2638 2638 cursor_move(hSession,0);
2639 2639 }
2640   - screen_disp(hSession);
  2640 + hSession->display(hSession);
2641 2641 return 0;
2642 2642 }
2643 2643  
... ... @@ -2704,7 +2704,7 @@ LIB3270_ACTION( deleteword )
2704 2704 else
2705 2705 do_erase();
2706 2706 }
2707   - screen_disp(hSession);
  2707 + hSession->display(hSession);
2708 2708 return 0;
2709 2709 }
2710 2710  
... ... @@ -2752,7 +2752,7 @@ LIB3270_ACTION( deletefield )
2752 2752 ctlr_add(baddr, EBC_null, 0);
2753 2753 INC_BA(baddr);
2754 2754 }
2755   - screen_disp(hSession);
  2755 + hSession->display(hSession);
2756 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 3321 break;
3322 3322 }
3323 3323  
3324   - screen_disp(session);
  3324 + session->display(session);
3325 3325 return len;
3326 3326 }
3327 3327  
... ...
src/lib3270/screen.c
... ... @@ -80,7 +80,6 @@ static int (*popup_handler)(H3270 *, void *, LIB3270_NOTIFY, const char *, const
80 80  
81 81 enum ts { TS_AUTO, TS_ON, TS_OFF };
82 82  
83   -static void screen_update(H3270 *session, int bstart, int bend);
84 83 static void status_connect(H3270 *session, int ignored, void *dunno);
85 84 static void status_3270_mode(H3270 *session, int ignored, void *dunno);
86 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 289 }
291 290  
292 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 294 int baddr;
296 295 unsigned short a;
... ... @@ -368,12 +367,6 @@ static void screen_update(H3270 *session, int bstart, int bend)
368 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 370 LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h)
378 371 {
379 372 CHECK_SESSION_HANDLE(h);
... ... @@ -476,7 +469,7 @@ void status_reset(H3270 *session)
476 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 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 787 return 0;
795 788 }
... ...
src/lib3270/screen.h
... ... @@ -16,10 +16,7 @@
16 16  
17 17 // #define SELECTED(baddr) False
18 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 21 LIB3270_INTERNAL void status_connecting(H3270 *session, Boolean on);
24   -// LIB3270_INTERNAL void status_resolving(H3270 *session, Boolean on);
25 22  
... ...
src/lib3270/screenc.h
... ... @@ -22,17 +22,17 @@
22 22 #define display_widthMM() 100
23 23 #define display_width() 1
24 24 // #define screen_obscured() False
25   -#define screen_scroll() screen_disp()
  25 +// #define screen_scroll() screen_disp()
26 26 #define screen_132() /* */
27 27 #define screen_80() /* */
28 28  
29   -#define screen_erase(x) x->erase(x)
  29 +// #define screen_erase(x) x->erase(x)
30 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 33 LIB3270_INTERNAL int screen_init(H3270 *session);
34 34 // LIB3270_INTERNAL void screen_flip(void);
35   -LIB3270_INTERNAL FILE *start_pager(void);
  35 +// LIB3270_INTERNAL FILE *start_pager(void);
36 36 LIB3270_INTERNAL Boolean screen_new_display_charsets(char *cslist, char *csname);
37 37  
38 38 LIB3270_INTERNAL void mcursor_set(H3270 *session,LIB3270_CURSOR m);
... ...
src/lib3270/session.c
... ... @@ -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 148 static void lib3270_session_init(H3270 *hSession, const char *model)
143 149 {
144 150 int ovc, ovr;
... ... @@ -148,6 +154,23 @@ static void lib3270_session_init(H3270 *hSession, const char *model)
148 154 memset(hSession,0,sizeof(H3270));
149 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 174 // Set the defaults.
152 175 hSession->extended = 1;
153 176 hSession->typeahead = 1;
... ... @@ -156,6 +179,16 @@ static void lib3270_session_init(H3270 *hSession, const char *model)
156 179 hSession->icrnl = 1;
157 180 hSession->onlcr = 1;
158 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 194 #if !defined(_WIN32)
... ... @@ -173,31 +206,6 @@ static void lib3270_session_init(H3270 *hSession, const char *model)
173 206 // Initialize toggles
174 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 209 strncpy(hSession->full_model_name,"IBM-",LIB3270_FULL_MODEL_NAME_LENGTH);
202 210 hSession->model_name = &hSession->full_model_name[4];
203 211  
... ...
src/lib3270/toggles.c
... ... @@ -140,7 +140,7 @@ LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix)
140 140  
141 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 /*
... ...
src/pw3270/filetransfer.c
... ... @@ -538,7 +538,7 @@ static void run_ft_dialog(GObject *action, GtkWidget *widget, struct ftdialog *d
538 538 g_object_set_data(G_OBJECT(ftdialog),"progress",progress);
539 539  
540 540 gtk_container_set_border_width(GTK_CONTAINER(frame),3);
541   - gtk_container_set_border_width(GTK_CONTAINER(table),6);
  541 +// gtk_container_set_border_width(GTK_CONTAINER(table),6);
542 542  
543 543 for(f=0;f<2;f++)
544 544 {
... ... @@ -572,6 +572,7 @@ static void run_ft_dialog(GObject *action, GtkWidget *widget, struct ftdialog *d
572 572  
573 573 entry[pos] = gtk_label_new(_("N/A" ));
574 574 gtk_misc_set_alignment(GTK_MISC(entry[f]),0,0);
  575 + gtk_table_attach(GTK_TABLE(table),entry[pos],3,4,f,f+1,GTK_EXPAND,GTK_FILL,2,2);
575 576  
576 577 gtk_label_set_mnemonic_widget(GTK_LABEL(label),entry[pos++]);
577 578  
... ...