Commit 6485411de0b30ebbbab8fe9b91d1b3eda3611083
1 parent
b57a46c3
Exists in
master
and in
5 other branches
Corrigindo problema no sublinhado...
Fórum: PW3270 Suporte Thread: Sublinhado Versão 5.0 Último Post: David Dourado Enviados: 2013-01-09 18:35:31.386784-02 Caros, Ao instalar a versão 5.0 (GTK 3.6) no Windows 7 64 bits percebemos que os inputs não tem o sublinhado. Resolvemos instalar a versão 4.2 e percebemos que funcionou perfeitamente. P.S.: Não tentamos instalar a versão 5 em outros ambientes. Isto é um novo comportamento padrão ou há um problema?
Showing
5 changed files
with
44 additions
and
51 deletions
Show diff stats
src/include/lib3270.h
| ... | ... | @@ -110,7 +110,7 @@ |
| 110 | 110 | LIB3270_TOGGLE_SMART_PASTE, |
| 111 | 111 | LIB3270_TOGGLE_BOLD, |
| 112 | 112 | LIB3270_TOGGLE_KEEP_SELECTED, |
| 113 | - LIB3270_TOGGLE_UNDERLINE, | |
| 113 | + LIB3270_TOGGLE_UNDERLINE, /**< Show underline ? */ | |
| 114 | 114 | LIB3270_TOGGLE_CONNECT_ON_STARTUP, |
| 115 | 115 | LIB3270_TOGGLE_KP_ALTERNATIVE, /**< Keypad +/- move to next/previous field */ |
| 116 | 116 | LIB3270_TOGGLE_BEEP, /**< Beep on errors */ | ... | ... |
src/lib3270/api.h
| ... | ... | @@ -291,39 +291,11 @@ |
| 291 | 291 | #define COLOR_ATTR_NONE 0x0000 |
| 292 | 292 | #define COLOR_ATTR_FIELD LIB3270_ATTR_FIELD |
| 293 | 293 | #define COLOR_ATTR_BLINK LIB3270_ATTR_BLINK |
| 294 | - #define COLOR_ATTR_UNDERLINE LIB3270_ATTR_UNDERLINE | |
| 294 | +// #define COLOR_ATTR_UNDERLINE LIB3270_ATTR_UNDERLINE | |
| 295 | 295 | #define COLOR_ATTR_INTENSIFY LIB3270_ATTR_INTENSIFY |
| 296 | 296 | |
| 297 | -// #define CHAR_ATTR_CG LIB3270_ATTR_CG | |
| 298 | -// #define CHAR_ATTR_MARKER LIB3270_ATTR_MARKER | |
| 299 | - | |
| 300 | 297 | #define CHAR_ATTR_UNCONVERTED LIB3270_ATTR_CG |
| 301 | 298 | |
| 302 | -/* | |
| 303 | - struct _lib3270_option | |
| 304 | - { | |
| 305 | - const char *name; | |
| 306 | - enum | |
| 307 | - { | |
| 308 | - OPT_BOOLEAN, | |
| 309 | - OPT_STRING, | |
| 310 | - OPT_INTEGER, | |
| 311 | - OPT_XRM, | |
| 312 | - OPT_SKIP2, | |
| 313 | - OPT_NOP, | |
| 314 | - OPT_DONE | |
| 315 | - } type; | |
| 316 | - unsigned char flag; | |
| 317 | - const char *res_name; | |
| 318 | - void *aoff; | |
| 319 | - const char *description; | |
| 320 | - }; | |
| 321 | - | |
| 322 | - #define new_3270_session(m) lib3270_session_new(m) | |
| 323 | - | |
| 324 | - LOCAL_EXTERN const struct _lib3270_option * get_3270_option_table(int sz); | |
| 325 | -*/ | |
| 326 | - | |
| 327 | 299 | |
| 328 | 300 | /* Set/Get screen contents */ |
| 329 | 301 | #define find_field_attribute(s,a) lib3270_field_addr(s,a) | ... | ... |
src/lib3270/screen.c
| ... | ... | @@ -210,16 +210,13 @@ static unsigned short calc_attrs(H3270 *session, int baddr, int fa_addr, int fa) |
| 210 | 210 | else |
| 211 | 211 | gr = 0; |
| 212 | 212 | |
| 213 | - if(!(gr & GR_REVERSE) && !bg) | |
| 214 | - { | |
| 215 | - if(gr & GR_BLINK) | |
| 216 | - a |= LIB3270_ATTR_BLINK; | |
| 213 | + if(gr & GR_BLINK) | |
| 214 | + a |= LIB3270_ATTR_BLINK; | |
| 217 | 215 | |
| 218 | - if(gr & GR_UNDERLINE) | |
| 219 | - a |= LIB3270_ATTR_UNDERLINE; | |
| 220 | - } | |
| 216 | + if( (gr & GR_UNDERLINE) && lib3270_get_toggle(session,LIB3270_TOGGLE_UNDERLINE)) | |
| 217 | + a |= LIB3270_ATTR_UNDERLINE; | |
| 221 | 218 | |
| 222 | - if(session->m3279 && (gr & (GR_BLINK | GR_UNDERLINE)) && !(gr & GR_REVERSE) && !bg) | |
| 219 | + if(session->m3279 && (gr & (GR_BLINK | GR_UNDERLINE)) && !(gr & GR_REVERSE)) | |
| 223 | 220 | a |= LIB3270_ATTR_BACKGROUND_INTENSITY; |
| 224 | 221 | |
| 225 | 222 | if(!session->m3279 && ((gr & GR_INTENSIFY) || FA_IS_HIGH(fa))) |
| ... | ... | @@ -762,11 +759,14 @@ LIB3270_ACTION( testpattern ) |
| 762 | 759 | { 0, text_pat }, |
| 763 | 760 | }; |
| 764 | 761 | |
| 765 | - int row = 0; | |
| 762 | + static const unsigned char gr[] = { 0, GR_UNDERLINE, GR_BLINK }; | |
| 763 | + | |
| 764 | + int row = 0; | |
| 766 | 765 | int max; |
| 767 | - int pos = 0; | |
| 766 | + int pos = 0; | |
| 767 | + int grpos = 0; | |
| 768 | 768 | int f; |
| 769 | - int fg = COLOR_BLUE; | |
| 769 | + int fg = COLOR_BLUE; | |
| 770 | 770 | |
| 771 | 771 | CHECK_SESSION_HANDLE(hSession); |
| 772 | 772 | |
| ... | ... | @@ -779,7 +779,11 @@ LIB3270_ACTION( testpattern ) |
| 779 | 779 | { |
| 780 | 780 | row = 0; |
| 781 | 781 | if(++fg > COLOR_WHITE) |
| 782 | + { | |
| 782 | 783 | fg = COLOR_BLUE; |
| 784 | + if(++grpos > (sizeof(gr)/sizeof(gr[0]))) | |
| 785 | + grpos = 0; | |
| 786 | + } | |
| 783 | 787 | } |
| 784 | 788 | pos = 0; |
| 785 | 789 | } |
| ... | ... | @@ -787,6 +791,7 @@ LIB3270_ACTION( testpattern ) |
| 787 | 791 | hSession->ea_buf[f].bg = (fg == COLOR_BLACK) ? COLOR_WHITE : COLOR_BLACK; |
| 788 | 792 | hSession->ea_buf[f].cs = pat[row].cs; |
| 789 | 793 | hSession->ea_buf[f].cc = pat[row].cc[pos++]; |
| 794 | + hSession->ea_buf[f].gr = gr[grpos]; | |
| 790 | 795 | } |
| 791 | 796 | |
| 792 | 797 | hSession->display(hSession); | ... | ... |
src/lib3270/toggles.c
| ... | ... | @@ -149,7 +149,7 @@ static void toggle_altscreen(H3270 *session, struct lib3270_toggle *t, LIB3270_T |
| 149 | 149 | set_viewsize(session,t->value ? 24 : session->maxROWS,80); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | -static void toggle_monocase(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt) | |
| 152 | +static void toggle_redraw(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt) | |
| 153 | 153 | { |
| 154 | 154 | session->display(session); |
| 155 | 155 | } |
| ... | ... | @@ -172,17 +172,10 @@ void initialize_toggles(H3270 *session) |
| 172 | 172 | session->toggle[f].upcall = toggle_nop; |
| 173 | 173 | |
| 174 | 174 | session->toggle[LIB3270_TOGGLE_RECTANGLE_SELECT].upcall = toggle_rectselect; |
| 175 | - session->toggle[LIB3270_TOGGLE_MONOCASE].upcall = toggle_monocase; | |
| 175 | + session->toggle[LIB3270_TOGGLE_MONOCASE].upcall = toggle_redraw; | |
| 176 | + session->toggle[LIB3270_TOGGLE_UNDERLINE].upcall = toggle_redraw; | |
| 176 | 177 | session->toggle[LIB3270_TOGGLE_ALTSCREEN].upcall = toggle_altscreen; |
| 177 | 178 | |
| 178 | -/* | |
| 179 | -#if defined(X3270_TRACE) | |
| 180 | - session->toggle[LIB3270_TOGGLE_DS_TRACE].upcall = toggle_dsTrace; | |
| 181 | - session->toggle[LIB3270_TOGGLE_SCREEN_TRACE].upcall = toggle_screenTrace; | |
| 182 | - session->toggle[LIB3270_TOGGLE_EVENT_TRACE].upcall = toggle_eventTrace; | |
| 183 | -#endif | |
| 184 | -*/ | |
| 185 | - | |
| 186 | 179 | #if defined(X3270_ANSI) |
| 187 | 180 | session->toggle[LIB3270_TOGGLE_LINE_WRAP].upcall = toggle_lineWrap; |
| 188 | 181 | #endif | ... | ... |
src/pw3270/v3270/draw.c
| ... | ... | @@ -119,6 +119,28 @@ void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned short attr, H32 |
| 119 | 119 | |
| 120 | 120 | get_element_colors(attr,&fg,&bg,color); |
| 121 | 121 | v3270_draw_char(cr,chr,attr,session,height,rect,fg,bg); |
| 122 | + | |
| 123 | + if(attr & LIB3270_ATTR_UNDERLINE) | |
| 124 | + { | |
| 125 | + cairo_scaled_font_t * font = cairo_get_scaled_font(cr); | |
| 126 | + cairo_font_extents_t extents; | |
| 127 | + double sl; | |
| 128 | + | |
| 129 | + cairo_scaled_font_extents(font,&extents); | |
| 130 | + | |
| 131 | + sl = extents.descent/3; | |
| 132 | + if(sl < 1) | |
| 133 | + sl = 1; | |
| 134 | + | |
| 135 | + gdk_cairo_set_source_color(cr,fg); | |
| 136 | + | |
| 137 | + cairo_rectangle(cr,rect->x,rect->y+sl+extents.ascent+(extents.descent/2),rect->width,sl); | |
| 138 | + cairo_fill(cr); | |
| 139 | + | |
| 140 | + cairo_stroke(cr); | |
| 141 | + } | |
| 142 | + | |
| 143 | + | |
| 122 | 144 | } |
| 123 | 145 | |
| 124 | 146 | void v3270_draw_char(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 *session, guint height, GdkRectangle *rect, GdkColor *fg, GdkColor *bg) |
| ... | ... | @@ -262,6 +284,7 @@ void v3270_draw_char(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 |
| 262 | 284 | g_free(utf); |
| 263 | 285 | } |
| 264 | 286 | } |
| 287 | + | |
| 265 | 288 | cairo_stroke(cr); |
| 266 | 289 | } |
| 267 | 290 | ... | ... |