Commit 18e73fa39869002f5f20920360accd2a6936cda3

Authored by Perry Werneck
1 parent 99b409ca
Exists in master and in 1 other branch develop

Blinkgin SSL indicator while downloadin CRL.

src/include/internals.h
@@ -338,7 +338,7 @@ G_GNUC_INTERNAL void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned @@ -338,7 +338,7 @@ G_GNUC_INTERNAL void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned
338 G_GNUC_INTERNAL void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr); 338 G_GNUC_INTERNAL void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr);
339 G_GNUC_INTERNAL void v3270_update_oia(v3270 *terminal, LIB3270_FLAG id, unsigned char on); 339 G_GNUC_INTERNAL void v3270_update_oia(v3270 *terminal, LIB3270_FLAG id, unsigned char on);
340 340
341 - G_GNUC_INTERNAL void v3270_blink_ssl(v3270 *terminal); 341 + G_GNUC_INTERNAL gboolean v3270_blink_ssl(v3270 *terminal);
342 342
343 G_GNUC_INTERNAL void v3270_queue_draw_area(GtkWidget *widget, gint x, gint y, gint width, gint height); 343 G_GNUC_INTERNAL void v3270_queue_draw_area(GtkWidget *widget, gint x, gint y, gint width, gint height);
344 344
src/terminal/blink.c
@@ -34,6 +34,12 @@ @@ -34,6 +34,12 @@
34 34
35 /*--[ Implement ]------------------------------------------------------------------------------------*/ 35 /*--[ Implement ]------------------------------------------------------------------------------------*/
36 36
  37 + gboolean v3270_blink_ssl(v3270 *terminal)
  38 + {
  39 + LIB3270_SSL_STATE state = lib3270_get_ssl_state(terminal->host);
  40 + return (state == LIB3270_SSL_NEGOTIATING || state == LIB3270_SSL_VERIFYING);
  41 + }
  42 +
37 static gboolean blink_timer_tick(v3270 *widget) 43 static gboolean blink_timer_tick(v3270 *widget)
38 { 44 {
39 gboolean rc = FALSE; 45 gboolean rc = FALSE;
@@ -47,7 +53,7 @@ @@ -47,7 +53,7 @@
47 rc = TRUE; 53 rc = TRUE;
48 } 54 }
49 55
50 - if(lib3270_get_ssl_state(widget->host) == LIB3270_SSL_NEGOTIATING) 56 + if(v3270_blink_ssl(widget))
51 { 57 {
52 GdkRectangle * r; 58 GdkRectangle * r;
53 cairo_t * cr = v3270_oia_set_update_region(widget,&r,V3270_OIA_SSL); 59 cairo_t * cr = v3270_oia_set_update_region(widget,&r,V3270_OIA_SSL);
src/terminal/callbacks.c
@@ -349,9 +349,21 @@ static void popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title @@ -349,9 +349,21 @@ static void popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title
349 349
350 static gboolean bg_update_ssl(H3270 *session) 350 static gboolean bg_update_ssl(H3270 *session)
351 { 351 {
352 - v3270_blink_ssl(GTK_V3270(lib3270_get_user_data(session))); 352 + v3270 *terminal = GTK_V3270(lib3270_get_user_data(session));
353 353
354 - if(lib3270_get_ssl_state(session) == LIB3270_SSL_NEGOTIATING) 354 + if(terminal->surface)
  355 + {
  356 + // Redraw SSL area.
  357 + GdkRectangle * r;
  358 + cairo_t * cr = v3270_oia_set_update_region(terminal,&r,V3270_OIA_SSL);
  359 +
  360 + v3270_draw_ssl_status(terminal,cr,r);
  361 + v3270_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height);
  362 + cairo_destroy(cr);
  363 +
  364 + }
  365 +
  366 + if(v3270_blink_ssl(terminal))
355 v3270_start_blinking(GTK_WIDGET(lib3270_get_user_data(session))); 367 v3270_start_blinking(GTK_WIDGET(lib3270_get_user_data(session)));
356 368
357 return FALSE; 369 return FALSE;
@@ -359,6 +371,8 @@ static void popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title @@ -359,6 +371,8 @@ static void popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title
359 371
360 static void update_ssl(H3270 *session, G_GNUC_UNUSED LIB3270_SSL_STATE state) 372 static void update_ssl(H3270 *session, G_GNUC_UNUSED LIB3270_SSL_STATE state)
361 { 373 {
  374 + debug("----------------------> %d", (int) state);
  375 +
362 g_idle_add((GSourceFunc) bg_update_ssl, session); 376 g_idle_add((GSourceFunc) bg_update_ssl, session);
363 } 377 }
364 378
src/terminal/drawing/oia.c
@@ -363,6 +363,7 @@ void v3270_draw_ssl_status(v3270 *widget, cairo_t *cr, GdkRectangle *rect) @@ -363,6 +363,7 @@ void v3270_draw_ssl_status(v3270 *widget, cairo_t *cr, GdkRectangle *rect)
363 break; 363 break;
364 364
365 case LIB3270_SSL_NEGOTIATING: // Negotiating SSL 365 case LIB3270_SSL_NEGOTIATING: // Negotiating SSL
  366 + case LIB3270_SSL_VERIFYING: // Verifying SSL
366 if(widget->blink.show) 367 if(widget->blink.show)
367 { 368 {
368 gdk_cairo_set_source_rgba(cr,widget->color+V3270_COLOR_OIA_STATUS_WARNING); 369 gdk_cairo_set_source_rgba(cr,widget->color+V3270_COLOR_OIA_STATUS_WARNING);
@@ -1077,21 +1078,6 @@ void v3270_stop_timer(GtkWidget *widget) @@ -1077,21 +1078,6 @@ void v3270_stop_timer(GtkWidget *widget)
1077 1078
1078 } 1079 }
1079 1080
1080 -void v3270_blink_ssl(v3270 *terminal)  
1081 -{  
1082 - if(terminal->surface)  
1083 - {  
1084 - GdkRectangle * r;  
1085 - cairo_t * cr = v3270_oia_set_update_region(terminal,&r,V3270_OIA_SSL);  
1086 -  
1087 - v3270_draw_ssl_status(terminal,cr,r);  
1088 - v3270_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height);  
1089 - cairo_destroy(cr);  
1090 -  
1091 - }  
1092 -  
1093 -}  
1094 -  
1095 void v3270_update_oia(v3270 *terminal, LIB3270_FLAG id, unsigned char on) 1081 void v3270_update_oia(v3270 *terminal, LIB3270_FLAG id, unsigned char on)
1096 { 1082 {
1097 cairo_t *cr; 1083 cairo_t *cr;
src/terminal/mouse.c
@@ -363,11 +363,12 @@ gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event) @@ -363,11 +363,12 @@ gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event)
363 { 363 {
364 switch(lib3270_get_ssl_state(terminal->host)) 364 switch(lib3270_get_ssl_state(terminal->host))
365 { 365 {
366 - case LIB3270_SSL_UNSECURE: /**< No secure connection */ 366 + case LIB3270_SSL_UNSECURE: // No secure connection
367 id = LIB3270_POINTER_QUESTION; 367 id = LIB3270_POINTER_QUESTION;
368 break; 368 break;
369 369
370 - case LIB3270_SSL_NEGOTIATING: /**< Negotiating SSL */ 370 + case LIB3270_SSL_NEGOTIATING: // Negotiating SSL
  371 + case LIB3270_SSL_VERIFYING: // Verifying SSL
371 id = LIB3270_POINTER_WAITING; 372 id = LIB3270_POINTER_WAITING;
372 break; 373 break;
373 374
src/testprogram/testprogram.c
@@ -101,7 +101,7 @@ @@ -101,7 +101,7 @@
101 GtkWidget * notebook = gtk_notebook_new(); 101 GtkWidget * notebook = gtk_notebook_new();
102 102
103 // Hack to speed up the tests. 103 // Hack to speed up the tests.
104 - lib3270_ssl_set_crl_download(v3270_get_session(terminal),0); 104 + //lib3270_ssl_set_crl_download(v3270_get_session(terminal),0);
105 105
106 gtk_box_pack_start(GTK_BOX(vBox),create_toolbar(terminal),FALSE,TRUE,0); 106 gtk_box_pack_start(GTK_BOX(vBox),create_toolbar(terminal),FALSE,TRUE,0);
107 gtk_box_pack_start(GTK_BOX(vBox),notebook,TRUE,TRUE,0); 107 gtk_box_pack_start(GTK_BOX(vBox),notebook,TRUE,TRUE,0);