Commit 0c5f36010741a3f7dd18f7106b6664ada24575a0
1 parent
f4f0fb3e
Exists in
master
and in
1 other branch
Terminal now blinks SSL indication during negotiation.
Showing
8 changed files
with
256 additions
and
164 deletions
Show diff stats
src/include/v3270.h
| ... | ... | @@ -237,7 +237,7 @@ |
| 237 | 237 | void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type, const gchar *title, const gchar *message, const gchar *text); |
| 238 | 238 | const gchar * v3270_get_session_name(GtkWidget *widget); |
| 239 | 239 | void v3270_set_session_name(GtkWidget *widget, const gchar *name); |
| 240 | - int v3270_set_script(GtkWidget *widget, const gchar id, gboolean on); | |
| 240 | + int v3270_set_script(GtkWidget *widget, const gchar id); | |
| 241 | 241 | void v3270_set_scaled_fonts(GtkWidget *widget, gboolean on); |
| 242 | 242 | int v3270_set_session_color_type(GtkWidget *widget, unsigned short colortype); |
| 243 | 243 | ... | ... |
src/testprogram/testprogram.c
| ... | ... | @@ -161,6 +161,8 @@ static void activate(GtkApplication* app, G_GNUC_UNUSED gpointer user_data) { |
| 161 | 161 | |
| 162 | 162 | v3270_set_toggle(terminal,LIB3270_TOGGLE_RECONNECT,1); |
| 163 | 163 | |
| 164 | + // v3270_set_script(terminal,'R'); | |
| 165 | + | |
| 164 | 166 | } |
| 165 | 167 | |
| 166 | 168 | int main (int argc, char **argv) { | ... | ... |
| ... | ... | @@ -0,0 +1,97 @@ |
| 1 | +/* | |
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | + * | |
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | + * | |
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | + * Free Software Foundation. | |
| 11 | + * | |
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | + * obter mais detalhes. | |
| 16 | + * | |
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como - e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Contatos: | |
| 24 | + * | |
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 27 | + * | |
| 28 | + */ | |
| 29 | + | |
| 30 | + #include <config.h> | |
| 31 | + #include "private.h" | |
| 32 | + | |
| 33 | +/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
| 34 | + | |
| 35 | + static gboolean blink_timer_tick(v3270 *widget) | |
| 36 | + { | |
| 37 | + gboolean rc = FALSE; | |
| 38 | + | |
| 39 | + widget->blink.show = !widget->blink.show; | |
| 40 | + | |
| 41 | + if(widget->script) | |
| 42 | + { | |
| 43 | + v3270_oia_update_text_field(widget,1,V3270_OIA_SCRIPT,widget->blink.show ? widget->script : ' '); | |
| 44 | + | |
| 45 | + rc = TRUE; | |
| 46 | + } | |
| 47 | + | |
| 48 | + if(lib3270_get_secure(widget->host) == LIB3270_SSL_NEGOTIATING) | |
| 49 | + { | |
| 50 | + GdkRectangle * r; | |
| 51 | + cairo_t * cr = v3270_oia_set_update_region(widget,&r,V3270_OIA_SSL); | |
| 52 | + | |
| 53 | + v3270_draw_ssl_status(widget,cr,r); | |
| 54 | + v3270_queue_draw_area(GTK_WIDGET(widget),r->x,r->y,r->width,r->height); | |
| 55 | + cairo_destroy(cr); | |
| 56 | + | |
| 57 | + rc = TRUE; | |
| 58 | + } | |
| 59 | + | |
| 60 | + /* | |
| 61 | + if(!widget->script.id) | |
| 62 | + return FALSE; | |
| 63 | + | |
| 64 | + update_text_field(widget,1,V3270_OIA_SCRIPT,widget->script.blink ? 'S' : ' '); | |
| 65 | + widget->script.blink = !widget->script.blink; | |
| 66 | + | |
| 67 | + return TRUE; | |
| 68 | + */ | |
| 69 | + | |
| 70 | + return rc; | |
| 71 | + | |
| 72 | + } | |
| 73 | + | |
| 74 | + static void blink_timer_removed(v3270 *widget) | |
| 75 | + { | |
| 76 | + widget->blink.timer = NULL; | |
| 77 | + widget->blink.show = 1; | |
| 78 | + } | |
| 79 | + | |
| 80 | + void v3270_start_blinking(GtkWidget *widget) | |
| 81 | + { | |
| 82 | + g_return_if_fail(GTK_IS_V3270(widget)); | |
| 83 | + | |
| 84 | + v3270 * terminal = GTK_V3270(widget); | |
| 85 | + | |
| 86 | + if(!terminal->blink.timer) | |
| 87 | + { | |
| 88 | + terminal->blink.show = 1; | |
| 89 | + terminal->blink.timer = g_timeout_source_new(500); | |
| 90 | + g_source_set_callback(terminal->blink.timer,(GSourceFunc) blink_timer_tick, terminal, (GDestroyNotify) blink_timer_removed); | |
| 91 | + | |
| 92 | + g_source_attach(terminal->blink.timer, NULL); | |
| 93 | + g_source_unref(terminal->blink.timer); | |
| 94 | + } | |
| 95 | + | |
| 96 | + } | |
| 97 | + | ... | ... |
src/v3270/draw.c
| ... | ... | @@ -62,7 +62,7 @@ gboolean v3270_draw(GtkWidget * widget, cairo_t * cr) |
| 62 | 62 | cairo_rectangle(cr, 0,terminal->cursor.rect.y+terminal->font.height,allocation.width,1); |
| 63 | 63 | cairo_fill(cr); |
| 64 | 64 | |
| 65 | - cairo_rectangle(cr, terminal->cursor.rect.x,0,1,terminal->oia_rect->y-3); | |
| 65 | + cairo_rectangle(cr, terminal->cursor.rect.x,0,1,terminal->oia.rect->y-3); | |
| 66 | 66 | cairo_fill(cr); |
| 67 | 67 | } |
| 68 | 68 | |
| ... | ... | @@ -439,7 +439,7 @@ LIB3270_EXPORT void v3270_reload(GtkWidget *widget) |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | cairo_set_scaled_font(cr,terminal->font.scaled); |
| 442 | - v3270_draw_oia(cr, terminal->host, rect.y, cols, &terminal->font, terminal->color,terminal->oia_rect); | |
| 442 | + v3270_draw_oia(terminal, cr, rect.y, cols); | |
| 443 | 443 | |
| 444 | 444 | cairo_destroy(cr); |
| 445 | 445 | ... | ... |
src/v3270/mouse.c
| ... | ... | @@ -138,13 +138,13 @@ void v3270_emit_popup(v3270 *widget, int baddr, GdkEventButton *event) |
| 138 | 138 | |
| 139 | 139 | static V3270_OIA_FIELD get_field_from_event(v3270 *widget, GdkEventButton *event) |
| 140 | 140 | { |
| 141 | - if(event->y >= widget->oia_rect->y) | |
| 141 | + if(event->y >= widget->oia.rect->y) | |
| 142 | 142 | { |
| 143 | 143 | V3270_OIA_FIELD f; |
| 144 | 144 | |
| 145 | 145 | for(f=0;f<V3270_OIA_FIELD_COUNT;f++) |
| 146 | 146 | { |
| 147 | - if(event->x >= widget->oia_rect[f].x && event->x <= (widget->oia_rect[f].x+widget->oia_rect[f].width)) | |
| 147 | + if(event->x >= widget->oia.rect[f].x && event->x <= (widget->oia.rect[f].x+widget->oia.rect[f].width)) | |
| 148 | 148 | return f; |
| 149 | 149 | } |
| 150 | 150 | } |
| ... | ... | @@ -158,7 +158,7 @@ gboolean v3270_button_press_event(GtkWidget *widget, GdkEventButton *event) |
| 158 | 158 | |
| 159 | 159 | if(baddr >= 0) |
| 160 | 160 | { |
| 161 | - GTK_V3270(widget)->selected_field = V3270_OIA_FIELD_INVALID; | |
| 161 | + GTK_V3270(widget)->oia.selected = V3270_OIA_FIELD_INVALID; | |
| 162 | 162 | |
| 163 | 163 | switch(event->button) |
| 164 | 164 | { |
| ... | ... | @@ -175,7 +175,7 @@ gboolean v3270_button_press_event(GtkWidget *widget, GdkEventButton *event) |
| 175 | 175 | } |
| 176 | 176 | else if(event->button == 1 && event->type == GDK_BUTTON_PRESS) |
| 177 | 177 | { |
| 178 | - GTK_V3270(widget)->selected_field = get_field_from_event(GTK_V3270(widget),event); | |
| 178 | + GTK_V3270(widget)->oia.selected = get_field_from_event(GTK_V3270(widget),event); | |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | return FALSE; |
| ... | ... | @@ -190,13 +190,13 @@ gboolean v3270_button_release_event(GtkWidget *widget, GdkEventButton*event) |
| 190 | 190 | GTK_V3270(widget)->moving = 0; |
| 191 | 191 | GTK_V3270(widget)->resizing = 0; |
| 192 | 192 | |
| 193 | - if(GTK_V3270(widget)->selected_field != V3270_OIA_FIELD_INVALID && GTK_V3270(widget)->selected_field == get_field_from_event(GTK_V3270(widget),event)) | |
| 193 | + if(GTK_V3270(widget)->oia.selected != V3270_OIA_FIELD_INVALID && GTK_V3270(widget)->oia.selected == get_field_from_event(GTK_V3270(widget),event)) | |
| 194 | 194 | { |
| 195 | 195 | gboolean handled = FALSE; |
| 196 | 196 | |
| 197 | 197 | g_signal_emit(widget, v3270_widget_signal[SIGNAL_FIELD], 0, |
| 198 | 198 | lib3270_connected(GTK_V3270(widget)->host) ? TRUE : FALSE, |
| 199 | - GTK_V3270(widget)->selected_field, | |
| 199 | + GTK_V3270(widget)->oia.selected, | |
| 200 | 200 | event, |
| 201 | 201 | &handled); |
| 202 | 202 | |
| ... | ... | @@ -205,7 +205,7 @@ gboolean v3270_button_release_event(GtkWidget *widget, GdkEventButton*event) |
| 205 | 205 | |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - GTK_V3270(widget)->selected_field = V3270_OIA_FIELD_INVALID; | |
| 208 | + GTK_V3270(widget)->oia.selected = V3270_OIA_FIELD_INVALID; | |
| 209 | 209 | |
| 210 | 210 | break; |
| 211 | 211 | |
| ... | ... | @@ -267,11 +267,11 @@ gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event) |
| 267 | 267 | update_mouse_pointer(widget,baddr); |
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | - else if(event->y >= terminal->oia_rect->y) | |
| 270 | + else if(event->y >= terminal->oia.rect->y) | |
| 271 | 271 | { |
| 272 | 272 | int id = LIB3270_POINTER_PROTECTED; |
| 273 | 273 | |
| 274 | - if(event->x >= terminal->oia_rect[V3270_OIA_SSL].x && event->x <= (terminal->oia_rect[V3270_OIA_SSL].x + terminal->oia_rect[V3270_OIA_SSL].width)) | |
| 274 | + if(event->x >= terminal->oia.rect[V3270_OIA_SSL].x && event->x <= (terminal->oia.rect[V3270_OIA_SSL].x + terminal->oia.rect[V3270_OIA_SSL].width)) | |
| 275 | 275 | { |
| 276 | 276 | switch(lib3270_get_secure(terminal->host)) |
| 277 | 277 | { | ... | ... |
src/v3270/oia.c
| ... | ... | @@ -343,45 +343,49 @@ static void draw_xbm(cairo_t *cr, GdkRectangle *rect, int width, int height, uns |
| 343 | 343 | cairo_restore(cr); |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | -void v3270_draw_ssl_status(cairo_t *cr, H3270 *host, G_GNUC_UNUSED v3270FontInfo *metrics, GdkRGBA *color, GdkRectangle *rect) | |
| 346 | +void v3270_draw_ssl_status(v3270 *widget, cairo_t *cr, GdkRectangle *rect) | |
| 347 | 347 | { |
| 348 | -#ifdef DEBUG | |
| 349 | - cairo_set_source_rgb(cr,0.1,0.1,0.1); | |
| 350 | -#else | |
| 351 | - gdk_cairo_set_source_rgba(cr,color+V3270_COLOR_OIA_BACKGROUND); | |
| 352 | -#endif | |
| 348 | + // v3270_draw_ssl_status(cr,terminal->host,&terminal->font,terminal->color,r); | |
| 349 | + | |
| 350 | + gdk_cairo_set_source_rgba(cr,widget->color+V3270_COLOR_OIA_BACKGROUND); | |
| 353 | 351 | |
| 354 | 352 | cairo_translate(cr, rect->x, rect->y); |
| 355 | 353 | cairo_rectangle(cr, 0, 0, rect->width, rect->height); |
| 356 | 354 | cairo_fill(cr); |
| 357 | 355 | |
| 358 | - switch(lib3270_get_secure(host)) | |
| 356 | + if(widget->blink.show) | |
| 357 | + return; | |
| 358 | + | |
| 359 | + switch(lib3270_get_secure(widget->host)) | |
| 359 | 360 | { |
| 360 | - case LIB3270_SSL_UNSECURE: /**< No secure connection */ | |
| 361 | - gdk_cairo_set_source_rgba(cr,color+V3270_COLOR_OIA_FOREGROUND); | |
| 361 | + case LIB3270_SSL_UNDEFINED: // Undefined. | |
| 362 | + break; | |
| 363 | + | |
| 364 | + case LIB3270_SSL_UNSECURE: // No secure connection | |
| 365 | + gdk_cairo_set_source_rgba(cr,widget->color+V3270_COLOR_OIA_FOREGROUND); | |
| 362 | 366 | draw_xbm(cr,rect,unlocked_width,unlocked_height,unlocked_bits); |
| 363 | 367 | break; |
| 364 | 368 | |
| 365 | - case LIB3270_SSL_NEGOTIATING: /**< Negotiating SSL */ | |
| 366 | - gdk_cairo_set_source_rgba(cr,color+V3270_COLOR_OIA_STATUS_WARNING); | |
| 367 | - draw_xbm(cr,rect,negotiated_width,negotiated_height,negotiated_bits); | |
| 369 | + case LIB3270_SSL_NEGOTIATING: // Negotiating SSL | |
| 370 | + if(widget->blink.show) | |
| 371 | + { | |
| 372 | + gdk_cairo_set_source_rgba(cr,widget->color+V3270_COLOR_OIA_STATUS_WARNING); | |
| 373 | + draw_xbm(cr,rect,negotiated_width,negotiated_height,negotiated_bits); | |
| 374 | + } | |
| 368 | 375 | break; |
| 369 | 376 | |
| 370 | - case LIB3270_SSL_NEGOTIATED: /**< Connection secure, no CA or self-signed */ | |
| 371 | - gdk_cairo_set_source_rgba(cr,color+V3270_COLOR_OIA_STATUS_OK); | |
| 377 | + case LIB3270_SSL_NEGOTIATED: // Connection secure, no CA, self-signed or expired CRL | |
| 378 | + gdk_cairo_set_source_rgba(cr,widget->color+V3270_COLOR_OIA_STATUS_OK); | |
| 372 | 379 | draw_xbm(cr,rect,locked_width,locked_height,locked_bits); |
| 373 | - gdk_cairo_set_source_rgba(cr,color+V3270_COLOR_OIA_STATUS_WARNING); | |
| 380 | + gdk_cairo_set_source_rgba(cr,widget->color+V3270_COLOR_OIA_STATUS_WARNING); | |
| 374 | 381 | draw_xbm(cr,rect,warning_width,warning_height,warning_bits); |
| 375 | 382 | break; |
| 376 | 383 | |
| 377 | - case LIB3270_SSL_SECURE: /**< Connection secure with CA check */ | |
| 378 | - gdk_cairo_set_source_rgba(cr,color+V3270_COLOR_OIA_STATUS_OK); | |
| 384 | + case LIB3270_SSL_SECURE: // Connection secure with CA check | |
| 385 | + gdk_cairo_set_source_rgba(cr,widget->color+V3270_COLOR_OIA_STATUS_OK); | |
| 379 | 386 | draw_xbm(cr,rect,locked_width,locked_height,locked_bits); |
| 380 | 387 | break; |
| 381 | 388 | |
| 382 | - default: | |
| 383 | - return; | |
| 384 | - | |
| 385 | 389 | } |
| 386 | 390 | |
| 387 | 391 | |
| ... | ... | @@ -552,7 +556,10 @@ static void draw_insert(cairo_t *cr, H3270 *host, GdkRGBA *color, GdkRectangle * |
| 552 | 556 | |
| 553 | 557 | } |
| 554 | 558 | |
| 555 | -void v3270_draw_oia(cairo_t *cr, H3270 *host, int row, int cols, v3270FontInfo *metrics, GdkRGBA *color, GdkRectangle *rect) | |
| 559 | +// v3270_draw_oia(cr, terminal->host, rect.y, cols, &terminal->font, terminal->color,terminal->oia_rect); | |
| 560 | +// void v3270_draw_oia(cairo_t *cr, H3270 *host, int row, int cols, v3270FontInfo *metrics, GdkRGBA *color, GdkRectangle *rect) | |
| 561 | + | |
| 562 | +void v3270_draw_oia(v3270 *terminal, cairo_t *cr, int row, int cols) | |
| 556 | 563 | { |
| 557 | 564 | static const struct _right_fields |
| 558 | 565 | { |
| ... | ... | @@ -577,80 +584,81 @@ void v3270_draw_oia(cairo_t *cr, H3270 *host, int row, int cols, v3270FontInfo * |
| 577 | 584 | }; |
| 578 | 585 | |
| 579 | 586 | int f; |
| 580 | - int rCol = metrics->left+(cols*metrics->width); | |
| 581 | - int lCol = metrics->left+1; | |
| 587 | + int rCol = terminal->font.left+(cols*terminal->font.width); | |
| 588 | + int lCol = terminal->font.left+1; | |
| 582 | 589 | |
| 583 | 590 | row += OIA_TOP_MARGIN; |
| 584 | - gdk_cairo_set_source_rgba(cr,color+V3270_COLOR_OIA_SEPARATOR); | |
| 585 | - cairo_rectangle(cr, metrics->left, row, cols*metrics->width, 1); | |
| 591 | + gdk_cairo_set_source_rgba(cr,terminal->color+V3270_COLOR_OIA_SEPARATOR); | |
| 592 | + cairo_rectangle(cr, terminal->font.left, row, cols*terminal->font.width, 1); | |
| 586 | 593 | cairo_fill(cr); |
| 587 | 594 | |
| 588 | 595 | row += 2; |
| 589 | 596 | |
| 590 | - gdk_cairo_set_source_rgba(cr,color+V3270_COLOR_OIA_BACKGROUND); | |
| 591 | - cairo_rectangle(cr, metrics->left, row, cols*metrics->width, metrics->spacing); | |
| 597 | + gdk_cairo_set_source_rgba(cr,terminal->color+V3270_COLOR_OIA_BACKGROUND); | |
| 598 | + cairo_rectangle(cr, terminal->font.left, row, cols*terminal->font.width, terminal->font.spacing); | |
| 592 | 599 | cairo_fill(cr); |
| 593 | 600 | |
| 594 | 601 | for(f=0;f< (int) G_N_ELEMENTS(right);f++) |
| 595 | 602 | { |
| 596 | - GdkRectangle *r = rect+right[f].id; | |
| 603 | + GdkRectangle *r = terminal->oia.rect+right[f].id; | |
| 597 | 604 | |
| 598 | 605 | memset(r,0,sizeof(GdkRectangle)); |
| 599 | 606 | r->x = rCol; |
| 600 | 607 | r->y = row; |
| 601 | - r->width = metrics->width; | |
| 602 | - r->height = metrics->spacing; | |
| 603 | - gdk_cairo_set_source_rgba(cr,color+V3270_COLOR_OIA_FOREGROUND); | |
| 604 | - right[f].draw(r,metrics,cr,host,cols,color); | |
| 605 | - rCol = r->x - (metrics->width/3); | |
| 608 | + r->width = terminal->font.width; | |
| 609 | + r->height = terminal->font.spacing; | |
| 610 | + gdk_cairo_set_source_rgba(cr,terminal->color+V3270_COLOR_OIA_FOREGROUND); | |
| 611 | + right[f].draw(r,&terminal->font,cr,terminal->host,cols,terminal->color); | |
| 612 | + rCol = r->x - (terminal->font.width/3); | |
| 606 | 613 | } |
| 607 | 614 | |
| 608 | - gdk_cairo_set_source_rgba(cr,color+V3270_COLOR_OIA_FOREGROUND); | |
| 615 | + gdk_cairo_set_source_rgba(cr,terminal->color+V3270_COLOR_OIA_FOREGROUND); | |
| 609 | 616 | |
| 610 | - draw_centered_char(cr,metrics,lCol,row,'4'); | |
| 617 | + draw_centered_char(cr,&terminal->font,lCol,row,'4'); | |
| 611 | 618 | |
| 612 | 619 | cairo_stroke(cr); |
| 613 | - cairo_rectangle(cr, lCol, row, metrics->width+2, metrics->spacing); | |
| 620 | + cairo_rectangle(cr, lCol, row, terminal->font.width+2, terminal->font.spacing); | |
| 614 | 621 | cairo_stroke(cr); |
| 615 | 622 | |
| 616 | - lCol += (metrics->width+5); | |
| 623 | + lCol += (terminal->font.width+5); | |
| 617 | 624 | |
| 618 | 625 | // Undera indicator |
| 619 | - rect[V3270_OIA_UNDERA].x = lCol; | |
| 620 | - rect[V3270_OIA_UNDERA].y = row; | |
| 621 | - rect[V3270_OIA_UNDERA].width = metrics->width+3; | |
| 622 | - rect[V3270_OIA_UNDERA].height = metrics->spacing; | |
| 623 | - draw_undera(cr,host,metrics,color,rect+V3270_OIA_UNDERA); | |
| 626 | + terminal->oia.rect[V3270_OIA_UNDERA].x = lCol; | |
| 627 | + terminal->oia.rect[V3270_OIA_UNDERA].y = row; | |
| 628 | + terminal->oia.rect[V3270_OIA_UNDERA].width = terminal->font.width+3; | |
| 629 | + terminal->oia.rect[V3270_OIA_UNDERA].height = terminal->font.spacing; | |
| 630 | + draw_undera(cr,terminal->host,&terminal->font,terminal->color,terminal->oia.rect+V3270_OIA_UNDERA); | |
| 624 | 631 | |
| 625 | - lCol += (3 + rect[V3270_OIA_UNDERA].width); | |
| 632 | + lCol += (3 + terminal->oia.rect[V3270_OIA_UNDERA].width); | |
| 626 | 633 | |
| 627 | 634 | // Connection indicator |
| 628 | - rect[V3270_OIA_CONNECTION].x = lCol; | |
| 629 | - rect[V3270_OIA_CONNECTION].y = row; | |
| 630 | - rect[V3270_OIA_CONNECTION].width = metrics->width+3; | |
| 631 | - rect[V3270_OIA_CONNECTION].height = metrics->spacing; | |
| 632 | - v3270_draw_connection(cr,host,metrics,color,rect+V3270_OIA_CONNECTION); | |
| 635 | + terminal->oia.rect[V3270_OIA_CONNECTION].x = lCol; | |
| 636 | + terminal->oia.rect[V3270_OIA_CONNECTION].y = row; | |
| 637 | + terminal->oia.rect[V3270_OIA_CONNECTION].width = terminal->font.width+3; | |
| 638 | + terminal->oia.rect[V3270_OIA_CONNECTION].height = terminal->font.spacing; | |
| 639 | + v3270_draw_connection(cr,terminal->host,&terminal->font,terminal->color,terminal->oia.rect+V3270_OIA_CONNECTION); | |
| 633 | 640 | |
| 634 | - lCol += (4 + rect[V3270_OIA_CONNECTION].width); | |
| 641 | + lCol += (4 + terminal->oia.rect[V3270_OIA_CONNECTION].width); | |
| 635 | 642 | |
| 636 | - memset(rect+V3270_OIA_MESSAGE,0,sizeof(GdkRectangle)); | |
| 643 | + memset(terminal->oia.rect+V3270_OIA_MESSAGE,0,sizeof(GdkRectangle)); | |
| 637 | 644 | |
| 638 | 645 | if(lCol < rCol) |
| 639 | 646 | { |
| 640 | - GdkRectangle *r = rect+V3270_OIA_MESSAGE; | |
| 647 | + GdkRectangle *r = terminal->oia.rect+V3270_OIA_MESSAGE; | |
| 641 | 648 | r->x = lCol; |
| 642 | 649 | r->y = row; |
| 643 | 650 | r->width = rCol - lCol; |
| 644 | - r->height = metrics->spacing; | |
| 645 | - draw_status_message(cr,lib3270_get_program_message(host),metrics,color,r); | |
| 651 | + r->height = terminal->font.spacing; | |
| 652 | + draw_status_message(cr,lib3270_get_program_message(terminal->host),&terminal->font,terminal->color,r); | |
| 646 | 653 | } |
| 647 | 654 | |
| 648 | 655 | cairo_save(cr); |
| 649 | - v3270_draw_ssl_status(cr,host,metrics,color,rect+V3270_OIA_SSL); | |
| 656 | +// v3270_draw_ssl_status(cr,terminal->host,&terminal->font,terminal->color,terminal->oia.rect+V3270_OIA_SSL); | |
| 657 | + v3270_draw_ssl_status(terminal,cr,terminal->oia.rect+V3270_OIA_SSL); | |
| 650 | 658 | cairo_restore(cr); |
| 651 | 659 | |
| 652 | 660 | cairo_save(cr); |
| 653 | - draw_insert(cr,host,color,rect+V3270_OIA_INSERT); | |
| 661 | + draw_insert(cr,terminal->host,terminal->color,terminal->oia.rect+V3270_OIA_INSERT); | |
| 654 | 662 | cairo_restore(cr); |
| 655 | 663 | } |
| 656 | 664 | |
| ... | ... | @@ -664,9 +672,9 @@ void v3270_draw_oia(cairo_t *cr, H3270 *host, int row, int cols, v3270FontInfo * |
| 664 | 672 | * @return cairo object for drawing. |
| 665 | 673 | * |
| 666 | 674 | */ |
| 667 | -static cairo_t * set_update_region(v3270 * terminal, GdkRectangle **r, V3270_OIA_FIELD id) | |
| 675 | +cairo_t * v3270_oia_set_update_region(v3270 * terminal, GdkRectangle **r, V3270_OIA_FIELD id) | |
| 668 | 676 | { |
| 669 | - GdkRectangle * rect = terminal->oia_rect + id; | |
| 677 | + GdkRectangle * rect = terminal->oia.rect + id; | |
| 670 | 678 | cairo_t * cr = cairo_create(terminal->surface); |
| 671 | 679 | |
| 672 | 680 | cairo_set_scaled_font(cr,terminal->font.scaled); |
| ... | ... | @@ -698,7 +706,7 @@ void v3270_update_luname(GtkWidget *widget,const gchar *name) |
| 698 | 706 | |
| 699 | 707 | if(terminal->surface) |
| 700 | 708 | { |
| 701 | - cr = set_update_region(terminal,&rect,V3270_OIA_LUNAME); | |
| 709 | + cr = v3270_oia_set_update_region(terminal,&rect,V3270_OIA_LUNAME); | |
| 702 | 710 | |
| 703 | 711 | if(name) |
| 704 | 712 | { |
| ... | ... | @@ -727,7 +735,7 @@ void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id) |
| 727 | 735 | if(!widget->surface) |
| 728 | 736 | return; |
| 729 | 737 | |
| 730 | - cr = set_update_region(widget,&rect,V3270_OIA_MESSAGE); | |
| 738 | + cr = v3270_oia_set_update_region(widget,&rect,V3270_OIA_MESSAGE); | |
| 731 | 739 | |
| 732 | 740 | draw_status_message(cr,id,&widget->font,widget->color,rect); |
| 733 | 741 | |
| ... | ... | @@ -789,10 +797,10 @@ void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, |
| 789 | 797 | gtk_widget_get_allocation(GTK_WIDGET(terminal), &allocation); |
| 790 | 798 | |
| 791 | 799 | v3270_queue_draw_area(GTK_WIDGET(terminal),0,saved.y+terminal->font.height,allocation.width,1); |
| 792 | - v3270_queue_draw_area(GTK_WIDGET(terminal),saved.x,0,1,terminal->oia_rect->y-3); | |
| 800 | + v3270_queue_draw_area(GTK_WIDGET(terminal),saved.x,0,1,terminal->oia.rect->y-3); | |
| 793 | 801 | |
| 794 | 802 | v3270_queue_draw_area(GTK_WIDGET(terminal),0,terminal->cursor.rect.y+terminal->font.height,allocation.width,1); |
| 795 | - v3270_queue_draw_area(GTK_WIDGET(terminal),terminal->cursor.rect.x,0,1,terminal->oia_rect->y-3); | |
| 803 | + v3270_queue_draw_area(GTK_WIDGET(terminal),terminal->cursor.rect.x,0,1,terminal->oia.rect->y-3); | |
| 796 | 804 | } |
| 797 | 805 | |
| 798 | 806 | if(lib3270_get_toggle(session,LIB3270_TOGGLE_CURSOR_POS)) |
| ... | ... | @@ -801,7 +809,7 @@ void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, |
| 801 | 809 | GdkRectangle * rect; |
| 802 | 810 | cairo_t * cr; |
| 803 | 811 | |
| 804 | - cr = set_update_region(terminal,&rect,V3270_OIA_CURSOR_POSITION); | |
| 812 | + cr = v3270_oia_set_update_region(terminal,&rect,V3270_OIA_CURSOR_POSITION); | |
| 805 | 813 | |
| 806 | 814 | draw_cursor_position(cr,rect,&terminal->font,row,col); |
| 807 | 815 | |
| ... | ... | @@ -849,7 +857,7 @@ static void release_timer(struct timer_info *info) |
| 849 | 857 | |
| 850 | 858 | for(f=0;f< (int) G_N_ELEMENTS(id);f++) |
| 851 | 859 | { |
| 852 | - GdkRectangle *rect = info->terminal->oia_rect + id[f]; | |
| 860 | + GdkRectangle *rect = info->terminal->oia.rect + id[f]; | |
| 853 | 861 | cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height); |
| 854 | 862 | cairo_fill(cr); |
| 855 | 863 | v3270_queue_draw_area(GTK_WIDGET(info->terminal),rect->x,rect->y,rect->width,rect->height); |
| ... | ... | @@ -868,7 +876,7 @@ void v3270_draw_shift_status(v3270 *terminal) |
| 868 | 876 | if(!terminal->surface) |
| 869 | 877 | return; |
| 870 | 878 | |
| 871 | - cr = set_update_region(terminal,&r,V3270_OIA_SHIFT); | |
| 879 | + cr = v3270_oia_set_update_region(terminal,&r,V3270_OIA_SHIFT); | |
| 872 | 880 | cairo_translate(cr, r->x, r->y+1); |
| 873 | 881 | |
| 874 | 882 | if(r->width > 2 && r->height > 7 && (terminal->keyflags & KEY_FLAG_SHIFT)) |
| ... | ... | @@ -911,7 +919,7 @@ void v3270_draw_shift_status(v3270 *terminal) |
| 911 | 919 | |
| 912 | 920 | } |
| 913 | 921 | |
| 914 | -static void update_text_field(v3270 *terminal, gboolean flag, V3270_OIA_FIELD id, const gchar chr) | |
| 922 | +void v3270_oia_update_text_field(v3270 *terminal, gboolean flag, V3270_OIA_FIELD id, const gchar chr) | |
| 915 | 923 | { |
| 916 | 924 | GdkRectangle * r; |
| 917 | 925 | cairo_t * cr; |
| ... | ... | @@ -920,7 +928,7 @@ static void update_text_field(v3270 *terminal, gboolean flag, V3270_OIA_FIELD id |
| 920 | 928 | if(!terminal->surface) |
| 921 | 929 | return; |
| 922 | 930 | |
| 923 | - cr = set_update_region(terminal,&r,id); | |
| 931 | + cr = v3270_oia_set_update_region(terminal,&r,id); | |
| 924 | 932 | cairo_translate(cr, r->x, r->y); |
| 925 | 933 | |
| 926 | 934 | if(flag) |
| ... | ... | @@ -938,7 +946,7 @@ static void update_text_field(v3270 *terminal, gboolean flag, V3270_OIA_FIELD id |
| 938 | 946 | void v3270_draw_alt_status(v3270 *terminal) |
| 939 | 947 | { |
| 940 | 948 | #ifdef KEY_FLAG_ALT |
| 941 | - update_text_field(terminal,terminal->keyflags & KEY_FLAG_ALT,V3270_OIA_ALT,'A'); | |
| 949 | + v3270_oia_update_text_field(terminal,terminal->keyflags & KEY_FLAG_ALT,V3270_OIA_ALT,'A'); | |
| 942 | 950 | #endif // KEY_FLAG_ALT |
| 943 | 951 | } |
| 944 | 952 | |
| ... | ... | @@ -950,7 +958,7 @@ void v3270_draw_ins_status(v3270 *terminal) |
| 950 | 958 | if(!terminal->surface) |
| 951 | 959 | return; |
| 952 | 960 | |
| 953 | - cr = set_update_region(terminal,&r,V3270_OIA_INSERT); | |
| 961 | + cr = v3270_oia_set_update_region(terminal,&r,V3270_OIA_INSERT); | |
| 954 | 962 | |
| 955 | 963 | draw_insert(cr,terminal->host,terminal->color,r); |
| 956 | 964 | |
| ... | ... | @@ -976,13 +984,9 @@ static gboolean update_timer(struct timer_info *info) |
| 976 | 984 | time_t seconds = now - info->start; |
| 977 | 985 | char buffer[7]; |
| 978 | 986 | |
| 979 | - rect = info->terminal->oia_rect + V3270_OIA_TIMER; | |
| 987 | + rect = info->terminal->oia.rect + V3270_OIA_TIMER; | |
| 980 | 988 | |
| 981 | -#ifdef DEBUG | |
| 982 | - cairo_set_source_rgb(cr,0.1,0.1,0.1); | |
| 983 | -#else | |
| 984 | 989 | gdk_cairo_set_source_rgba(cr,info->terminal->color+V3270_COLOR_OIA_BACKGROUND); |
| 985 | -#endif | |
| 986 | 990 | |
| 987 | 991 | cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height); |
| 988 | 992 | cairo_fill(cr); |
| ... | ... | @@ -1008,7 +1012,7 @@ static gboolean update_timer(struct timer_info *info) |
| 1008 | 1012 | |
| 1009 | 1013 | #ifdef HAVE_LIBM |
| 1010 | 1014 | |
| 1011 | - rect = info->terminal->oia_rect + V3270_OIA_SPINNER; | |
| 1015 | + rect = info->terminal->oia.rect + V3270_OIA_SPINNER; | |
| 1012 | 1016 | |
| 1013 | 1017 | #ifdef DEBUG |
| 1014 | 1018 | cairo_set_source_rgb(cr,0.1,0.1,0.1); |
| ... | ... | @@ -1075,19 +1079,18 @@ void v3270_stop_timer(GtkWidget *widget) |
| 1075 | 1079 | |
| 1076 | 1080 | } |
| 1077 | 1081 | |
| 1078 | -void v3270_update_ssl(H3270 *session, G_GNUC_UNUSED LIB3270_SSL_STATE state) | |
| 1082 | +void v3270_blink_ssl(v3270 *terminal) | |
| 1079 | 1083 | { |
| 1080 | - v3270 * terminal = GTK_V3270(lib3270_get_user_data(session)); | |
| 1081 | - cairo_t * cr; | |
| 1082 | - GdkRectangle * r; | |
| 1084 | + if(terminal->surface) | |
| 1085 | + { | |
| 1086 | + GdkRectangle * r; | |
| 1087 | + cairo_t * cr = v3270_oia_set_update_region(terminal,&r,V3270_OIA_SSL); | |
| 1083 | 1088 | |
| 1084 | - if(!terminal->surface) | |
| 1085 | - return; | |
| 1089 | + v3270_draw_ssl_status(terminal,cr,r); | |
| 1090 | + v3270_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); | |
| 1091 | + cairo_destroy(cr); | |
| 1086 | 1092 | |
| 1087 | - cr = set_update_region(terminal,&r,V3270_OIA_SSL); | |
| 1088 | - v3270_draw_ssl_status(cr,terminal->host,&terminal->font,terminal->color,r); | |
| 1089 | - v3270_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); | |
| 1090 | - cairo_destroy(cr); | |
| 1093 | + } | |
| 1091 | 1094 | |
| 1092 | 1095 | } |
| 1093 | 1096 | |
| ... | ... | @@ -1105,7 +1108,7 @@ void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) |
| 1105 | 1108 | { |
| 1106 | 1109 | case LIB3270_FLAG_BOXSOLID: |
| 1107 | 1110 | debug("%s LIB3270_FLAG_BOXSOLID",__FUNCTION__); |
| 1108 | - cr = set_update_region(terminal,&r,V3270_OIA_CONNECTION); | |
| 1111 | + cr = v3270_oia_set_update_region(terminal,&r,V3270_OIA_CONNECTION); | |
| 1109 | 1112 | v3270_draw_connection(cr,terminal->host,&terminal->font,terminal->color,r); |
| 1110 | 1113 | cairo_destroy(cr); |
| 1111 | 1114 | v3270_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); |
| ... | ... | @@ -1113,7 +1116,7 @@ void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) |
| 1113 | 1116 | |
| 1114 | 1117 | case LIB3270_FLAG_UNDERA: |
| 1115 | 1118 | debug("%s LIB3270_FLAG_UNDERA",__FUNCTION__); |
| 1116 | - cr = set_update_region(terminal,&r,V3270_OIA_UNDERA); | |
| 1119 | + cr = v3270_oia_set_update_region(terminal,&r,V3270_OIA_UNDERA); | |
| 1117 | 1120 | debug("%s LIB3270_FLAG_UNDERA",__FUNCTION__); |
| 1118 | 1121 | draw_undera(cr,terminal->host,&terminal->font,terminal->color,r); |
| 1119 | 1122 | debug("%s LIB3270_FLAG_UNDERA",__FUNCTION__); |
| ... | ... | @@ -1125,19 +1128,19 @@ void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) |
| 1125 | 1128 | |
| 1126 | 1129 | case LIB3270_FLAG_TYPEAHEAD: |
| 1127 | 1130 | debug("%s LIB3270_FLAG_TYPEAHEAD",__FUNCTION__); |
| 1128 | - update_text_field(terminal,on,V3270_OIA_TYPEAHEAD,'T'); | |
| 1131 | + v3270_oia_update_text_field(terminal,on,V3270_OIA_TYPEAHEAD,'T'); | |
| 1129 | 1132 | break; |
| 1130 | 1133 | |
| 1131 | 1134 | #ifdef HAVE_PRINTER |
| 1132 | 1135 | case LIB3270_FLAG_PRINTER: |
| 1133 | 1136 | debug("%s LIB3270_FLAG_PRINTER",__FUNCTION__); |
| 1134 | - update_text_field(terminal,on,V3270_OIA_PRINTER,'P'); | |
| 1137 | + v3270_oia_update_text_field(terminal,on,V3270_OIA_PRINTER,'P'); | |
| 1135 | 1138 | break; |
| 1136 | 1139 | #endif // HAVE_PRINTER |
| 1137 | 1140 | |
| 1138 | 1141 | /* |
| 1139 | 1142 | case LIB3270_FLAG_SCRIPT: |
| 1140 | - update_text_field(terminal,on,V3270_OIA_SCRIPT,terminal->script_id); | |
| 1143 | + v3270_oia_update_text_field(terminal,on,V3270_OIA_SCRIPT,terminal->script_id); | |
| 1141 | 1144 | break; |
| 1142 | 1145 | */ |
| 1143 | 1146 | |
| ... | ... | @@ -1148,55 +1151,20 @@ void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) |
| 1148 | 1151 | debug("%s",__FUNCTION__); |
| 1149 | 1152 | } |
| 1150 | 1153 | |
| 1151 | -static gboolean blink_script(v3270 *widget) | |
| 1152 | -{ | |
| 1153 | - if(!widget->script.id) | |
| 1154 | - return FALSE; | |
| 1155 | - | |
| 1156 | - update_text_field(widget,1,V3270_OIA_SCRIPT,widget->script.blink ? 'S' : ' '); | |
| 1157 | - widget->script.blink = !widget->script.blink; | |
| 1158 | - | |
| 1159 | - return TRUE; | |
| 1160 | -} | |
| 1161 | - | |
| 1162 | -static void release_script(v3270 *widget) | |
| 1163 | -{ | |
| 1164 | - widget->script.timer = NULL; | |
| 1165 | - widget->script.id = 0; | |
| 1166 | -} | |
| 1167 | 1154 | |
| 1168 | -int v3270_set_script(GtkWidget *widget, const gchar id, gboolean on) | |
| 1155 | +int v3270_set_script(GtkWidget *widget, const gchar id) | |
| 1169 | 1156 | { |
| 1170 | - v3270 *terminal; | |
| 1171 | 1157 | g_return_val_if_fail(GTK_IS_V3270(widget),EINVAL); |
| 1172 | 1158 | |
| 1173 | - terminal = GTK_V3270(widget); | |
| 1159 | + v3270 * terminal = GTK_V3270(widget); | |
| 1174 | 1160 | |
| 1175 | - if(terminal->script.id && id != terminal->script.id) | |
| 1161 | + if(id && terminal->script) | |
| 1176 | 1162 | return EBUSY; |
| 1177 | 1163 | |
| 1178 | - terminal->script.id = on ? id : 0; | |
| 1179 | - update_text_field(terminal,on,V3270_OIA_SCRIPT,'S'); | |
| 1164 | + terminal->script = id; | |
| 1180 | 1165 | |
| 1181 | - if(on) | |
| 1182 | - { | |
| 1183 | - if(!terminal->script.timer) | |
| 1184 | - { | |
| 1185 | - terminal->script.timer = g_timeout_source_new(500); | |
| 1186 | - g_source_set_callback(terminal->script.timer,(GSourceFunc) blink_script, terminal, (GDestroyNotify) release_script); | |
| 1187 | - | |
| 1188 | - g_source_attach(terminal->script.timer, NULL); | |
| 1189 | - g_source_unref(terminal->script.timer); | |
| 1190 | - } | |
| 1191 | - } | |
| 1192 | - else if(terminal->script.timer) | |
| 1193 | - { | |
| 1194 | - if(terminal->script.timer->ref_count < 2) | |
| 1195 | - g_source_destroy(terminal->script.timer); | |
| 1196 | - | |
| 1197 | - if(terminal->timer) | |
| 1198 | - g_source_unref(terminal->script.timer); | |
| 1199 | - } | |
| 1166 | + if(terminal->script) | |
| 1167 | + v3270_start_blinking(widget); | |
| 1200 | 1168 | |
| 1201 | 1169 | return 0; |
| 1202 | 1170 | } | ... | ... |
src/v3270/private.h
| ... | ... | @@ -142,14 +142,12 @@ G_BEGIN_DECLS |
| 142 | 142 | |
| 143 | 143 | struct |
| 144 | 144 | { |
| 145 | - char * text; /**< Clipboard contents (lib3270 charset) */ | |
| 146 | - int baddr; /**< Selection addr */ | |
| 145 | + char * text; /**< Clipboard contents (lib3270 charset) */ | |
| 146 | + int baddr; /**< Selection addr */ | |
| 147 | 147 | } selection; |
| 148 | 148 | |
| 149 | 149 | LIB3270_POINTER pointer_id; |
| 150 | - unsigned char pointer; /**< Mouse pointer ID */ | |
| 151 | - | |
| 152 | - V3270_OIA_FIELD selected_field; /**< Clicked OIA field */ | |
| 150 | + unsigned char pointer; /**< Mouse pointer ID */ | |
| 153 | 151 | |
| 154 | 152 | // Font info |
| 155 | 153 | cairo_surface_t * surface; |
| ... | ... | @@ -159,10 +157,14 @@ G_BEGIN_DECLS |
| 159 | 157 | gint minimum_height; |
| 160 | 158 | |
| 161 | 159 | // Colors |
| 162 | - GdkRGBA color[V3270_COLOR_COUNT]; /**< Terminal widget colors */ | |
| 160 | + GdkRGBA color[V3270_COLOR_COUNT]; /**< Terminal widget colors */ | |
| 163 | 161 | |
| 164 | - // Regions | |
| 165 | - GdkRectangle oia_rect[V3270_OIA_FIELD_COUNT]; | |
| 162 | + // OIA | |
| 163 | + struct | |
| 164 | + { | |
| 165 | + GdkRectangle rect[V3270_OIA_FIELD_COUNT]; | |
| 166 | + V3270_OIA_FIELD selected; /**< Clicked OIA field */ | |
| 167 | + } oia; | |
| 166 | 168 | |
| 167 | 169 | struct |
| 168 | 170 | { |
| ... | ... | @@ -189,13 +191,24 @@ G_BEGIN_DECLS |
| 189 | 191 | GSource * timer; /**< Auto disconnect timer */ |
| 190 | 192 | } activity; |
| 191 | 193 | |
| 194 | + char script; /**< @brief Script ID */ | |
| 195 | + | |
| 196 | + // Blink | |
| 197 | + struct | |
| 198 | + { | |
| 199 | + int show : 1; /**< @brief Show element? */ | |
| 200 | + GSource * timer; /**< @brief Timer source. */ | |
| 201 | + } blink; | |
| 202 | + | |
| 203 | + /* | |
| 192 | 204 | // Scripting |
| 193 | 205 | struct |
| 194 | 206 | { |
| 195 | 207 | int blink : 1; |
| 196 | - gchar id; /**< Script indicator */ | |
| 208 | + gchar id; ///< Script indicator | |
| 197 | 209 | GSource * timer; |
| 198 | 210 | } script; |
| 211 | + */ | |
| 199 | 212 | |
| 200 | 213 | }; |
| 201 | 214 | |
| ... | ... | @@ -229,9 +242,12 @@ G_BEGIN_DECLS |
| 229 | 242 | |
| 230 | 243 | G_GNUC_INTERNAL guint v3270_widget_signal[LAST_SIGNAL]; |
| 231 | 244 | G_GNUC_INTERNAL GdkCursor * v3270_cursor[LIB3270_POINTER_COUNT]; |
| 232 | -// G_GNUC_INTERNAL GParamSpec * v3270_properties[PROP_LAST]; | |
| 233 | 245 | G_GNUC_INTERNAL const gchar * v3270_default_colors; |
| 234 | 246 | G_GNUC_INTERNAL const gchar * v3270_default_font; |
| 247 | + G_GNUC_INTERNAL void v3270_start_blinking(GtkWidget *widget); | |
| 248 | + | |
| 249 | + G_GNUC_INTERNAL void v3270_oia_update_text_field(v3270 *terminal, gboolean flag, V3270_OIA_FIELD id, const gchar chr); | |
| 250 | + G_GNUC_INTERNAL cairo_t * v3270_oia_set_update_region(v3270 * terminal, GdkRectangle **r, V3270_OIA_FIELD id); | |
| 235 | 251 | |
| 236 | 252 | G_GNUC_INTERNAL struct _v3270_properties |
| 237 | 253 | { |
| ... | ... | @@ -256,10 +272,11 @@ G_BEGIN_DECLS |
| 256 | 272 | |
| 257 | 273 | /*--[ Prototipes ]-----------------------------------------------------------------------------------*/ |
| 258 | 274 | |
| 259 | -const GtkWidgetClass * v3270_get_parent_class(void); | |
| 275 | +const GtkWidgetClass * v3270_get_parent_class(void); | |
| 260 | 276 | |
| 261 | 277 | G_GNUC_INTERNAL gboolean v3270_draw(GtkWidget * widget, cairo_t * cr); |
| 262 | -G_GNUC_INTERNAL void v3270_draw_oia(cairo_t *cr, H3270 *host, int row, int cols, v3270FontInfo *metrics, GdkRGBA *color, GdkRectangle *rect); | |
| 278 | + | |
| 279 | +G_GNUC_INTERNAL void v3270_draw_oia(v3270 *terminal, cairo_t *cr, int row, int cols); | |
| 263 | 280 | G_GNUC_INTERNAL void v3270_update_mouse_pointer(GtkWidget *widget); |
| 264 | 281 | |
| 265 | 282 | #if ! GTK_CHECK_VERSION(2,18,0) |
| ... | ... | @@ -302,7 +319,8 @@ G_GNUC_INTERNAL void v3270_start_timer(GtkWidget *terminal); |
| 302 | 319 | G_GNUC_INTERNAL void v3270_stop_timer(GtkWidget *terminal); |
| 303 | 320 | |
| 304 | 321 | G_GNUC_INTERNAL void v3270_draw_connection(cairo_t *cr, H3270 *host, v3270FontInfo *metrics, GdkRGBA *color, const GdkRectangle *rect); |
| 305 | -G_GNUC_INTERNAL void v3270_draw_ssl_status(cairo_t *cr, H3270 *host, v3270FontInfo *metrics, GdkRGBA *color, GdkRectangle *rect); | |
| 322 | + | |
| 323 | +G_GNUC_INTERNAL void v3270_draw_ssl_status(v3270 *widget, cairo_t *cr, GdkRectangle *rect); | |
| 306 | 324 | |
| 307 | 325 | G_GNUC_INTERNAL void v3270_update_char(H3270 *session, int addr, unsigned char chr, unsigned short attr, unsigned char cursor); |
| 308 | 326 | |
| ... | ... | @@ -313,7 +331,8 @@ G_GNUC_INTERNAL void v3270_update_cursor_rect(v3270 *widget, GdkRectangle *re |
| 313 | 331 | G_GNUC_INTERNAL void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id); |
| 314 | 332 | G_GNUC_INTERNAL void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr); |
| 315 | 333 | G_GNUC_INTERNAL void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on); |
| 316 | -G_GNUC_INTERNAL void v3270_update_ssl(H3270 *session, LIB3270_SSL_STATE state); | |
| 334 | + | |
| 335 | +G_GNUC_INTERNAL void v3270_blink_ssl(v3270 *terminal); | |
| 317 | 336 | |
| 318 | 337 | G_GNUC_INTERNAL void v3270_update_luname(GtkWidget *widget,const gchar *name); |
| 319 | 338 | G_GNUC_INTERNAL void v3270_init_properties(GObjectClass * gobject_class); | ... | ... |
src/v3270/widget.c
| ... | ... | @@ -230,9 +230,9 @@ void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type , const gchar *t |
| 230 | 230 | |
| 231 | 231 | gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, G_GNUC_UNUSED gboolean keyboard_tooltip, GtkTooltip *tooltip) |
| 232 | 232 | { |
| 233 | - if(y >= GTK_V3270(widget)->oia_rect->y) | |
| 233 | + if(y >= GTK_V3270(widget)->oia.rect->y) | |
| 234 | 234 | { |
| 235 | - GdkRectangle *rect = GTK_V3270(widget)->oia_rect; | |
| 235 | + GdkRectangle *rect = GTK_V3270(widget)->oia.rect; | |
| 236 | 236 | |
| 237 | 237 | if(x >= rect[V3270_OIA_SSL].x && x <= (rect[V3270_OIA_SSL].x + rect[V3270_OIA_SSL].width)) |
| 238 | 238 | { |
| ... | ... | @@ -923,6 +923,13 @@ static void popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title |
| 923 | 923 | |
| 924 | 924 | } |
| 925 | 925 | |
| 926 | + static void update_ssl(H3270 *session, G_GNUC_UNUSED LIB3270_SSL_STATE state) | |
| 927 | + { | |
| 928 | + v3270_blink_ssl(GTK_V3270(lib3270_get_user_data(session))); | |
| 929 | + if(state == LIB3270_SSL_NEGOTIATING) | |
| 930 | + v3270_start_blinking(GTK_WIDGET(lib3270_get_user_data(session))); | |
| 931 | + } | |
| 932 | + | |
| 926 | 933 | const gchar * v3270_default_font = "monospace"; |
| 927 | 934 | |
| 928 | 935 | static void v3270_init(v3270 *widget) |
| ... | ... | @@ -961,10 +968,9 @@ static void popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title |
| 961 | 968 | cbk->changed = changed; |
| 962 | 969 | cbk->ctlr_done = ctlr_done; |
| 963 | 970 | cbk->message = message; |
| 964 | - cbk->update_ssl = v3270_update_ssl; | |
| 971 | + cbk->update_ssl = update_ssl; | |
| 965 | 972 | cbk->print = emit_print_signal; |
| 966 | 973 | |
| 967 | - | |
| 968 | 974 | // Reset timer |
| 969 | 975 | widget->activity.timestamp = time(0); |
| 970 | 976 | widget->activity.disconnect = 0; |
| ... | ... | @@ -1058,11 +1064,11 @@ static void v3270_destroy(GtkObject *widget) |
| 1058 | 1064 | g_source_unref(terminal->timer); |
| 1059 | 1065 | } |
| 1060 | 1066 | |
| 1061 | - if(terminal->script.timer) | |
| 1067 | + if(terminal->blink.timer) | |
| 1062 | 1068 | { |
| 1063 | - g_source_destroy(terminal->script.timer); | |
| 1064 | - while(terminal->script.timer) | |
| 1065 | - g_source_unref(terminal->script.timer); | |
| 1069 | + g_source_destroy(terminal->blink.timer); | |
| 1070 | + while(terminal->blink.timer) | |
| 1071 | + g_source_unref(terminal->blink.timer); | |
| 1066 | 1072 | } |
| 1067 | 1073 | |
| 1068 | 1074 | if(terminal->cursor.timer) | ... | ... |