Commit 0990cbdb0ffe869eb47115bc9f65aa0986bd6241
1 parent
508b50d8
Exists in
master
and in
5 other branches
Migrando mais campos de configuração para a estrutura de controle de sessão
Showing
9 changed files
with
49 additions
and
39 deletions
Show diff stats
src/include/lib3270/session.h
| ... | ... | @@ -77,10 +77,12 @@ |
| 77 | 77 | LIB3270_CSTATE cstate; /**< Connection state */ |
| 78 | 78 | |
| 79 | 79 | // flags |
| 80 | - int bgthread : 1; /**< Running on a background thread ? */ | |
| 81 | - int selected : 1; /**< Has selected region? */ | |
| 82 | - int rectsel : 1; /**< Selected region is a rectangle ? */ | |
| 83 | - int vcontrol : 1; /**< Visible control ? */ | |
| 80 | + int bgthread : 1; /**< Running on a background thread ? */ | |
| 81 | + int selected : 1; /**< Has selected region? */ | |
| 82 | + int rectsel : 1; /**< Selected region is a rectangle ? */ | |
| 83 | + int vcontrol : 1; /**< Visible control ? */ | |
| 84 | + int modified_sel : 1; | |
| 85 | + int m3279 : 1; | |
| 84 | 86 | |
| 85 | 87 | |
| 86 | 88 | LIB3270_SSL_STATE secure; | ... | ... |
src/lib3270/appres.h
src/lib3270/ctlr.c
| ... | ... | @@ -1198,7 +1198,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) |
| 1198 | 1198 | trace_ds("%sresetMDT", paren); |
| 1199 | 1199 | paren = ","; |
| 1200 | 1200 | baddr = 0; |
| 1201 | - if (appres.modified_sel) | |
| 1201 | + if (h3270.modified_sel) | |
| 1202 | 1202 | ALL_CHANGED; |
| 1203 | 1203 | do { |
| 1204 | 1204 | if (h3270.ea_buf[baddr].fa) { |
| ... | ... | @@ -1485,14 +1485,14 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) |
| 1485 | 1485 | see_efa(*cp, |
| 1486 | 1486 | *(cp + 1))); |
| 1487 | 1487 | cp++; |
| 1488 | - if (appres.m3279) | |
| 1488 | + if (h3270.m3279) | |
| 1489 | 1489 | ctlr_add_fg(h3270.buffer_addr, *cp); |
| 1490 | 1490 | } else if (*cp == XA_BACKGROUND) { |
| 1491 | 1491 | trace_ds("%s", |
| 1492 | 1492 | see_efa(*cp, |
| 1493 | 1493 | *(cp + 1))); |
| 1494 | 1494 | cp++; |
| 1495 | - if (appres.m3279) | |
| 1495 | + if (h3270.m3279) | |
| 1496 | 1496 | ctlr_add_bg(h3270.buffer_addr, *cp); |
| 1497 | 1497 | } else if (*cp == XA_HIGHLIGHTING) { |
| 1498 | 1498 | trace_ds("%s", |
| ... | ... | @@ -1558,12 +1558,12 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) |
| 1558 | 1558 | } else if (*cp == XA_FOREGROUND) { |
| 1559 | 1559 | trace_ds("%s", see_efa(*cp, *(cp + 1))); |
| 1560 | 1560 | cp++; |
| 1561 | - if (appres.m3279) | |
| 1561 | + if (h3270.m3279) | |
| 1562 | 1562 | efa_fg = *cp; |
| 1563 | 1563 | } else if (*cp == XA_BACKGROUND) { |
| 1564 | 1564 | trace_ds("%s", see_efa(*cp, *(cp + 1))); |
| 1565 | 1565 | cp++; |
| 1566 | - if (appres.m3279) | |
| 1566 | + if (h3270.m3279) | |
| 1567 | 1567 | efa_bg = *cp; |
| 1568 | 1568 | } else if (*cp == XA_HIGHLIGHTING) { |
| 1569 | 1569 | trace_ds("%s", see_efa(*cp, *(cp + 1))); |
| ... | ... | @@ -1608,11 +1608,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) |
| 1608 | 1608 | cp++; |
| 1609 | 1609 | if (*cp == XA_FOREGROUND) { |
| 1610 | 1610 | trace_ds("%s", see_efa(*cp, *(cp + 1))); |
| 1611 | - if (appres.m3279) | |
| 1611 | + if (h3270.m3279) | |
| 1612 | 1612 | default_fg = *(cp + 1); |
| 1613 | 1613 | } else if (*cp == XA_BACKGROUND) { |
| 1614 | 1614 | trace_ds("%s", see_efa(*cp, *(cp + 1))); |
| 1615 | - if (appres.m3279) | |
| 1615 | + if (h3270.m3279) | |
| 1616 | 1616 | default_bg = *(cp + 1); |
| 1617 | 1617 | } else if (*cp == XA_HIGHLIGHTING) { |
| 1618 | 1618 | trace_ds("%s", see_efa(*cp, *(cp + 1))); |
| ... | ... | @@ -2446,7 +2446,7 @@ ctlr_add_gr(int baddr, unsigned char gr) |
| 2446 | 2446 | void |
| 2447 | 2447 | ctlr_add_fg(int baddr, unsigned char color) |
| 2448 | 2448 | { |
| 2449 | - if (!appres.m3279) | |
| 2449 | + if (!h3270.m3279) | |
| 2450 | 2450 | return; |
| 2451 | 2451 | if ((color & 0xf0) != 0xf0) |
| 2452 | 2452 | color = 0; |
| ... | ... | @@ -2463,7 +2463,7 @@ ctlr_add_fg(int baddr, unsigned char color) |
| 2463 | 2463 | void |
| 2464 | 2464 | ctlr_add_bg(int baddr, unsigned char color) |
| 2465 | 2465 | { |
| 2466 | - if (!appres.m3279) | |
| 2466 | + if (!h3270.m3279) | |
| 2467 | 2467 | return; |
| 2468 | 2468 | if ((color & 0xf0) != 0xf0) |
| 2469 | 2469 | color = 0; |
| ... | ... | @@ -2639,7 +2639,7 @@ mdt_set(int baddr) |
| 2639 | 2639 | faddr = find_field_attribute(&h3270,baddr); |
| 2640 | 2640 | if (faddr >= 0 && !(h3270.ea_buf[faddr].fa & FA_MODIFY)) { |
| 2641 | 2641 | h3270.ea_buf[faddr].fa |= FA_MODIFY; |
| 2642 | - if (appres.modified_sel) | |
| 2642 | + if (h3270.modified_sel) | |
| 2643 | 2643 | ALL_CHANGED; |
| 2644 | 2644 | } |
| 2645 | 2645 | } |
| ... | ... | @@ -2652,7 +2652,7 @@ mdt_clear(int baddr) |
| 2652 | 2652 | faddr = find_field_attribute(&h3270,baddr); |
| 2653 | 2653 | if (faddr >= 0 && (h3270.ea_buf[faddr].fa & FA_MODIFY)) { |
| 2654 | 2654 | h3270.ea_buf[faddr].fa &= ~FA_MODIFY; |
| 2655 | - if (appres.modified_sel) | |
| 2655 | + if (h3270.modified_sel) | |
| 2656 | 2656 | ALL_CHANGED; |
| 2657 | 2657 | } |
| 2658 | 2658 | } | ... | ... |
src/lib3270/glue.c
| ... | ... | @@ -139,12 +139,10 @@ static void initialize(void) |
| 139 | 139 | appres.extended = True; |
| 140 | 140 | |
| 141 | 141 | #if defined(C3270) /*[*/ |
| 142 | - appres.m3279 = True; | |
| 143 | -#else /*][*/ | |
| 144 | - appres.m3279 = False; | |
| 142 | + h3270.m3279 = True; | |
| 145 | 143 | #endif /*]*/ |
| 146 | 144 | |
| 147 | - appres.modified_sel = False; | |
| 145 | +// appres.modified_sel = False; | |
| 148 | 146 | appres.apl_mode = False; |
| 149 | 147 | |
| 150 | 148 | /* |
| ... | ... | @@ -430,9 +428,9 @@ static struct { |
| 430 | 428 | { ResLnext, offset(lnext), XRM_STRING }, |
| 431 | 429 | #endif /*]*/ |
| 432 | 430 | { ResLoginMacro,offset(login_macro), XRM_STRING }, |
| 433 | - { ResM3279, offset(m3279), XRM_BOOLEAN }, | |
| 431 | +// { ResM3279, offset(m3279), XRM_BOOLEAN }, | |
| 434 | 432 | // { ResModel, offset(model), XRM_STRING }, |
| 435 | - { ResModifiedSel, offset(modified_sel), XRM_BOOLEAN }, | |
| 433 | +// { ResModifiedSel, offset(modified_sel), XRM_BOOLEAN }, | |
| 436 | 434 | #if defined(C3270) && !defined(_WIN32) /*[*/ |
| 437 | 435 | { ResMono, offset(mono), XRM_BOOLEAN }, |
| 438 | 436 | #endif /*]*/ | ... | ... |
src/lib3270/init.c
| ... | ... | @@ -184,13 +184,15 @@ static void lib3270_session_init(H3270 *hSession, const char *model) |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | if(appres.mono) |
| 187 | - appres.m3279 = False; | |
| 187 | + hSession->m3279 = 0; | |
| 188 | + else | |
| 189 | + hSession->m3279 = 1; | |
| 188 | 190 | |
| 189 | 191 | if(!appres.extended) |
| 190 | 192 | appres.oversize = CN; |
| 191 | 193 | |
| 192 | 194 | #if defined(RESTRICT_3279) |
| 193 | - if (appres.m3279 && model_number == 4) | |
| 195 | + if (hSession->m3279 && model_number == 4) | |
| 194 | 196 | model_number = 3; |
| 195 | 197 | #endif |
| 196 | 198 | |
| ... | ... | @@ -285,11 +287,16 @@ static int parse_model_number(H3270 *session, const char *m) |
| 285 | 287 | * If it's longer than one character, it needs to start with |
| 286 | 288 | * '327[89]', and it sets the m3279 resource. |
| 287 | 289 | */ |
| 288 | - if (!strncmp(m, "3278", 4)) { | |
| 289 | - appres.m3279 = False; | |
| 290 | - } else if (!strncmp(m, "3279", 4)) { | |
| 291 | - appres.m3279 = True; | |
| 292 | - } else { | |
| 290 | + if (!strncmp(m, "3278", 4)) | |
| 291 | + { | |
| 292 | + session->m3279 = 0; | |
| 293 | + } | |
| 294 | + else if (!strncmp(m, "3279", 4)) | |
| 295 | + { | |
| 296 | + session->m3279 = 1; | |
| 297 | + } | |
| 298 | + else | |
| 299 | + { | |
| 293 | 300 | return -1; |
| 294 | 301 | } |
| 295 | 302 | m += 4; | ... | ... |
src/lib3270/proxy.c
src/lib3270/screen.c
| ... | ... | @@ -148,7 +148,7 @@ int screen_init(H3270 *session) |
| 148 | 148 | /* Map a field attribute to its default colors. */ |
| 149 | 149 | static unsigned short color_from_fa(unsigned char fa) |
| 150 | 150 | { |
| 151 | - if (appres.m3279) | |
| 151 | + if (h3270.m3279) | |
| 152 | 152 | return get_color_pair(DEFCOLOR_MAP(fa),0) | COLOR_ATTR_FIELD; |
| 153 | 153 | |
| 154 | 154 | // Green on black |
| ... | ... | @@ -166,7 +166,7 @@ static unsigned short calc_attrs(H3270 *session, int baddr, int fa_addr, int fa) |
| 166 | 166 | /* Compute the color. */ |
| 167 | 167 | |
| 168 | 168 | /* Monochrome is easy, and so is color if nothing is specified. */ |
| 169 | - if (!appres.m3279 || | |
| 169 | + if (!h3270.m3279 || | |
| 170 | 170 | (!session->ea_buf[baddr].fg && |
| 171 | 171 | !session->ea_buf[fa_addr].fg && |
| 172 | 172 | !session->ea_buf[baddr].bg && |
| ... | ... | @@ -219,10 +219,10 @@ static unsigned short calc_attrs(H3270 *session, int baddr, int fa_addr, int fa) |
| 219 | 219 | a |= LIB3270_ATTR_UNDERLINE; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if(appres.m3279 && (gr & (GR_BLINK | GR_UNDERLINE)) && !(gr & GR_REVERSE) && !bg) | |
| 222 | + if(h3270.m3279 && (gr & (GR_BLINK | GR_UNDERLINE)) && !(gr & GR_REVERSE) && !bg) | |
| 223 | 223 | a |= LIB3270_ATTR_BACKGROUND_INTENSITY; |
| 224 | 224 | |
| 225 | - if(!appres.m3279 && ((gr & GR_INTENSIFY) || FA_IS_HIGH(fa))) | |
| 225 | + if(!h3270.m3279 && ((gr & GR_INTENSIFY) || FA_IS_HIGH(fa))) | |
| 226 | 226 | a |= LIB3270_ATTR_INTENSIFY; |
| 227 | 227 | |
| 228 | 228 | if (gr & GR_REVERSE) |
| ... | ... | @@ -260,7 +260,7 @@ void update_model_info(H3270 *session, int model, int cols, int rows) |
| 260 | 260 | session->model_num = model; |
| 261 | 261 | |
| 262 | 262 | /* Update the model name. */ |
| 263 | - (void) sprintf(session->model_name, "327%c-%d%s",appres.m3279 ? '9' : '8',session->model_num,appres.extended ? "-E" : ""); | |
| 263 | + (void) sprintf(session->model_name, "327%c-%d%s",session->m3279 ? '9' : '8',session->model_num,appres.extended ? "-E" : ""); | |
| 264 | 264 | |
| 265 | 265 | session->update_model(session, session->model_name,session->model_num,rows,cols); |
| 266 | 266 | } | ... | ... |
src/lib3270/sf.c
| ... | ... | @@ -770,7 +770,7 @@ do_qr_color(void) |
| 770 | 770 | *obptr++ = 0xf0 + COLOR_GREEN; /* green */ |
| 771 | 771 | for (i = 0xf1; i < 0xf1 + color_max - 1; i++) { |
| 772 | 772 | *obptr++ = i; |
| 773 | - if (appres.m3279) | |
| 773 | + if (h3270.m3279) | |
| 774 | 774 | *obptr++ = i; |
| 775 | 775 | else |
| 776 | 776 | *obptr++ = 0x00; |
| ... | ... | @@ -779,7 +779,7 @@ do_qr_color(void) |
| 779 | 779 | /* |
| 780 | 780 | #if !defined(X3270_DISPLAY) |
| 781 | 781 | // Add background color. |
| 782 | - if (appres.m3279) { | |
| 782 | + if (h3270.m3279) { | |
| 783 | 783 | space3270out(4); |
| 784 | 784 | *obptr++ = 4; // length |
| 785 | 785 | *obptr++ = 0x02; // background color | ... | ... |
src/lib3270/telnet.c
| ... | ... | @@ -677,8 +677,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo |
| 677 | 677 | /* set up temporary termtype */ |
| 678 | 678 | if (appres.termname == CN && session->std_ds_host) |
| 679 | 679 | { |
| 680 | - (void) sprintf(ttype_tmpval, "IBM-327%c-%d", | |
| 681 | - appres.m3279 ? '9' : '8', session->model_num); | |
| 680 | + (void) sprintf(ttype_tmpval, "IBM-327%c-%d",session->m3279 ? '9' : '8', session->model_num); | |
| 682 | 681 | session->termtype = ttype_tmpval; |
| 683 | 682 | } |
| 684 | 683 | ... | ... |