Commit b21d79663c4fd27c163b61cb0ea939e92c3ad59b
1 parent
56f78637
Exists in
master
and in
5 other branches
Reduzindo quantidade de pedidos de atualização posto que causa problemas na versão windows.
Showing
11 changed files
with
87 additions
and
42 deletions
Show diff stats
src/include/pw3270/v3270.h
@@ -216,6 +216,7 @@ | @@ -216,6 +216,7 @@ | ||
216 | // Cut & Paste | 216 | // Cut & Paste |
217 | LIB3270_EXPORT gboolean v3270_get_selection_bounds(GtkWidget *widget, gint *start, gint *end); | 217 | LIB3270_EXPORT gboolean v3270_get_selection_bounds(GtkWidget *widget, gint *start, gint *end); |
218 | LIB3270_EXPORT void v3270_unselect(GtkWidget *widget); | 218 | LIB3270_EXPORT void v3270_unselect(GtkWidget *widget); |
219 | + LIB3270_EXPORT void v3270_select_all(GtkWidget *widget); | ||
219 | LIB3270_EXPORT void v3270_paste(GtkWidget *widget); | 220 | LIB3270_EXPORT void v3270_paste(GtkWidget *widget); |
220 | LIB3270_EXPORT void v3270_paste_string(GtkWidget *widget, const gchar *text, const gchar *encoding); | 221 | LIB3270_EXPORT void v3270_paste_string(GtkWidget *widget, const gchar *text, const gchar *encoding); |
221 | LIB3270_EXPORT void v3270_select_region(GtkWidget *widget, gint start, gint end); | 222 | LIB3270_EXPORT void v3270_select_region(GtkWidget *widget, gint start, gint end); |
src/pw3270/actions.c
@@ -390,7 +390,7 @@ static void action_reset_toggle(GtkAction *action, GtkWidget *widget) | @@ -390,7 +390,7 @@ static void action_reset_toggle(GtkAction *action, GtkWidget *widget) | ||
390 | static void action_select_all(GtkAction *action, GtkWidget *widget) | 390 | static void action_select_all(GtkAction *action, GtkWidget *widget) |
391 | { | 391 | { |
392 | trace_action(action,widget); | 392 | trace_action(action,widget); |
393 | - lib3270_select_all(v3270_get_session(widget)); | 393 | + v3270_select_all(widget); |
394 | } | 394 | } |
395 | 395 | ||
396 | static void action_select_field(GtkAction *action, GtkWidget *widget) | 396 | static void action_select_field(GtkAction *action, GtkWidget *widget) |
src/pw3270/filetransfer.c
@@ -236,7 +236,7 @@ static void ft_state_changed(H3270FT *ft, LIB3270_FT_STATE state) | @@ -236,7 +236,7 @@ static void ft_state_changed(H3270FT *ft, LIB3270_FT_STATE state) | ||
236 | 236 | ||
237 | gint v3270_transfer_file(GtkWidget *widget, LIB3270_FT_OPTION options, const gchar *local, const gchar *remote, int lrecl, int blksize, int primspace, int secspace, int dft) | 237 | gint v3270_transfer_file(GtkWidget *widget, LIB3270_FT_OPTION options, const gchar *local, const gchar *remote, int lrecl, int blksize, int primspace, int secspace, int dft) |
238 | { | 238 | { |
239 | - g_return_val_if_fail(GTK_IS_V3270(widget),NULL); | 239 | + g_return_val_if_fail(GTK_IS_V3270(widget),0); |
240 | 240 | ||
241 | H3270FT * ft = lib3270_ft_new(v3270_get_session(widget),options,local,remote,lrecl,blksize,primspace,secspace,dft); | 241 | H3270FT * ft = lib3270_ft_new(v3270_get_session(widget),options,local,remote,lrecl,blksize,primspace,secspace,dft); |
242 | 242 |
src/pw3270/v3270/draw.c
@@ -337,7 +337,7 @@ void v3270_reload(GtkWidget *widget) | @@ -337,7 +337,7 @@ void v3270_reload(GtkWidget *widget) | ||
337 | 337 | ||
338 | cairo_t * cr; | 338 | cairo_t * cr; |
339 | 339 | ||
340 | - if(!gtk_widget_get_realized(widget)) | 340 | + if(!(gtk_widget_get_realized(widget) && terminal->drawing)) |
341 | return; | 341 | return; |
342 | 342 | ||
343 | // Create new terminal image | 343 | // Create new terminal image |
@@ -405,7 +405,7 @@ void v3270_update_char(H3270 *session, int addr, unsigned char chr, unsigned sho | @@ -405,7 +405,7 @@ void v3270_update_char(H3270 *session, int addr, unsigned char chr, unsigned sho | ||
405 | GdkRectangle rect; | 405 | GdkRectangle rect; |
406 | int rows,cols; | 406 | int rows,cols; |
407 | 407 | ||
408 | - if(!gtk_widget_get_realized(GTK_WIDGET(terminal))) | 408 | + if(!(gtk_widget_get_realized(GTK_WIDGET(terminal)) && terminal->drawing)) |
409 | return; | 409 | return; |
410 | 410 | ||
411 | if(!terminal->surface) | 411 | if(!terminal->surface) |
@@ -432,9 +432,7 @@ void v3270_update_char(H3270 *session, int addr, unsigned char chr, unsigned sho | @@ -432,9 +432,7 @@ void v3270_update_char(H3270 *session, int addr, unsigned char chr, unsigned sho | ||
432 | if(cursor) | 432 | if(cursor) |
433 | v3270_update_cursor_rect(terminal,&rect,chr,attr); | 433 | v3270_update_cursor_rect(terminal,&rect,chr,attr); |
434 | 434 | ||
435 | -// #ifndef _WIN32 | ||
436 | - gtk_widget_queue_draw_area(GTK_WIDGET(terminal),rect.x,rect.y,rect.width,rect.height); | ||
437 | -// #endif // WIN32 | 435 | + v3270_queue_draw_area(GTK_WIDGET(terminal),rect.x,rect.y,rect.width,rect.height); |
438 | 436 | ||
439 | } | 437 | } |
440 | 438 | ||
@@ -470,3 +468,11 @@ void v3270_update_cursor_rect(v3270 *widget, GdkRectangle *rect, unsigned char c | @@ -470,3 +468,11 @@ void v3270_update_cursor_rect(v3270 *widget, GdkRectangle *rect, unsigned char c | ||
470 | v3270_update_cursor_surface(widget,chr,attr); | 468 | v3270_update_cursor_surface(widget,chr,attr); |
471 | } | 469 | } |
472 | 470 | ||
471 | +void v3270_queue_draw_area(GtkWidget *widget, gint x, gint y, gint width, gint height) | ||
472 | +{ | ||
473 | + if(GTK_V3270(widget)->drawing && gtk_widget_get_realized(widget)) | ||
474 | + { | ||
475 | + gtk_widget_queue_draw_area(widget,x,y,width,height); | ||
476 | + } | ||
477 | + | ||
478 | +} |
src/pw3270/v3270/hostselect.c
@@ -429,7 +429,7 @@ LIB3270_EXPORT void v3270_select_host(GtkWidget *widget) | @@ -429,7 +429,7 @@ LIB3270_EXPORT void v3270_select_host(GtkWidget *widget) | ||
429 | 429 | ||
430 | LIB3270_EXPORT int v3270_host_select_apply(V3270HostSelectWidget *widget) | 430 | LIB3270_EXPORT int v3270_host_select_apply(V3270HostSelectWidget *widget) |
431 | { | 431 | { |
432 | - g_return_if_fail(GTK_IS_V3270HostSelectWidget(widget)); | 432 | + g_return_val_if_fail(GTK_IS_V3270HostSelectWidget(widget),0); |
433 | 433 | ||
434 | lib3270_set_hostname(widget->hSession,gtk_entry_get_text(widget->entry[ENTRY_HOSTNAME])); | 434 | lib3270_set_hostname(widget->hSession,gtk_entry_get_text(widget->entry[ENTRY_HOSTNAME])); |
435 | lib3270_set_srvcname(widget->hSession,gtk_entry_get_text(widget->entry[ENTRY_SRVCNAME])); | 435 | lib3270_set_srvcname(widget->hSession,gtk_entry_get_text(widget->entry[ENTRY_SRVCNAME])); |
src/pw3270/v3270/mouse.c
@@ -71,9 +71,11 @@ static void single_click(v3270 *widget, int baddr) | @@ -71,9 +71,11 @@ static void single_click(v3270 *widget, int baddr) | ||
71 | { | 71 | { |
72 | case 0x00: | 72 | case 0x00: |
73 | // Unselected area, move cursor and remove selection | 73 | // Unselected area, move cursor and remove selection |
74 | + v3270_disable_updates(widget); | ||
74 | lib3270_set_cursor_address(widget->host,baddr); | 75 | lib3270_set_cursor_address(widget->host,baddr); |
75 | lib3270_unselect(widget->host); | 76 | lib3270_unselect(widget->host); |
76 | widget->selecting = 1; | 77 | widget->selecting = 1; |
78 | + v3270_enable_updates(widget); | ||
77 | break; | 79 | break; |
78 | 80 | ||
79 | 81 |
src/pw3270/v3270/oia.c
@@ -714,7 +714,7 @@ void v3270_update_luname(GtkWidget *widget,const gchar *name) | @@ -714,7 +714,7 @@ void v3270_update_luname(GtkWidget *widget,const gchar *name) | ||
714 | 714 | ||
715 | cairo_destroy(cr); | 715 | cairo_destroy(cr); |
716 | 716 | ||
717 | - gtk_widget_queue_draw_area(GTK_WIDGET(terminal),rect->x,rect->y,rect->width,rect->height); | 717 | + v3270_queue_draw_area(GTK_WIDGET(terminal),rect->x,rect->y,rect->width,rect->height); |
718 | } | 718 | } |
719 | 719 | ||
720 | #if GTK_CHECK_VERSION(2,26,0) | 720 | #if GTK_CHECK_VERSION(2,26,0) |
@@ -739,7 +739,7 @@ void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id) | @@ -739,7 +739,7 @@ void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id) | ||
739 | 739 | ||
740 | cairo_destroy(cr); | 740 | cairo_destroy(cr); |
741 | 741 | ||
742 | - gtk_widget_queue_draw_area(GTK_WIDGET(widget),rect->x,rect->y,rect->width,rect->height); | 742 | + v3270_queue_draw_area(GTK_WIDGET(widget),rect->x,rect->y,rect->width,rect->height); |
743 | 743 | ||
744 | if(widget->accessible) | 744 | if(widget->accessible) |
745 | v3270_acessible_set_state(widget->accessible,id); | 745 | v3270_acessible_set_state(widget->accessible,id); |
@@ -780,28 +780,28 @@ void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, | @@ -780,28 +780,28 @@ void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, | ||
780 | terminal->cursor.rect.height = terminal->font.height+terminal->font.descent; | 780 | terminal->cursor.rect.height = terminal->font.height+terminal->font.descent; |
781 | terminal->cursor.show |= 1; | 781 | terminal->cursor.show |= 1; |
782 | 782 | ||
783 | - gtk_widget_queue_draw_area( GTK_WIDGET(terminal), saved.x, | ||
784 | - saved.y, | ||
785 | - saved.width, | ||
786 | - saved.height); | 783 | + v3270_queue_draw_area( GTK_WIDGET(terminal), saved.x, |
784 | + saved.y, | ||
785 | + saved.width, | ||
786 | + saved.height); | ||
787 | 787 | ||
788 | 788 | ||
789 | v3270_update_cursor_surface(terminal,c,attr); | 789 | v3270_update_cursor_surface(terminal,c,attr); |
790 | 790 | ||
791 | - gtk_widget_queue_draw_area( GTK_WIDGET(terminal), | ||
792 | - terminal->cursor.rect.x,terminal->cursor.rect.y, | ||
793 | - terminal->cursor.rect.width,terminal->cursor.rect.height); | 791 | + v3270_queue_draw_area( GTK_WIDGET(terminal), |
792 | + terminal->cursor.rect.x,terminal->cursor.rect.y, | ||
793 | + terminal->cursor.rect.width,terminal->cursor.rect.height); | ||
794 | 794 | ||
795 | if(lib3270_get_toggle(session,LIB3270_TOGGLE_CROSSHAIR)) | 795 | if(lib3270_get_toggle(session,LIB3270_TOGGLE_CROSSHAIR)) |
796 | { | 796 | { |
797 | GtkAllocation allocation; | 797 | GtkAllocation allocation; |
798 | gtk_widget_get_allocation(GTK_WIDGET(terminal), &allocation); | 798 | gtk_widget_get_allocation(GTK_WIDGET(terminal), &allocation); |
799 | 799 | ||
800 | - gtk_widget_queue_draw_area(GTK_WIDGET(terminal),0,saved.y+terminal->font.height,allocation.width,1); | ||
801 | - gtk_widget_queue_draw_area(GTK_WIDGET(terminal),saved.x,0,1,terminal->oia_rect->y-3); | 800 | + v3270_queue_draw_area(GTK_WIDGET(terminal),0,saved.y+terminal->font.height,allocation.width,1); |
801 | + v3270_queue_draw_area(GTK_WIDGET(terminal),saved.x,0,1,terminal->oia_rect->y-3); | ||
802 | 802 | ||
803 | - gtk_widget_queue_draw_area(GTK_WIDGET(terminal),0,terminal->cursor.rect.y+terminal->font.height,allocation.width,1); | ||
804 | - gtk_widget_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),0,terminal->cursor.rect.y+terminal->font.height,allocation.width,1); |
804 | + v3270_queue_draw_area(GTK_WIDGET(terminal),terminal->cursor.rect.x,0,1,terminal->oia_rect->y-3); | ||
805 | } | 805 | } |
806 | 806 | ||
807 | if(lib3270_get_toggle(session,LIB3270_TOGGLE_CURSOR_POS)) | 807 | if(lib3270_get_toggle(session,LIB3270_TOGGLE_CURSOR_POS)) |
@@ -816,7 +816,7 @@ void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, | @@ -816,7 +816,7 @@ void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, | ||
816 | 816 | ||
817 | cairo_destroy(cr); | 817 | cairo_destroy(cr); |
818 | 818 | ||
819 | - gtk_widget_queue_draw_area(GTK_WIDGET(terminal),rect->x,rect->y,rect->width,rect->height); | 819 | + v3270_queue_draw_area(GTK_WIDGET(terminal),rect->x,rect->y,rect->width,rect->height); |
820 | } | 820 | } |
821 | 821 | ||
822 | if(terminal->accessible) | 822 | if(terminal->accessible) |
@@ -862,7 +862,7 @@ static void release_timer(struct timer_info *info) | @@ -862,7 +862,7 @@ static void release_timer(struct timer_info *info) | ||
862 | GdkRectangle *rect = info->terminal->oia_rect + id[f]; | 862 | GdkRectangle *rect = info->terminal->oia_rect + id[f]; |
863 | cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height); | 863 | cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height); |
864 | cairo_fill(cr); | 864 | cairo_fill(cr); |
865 | - gtk_widget_queue_draw_area(GTK_WIDGET(info->terminal),rect->x,rect->y,rect->width,rect->height); | 865 | + v3270_queue_draw_area(GTK_WIDGET(info->terminal),rect->x,rect->y,rect->width,rect->height); |
866 | } | 866 | } |
867 | cairo_destroy(cr); | 867 | cairo_destroy(cr); |
868 | } | 868 | } |
@@ -919,7 +919,7 @@ void v3270_draw_shift_status(v3270 *terminal) | @@ -919,7 +919,7 @@ void v3270_draw_shift_status(v3270 *terminal) | ||
919 | } | 919 | } |
920 | 920 | ||
921 | cairo_destroy(cr); | 921 | cairo_destroy(cr); |
922 | - gtk_widget_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); | 922 | + v3270_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); |
923 | 923 | ||
924 | } | 924 | } |
925 | 925 | ||
@@ -943,7 +943,7 @@ static void update_text_field(v3270 *terminal, gboolean flag, V3270_OIA_FIELD id | @@ -943,7 +943,7 @@ static void update_text_field(v3270 *terminal, gboolean flag, V3270_OIA_FIELD id | ||
943 | } | 943 | } |
944 | 944 | ||
945 | cairo_destroy(cr); | 945 | cairo_destroy(cr); |
946 | - gtk_widget_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); | 946 | + v3270_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); |
947 | } | 947 | } |
948 | 948 | ||
949 | void v3270_draw_alt_status(v3270 *terminal) | 949 | void v3270_draw_alt_status(v3270 *terminal) |
@@ -966,7 +966,7 @@ void v3270_draw_ins_status(v3270 *terminal) | @@ -966,7 +966,7 @@ void v3270_draw_ins_status(v3270 *terminal) | ||
966 | draw_insert(cr,terminal->host,terminal->color,r); | 966 | draw_insert(cr,terminal->host,terminal->color,r); |
967 | 967 | ||
968 | cairo_destroy(cr); | 968 | cairo_destroy(cr); |
969 | - gtk_widget_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); | 969 | + v3270_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); |
970 | 970 | ||
971 | } | 971 | } |
972 | 972 | ||
@@ -1010,7 +1010,7 @@ static gboolean update_timer(struct timer_info *info) | @@ -1010,7 +1010,7 @@ static gboolean update_timer(struct timer_info *info) | ||
1010 | cairo_stroke(cr); | 1010 | cairo_stroke(cr); |
1011 | 1011 | ||
1012 | info->last = now; | 1012 | info->last = now; |
1013 | - gtk_widget_queue_draw_area(GTK_WIDGET(info->terminal),rect->x,rect->y,rect->width,rect->height); | 1013 | + v3270_queue_draw_area(GTK_WIDGET(info->terminal),rect->x,rect->y,rect->width,rect->height); |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | #ifdef HAVE_LIBM | 1016 | #ifdef HAVE_LIBM |
@@ -1030,7 +1030,7 @@ static gboolean update_timer(struct timer_info *info) | @@ -1030,7 +1030,7 @@ static gboolean update_timer(struct timer_info *info) | ||
1030 | 1030 | ||
1031 | info->step = draw_spinner(cr, rect, info->terminal->color, info->step); | 1031 | info->step = draw_spinner(cr, rect, info->terminal->color, info->step); |
1032 | 1032 | ||
1033 | - gtk_widget_queue_draw_area(GTK_WIDGET(info->terminal),rect->x,rect->y,rect->width,rect->height); | 1033 | + v3270_queue_draw_area(GTK_WIDGET(info->terminal),rect->x,rect->y,rect->width,rect->height); |
1034 | 1034 | ||
1035 | #endif // HAVE_LIBM | 1035 | #endif // HAVE_LIBM |
1036 | 1036 | ||
@@ -1090,7 +1090,7 @@ void v3270_update_ssl(H3270 *session, LIB3270_SSL_STATE state) | @@ -1090,7 +1090,7 @@ void v3270_update_ssl(H3270 *session, LIB3270_SSL_STATE state) | ||
1090 | 1090 | ||
1091 | cr = set_update_region(terminal,&r,V3270_OIA_SSL); | 1091 | cr = set_update_region(terminal,&r,V3270_OIA_SSL); |
1092 | v3270_draw_ssl_status(cr,terminal->host,&terminal->font,terminal->color,r); | 1092 | v3270_draw_ssl_status(cr,terminal->host,&terminal->font,terminal->color,r); |
1093 | - gtk_widget_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); | 1093 | + v3270_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); |
1094 | cairo_destroy(cr); | 1094 | cairo_destroy(cr); |
1095 | 1095 | ||
1096 | } | 1096 | } |
@@ -1102,7 +1102,7 @@ void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) | @@ -1102,7 +1102,7 @@ void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) | ||
1102 | 1102 | ||
1103 | v3270 *terminal = GTK_V3270(session->user_data); | 1103 | v3270 *terminal = GTK_V3270(session->user_data); |
1104 | 1104 | ||
1105 | - if(!terminal->surface) | 1105 | + if(!(terminal->surface && terminal->drawing)) |
1106 | return; | 1106 | return; |
1107 | 1107 | ||
1108 | switch(id) | 1108 | switch(id) |
@@ -1111,7 +1111,7 @@ void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) | @@ -1111,7 +1111,7 @@ void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) | ||
1111 | debug("%s",__FUNCTION__); | 1111 | debug("%s",__FUNCTION__); |
1112 | cr = set_update_region(terminal,&r,V3270_OIA_CONNECTION); | 1112 | cr = set_update_region(terminal,&r,V3270_OIA_CONNECTION); |
1113 | v3270_draw_connection(cr,terminal->host,&terminal->font,terminal->color,r); | 1113 | v3270_draw_connection(cr,terminal->host,&terminal->font,terminal->color,r); |
1114 | - gtk_widget_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); | 1114 | + v3270_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); |
1115 | cairo_destroy(cr); | 1115 | cairo_destroy(cr); |
1116 | break; | 1116 | break; |
1117 | 1117 | ||
@@ -1119,7 +1119,7 @@ void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) | @@ -1119,7 +1119,7 @@ void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) | ||
1119 | debug("%s",__FUNCTION__); | 1119 | debug("%s",__FUNCTION__); |
1120 | cr = set_update_region(terminal,&r,V3270_OIA_UNDERA); | 1120 | cr = set_update_region(terminal,&r,V3270_OIA_UNDERA); |
1121 | draw_undera(cr,terminal->host,&terminal->font,terminal->color,r); | 1121 | draw_undera(cr,terminal->host,&terminal->font,terminal->color,r); |
1122 | - gtk_widget_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); | 1122 | + v3270_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); |
1123 | cairo_destroy(cr); | 1123 | cairo_destroy(cr); |
1124 | break; | 1124 | break; |
1125 | 1125 |
src/pw3270/v3270/private.h
@@ -127,6 +127,7 @@ G_BEGIN_DECLS | @@ -127,6 +127,7 @@ G_BEGIN_DECLS | ||
127 | int resizing : 1; /**< Resizing selected region */ | 127 | int resizing : 1; /**< Resizing selected region */ |
128 | int table : 1; /**< Copy mode is table */ | 128 | int table : 1; /**< Copy mode is table */ |
129 | int scaled_fonts : 1; /**< Use scaled fonts */ | 129 | int scaled_fonts : 1; /**< Use scaled fonts */ |
130 | + int drawing : 1; /**< Draw widget? */ | ||
130 | 131 | ||
131 | #if GTK_CHECK_VERSION(3,0,0) | 132 | #if GTK_CHECK_VERSION(3,0,0) |
132 | 133 | ||
@@ -290,6 +291,10 @@ void v3270_update_ssl(H3270 *session, LIB3270_SSL_STATE state); | @@ -290,6 +291,10 @@ void v3270_update_ssl(H3270 *session, LIB3270_SSL_STATE state); | ||
290 | 291 | ||
291 | G_GNUC_INTERNAL void v3270_update_luname(GtkWidget *widget,const gchar *name); | 292 | G_GNUC_INTERNAL void v3270_update_luname(GtkWidget *widget,const gchar *name); |
292 | G_GNUC_INTERNAL void v3270_init_properties(GObjectClass * gobject_class); | 293 | G_GNUC_INTERNAL void v3270_init_properties(GObjectClass * gobject_class); |
294 | +G_GNUC_INTERNAL void v3270_queue_draw_area(GtkWidget *widget, gint x, gint y, gint width, gint height); | ||
295 | + | ||
296 | +G_GNUC_INTERNAL void v3270_disable_updates(GtkWidget *widget); | ||
297 | +G_GNUC_INTERNAL void v3270_enable_updates(GtkWidget *widget); | ||
293 | 298 | ||
294 | // Keyboard & Mouse | 299 | // Keyboard & Mouse |
295 | gboolean v3270_key_press_event(GtkWidget *widget, GdkEventKey *event); | 300 | gboolean v3270_key_press_event(GtkWidget *widget, GdkEventKey *event); |
src/pw3270/v3270/selection.c
@@ -484,7 +484,9 @@ void v3270_paste(GtkWidget *widget) | @@ -484,7 +484,9 @@ void v3270_paste(GtkWidget *widget) | ||
484 | 484 | ||
485 | void v3270_unselect(GtkWidget *widget) | 485 | void v3270_unselect(GtkWidget *widget) |
486 | { | 486 | { |
487 | + v3270_disable_updates(widget); | ||
487 | lib3270_unselect(v3270_get_session(widget)); | 488 | lib3270_unselect(v3270_get_session(widget)); |
489 | + v3270_enable_updates(widget); | ||
488 | } | 490 | } |
489 | 491 | ||
490 | gboolean v3270_get_selection_bounds(GtkWidget *widget, gint *start, gint *end) | 492 | gboolean v3270_get_selection_bounds(GtkWidget *widget, gint *start, gint *end) |
@@ -517,4 +519,12 @@ gchar * v3270_get_region(GtkWidget *widget, gint start_pos, gint end_pos, gboole | @@ -517,4 +519,12 @@ gchar * v3270_get_region(GtkWidget *widget, gint start_pos, gint end_pos, gboole | ||
517 | lib3270_select_region(GTK_V3270(widget)->host,start,end); | 519 | lib3270_select_region(GTK_V3270(widget)->host,start,end); |
518 | } | 520 | } |
519 | 521 | ||
522 | +void v3270_select_all(GtkWidget *widget) | ||
523 | +{ | ||
524 | + g_return_if_fail(GTK_IS_V3270(widget)); | ||
525 | + v3270_disable_updates(widget); | ||
526 | + lib3270_select_all(v3270_get_session(widget)); | ||
527 | + v3270_enable_updates(widget); | ||
528 | +} | ||
529 | + | ||
520 | 530 |
src/pw3270/v3270/widget.c
@@ -109,9 +109,9 @@ static void v3270_cursor_draw(v3270 *widget) | @@ -109,9 +109,9 @@ static void v3270_cursor_draw(v3270 *widget) | ||
109 | 109 | ||
110 | lib3270_get_contents(widget->host,pos,pos,&c,&attr); | 110 | lib3270_get_contents(widget->host,pos,pos,&c,&attr); |
111 | v3270_update_cursor_surface(widget,c,attr); | 111 | v3270_update_cursor_surface(widget,c,attr); |
112 | - gtk_widget_queue_draw_area( GTK_WIDGET(widget), | ||
113 | - widget->cursor.rect.x,widget->cursor.rect.y, | ||
114 | - widget->cursor.rect.width,widget->cursor.rect.height); | 112 | + v3270_queue_draw_area( GTK_WIDGET(widget), |
113 | + widget->cursor.rect.x,widget->cursor.rect.y, | ||
114 | + widget->cursor.rect.width,widget->cursor.rect.height); | ||
115 | 115 | ||
116 | } | 116 | } |
117 | 117 | ||
@@ -985,6 +985,9 @@ static void v3270_init(v3270 *widget) | @@ -985,6 +985,9 @@ static void v3270_init(v3270 *widget) | ||
985 | // Setup auto disconnect timer | 985 | // Setup auto disconnect timer |
986 | widget->cursor.timer = NULL; | 986 | widget->cursor.timer = NULL; |
987 | 987 | ||
988 | + // Enable drawing | ||
989 | + widget->drawing = 1; | ||
990 | + | ||
988 | trace("%s",__FUNCTION__); | 991 | trace("%s",__FUNCTION__); |
989 | } | 992 | } |
990 | 993 | ||
@@ -1100,10 +1103,10 @@ static gboolean timer_tick(v3270 *widget) | @@ -1100,10 +1103,10 @@ static gboolean timer_tick(v3270 *widget) | ||
1100 | if(lib3270_get_toggle(widget->host,LIB3270_TOGGLE_CURSOR_BLINK)) | 1103 | if(lib3270_get_toggle(widget->host,LIB3270_TOGGLE_CURSOR_BLINK)) |
1101 | { | 1104 | { |
1102 | widget->cursor.show ^= 1; | 1105 | widget->cursor.show ^= 1; |
1103 | - gtk_widget_queue_draw_area(GTK_WIDGET(widget), widget->cursor.rect.x, | ||
1104 | - widget->cursor.rect.y, | ||
1105 | - widget->cursor.rect.width, | ||
1106 | - widget->cursor.rect.height ); | 1106 | + v3270_queue_draw_area(GTK_WIDGET(widget), widget->cursor.rect.x, |
1107 | + widget->cursor.rect.y, | ||
1108 | + widget->cursor.rect.width, | ||
1109 | + widget->cursor.rect.height ); | ||
1107 | } | 1110 | } |
1108 | 1111 | ||
1109 | return TRUE; | 1112 | return TRUE; |
@@ -1485,7 +1488,10 @@ const gchar * v3270_get_font_family(GtkWidget *widget) | @@ -1485,7 +1488,10 @@ const gchar * v3270_get_font_family(GtkWidget *widget) | ||
1485 | void v3270_disconnect(GtkWidget *widget) | 1488 | void v3270_disconnect(GtkWidget *widget) |
1486 | { | 1489 | { |
1487 | g_return_if_fail(GTK_IS_V3270(widget)); | 1490 | g_return_if_fail(GTK_IS_V3270(widget)); |
1491 | + v3270_disable_updates(widget); | ||
1492 | + lib3270_unselect(GTK_V3270(widget)->host); | ||
1488 | lib3270_disconnect(GTK_V3270(widget)->host); | 1493 | lib3270_disconnect(GTK_V3270(widget)->host); |
1494 | + v3270_enable_updates(widget); | ||
1489 | } | 1495 | } |
1490 | 1496 | ||
1491 | H3270 * v3270_get_session(GtkWidget *widget) | 1497 | H3270 * v3270_get_session(GtkWidget *widget) |
@@ -1595,8 +1601,8 @@ gboolean v3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE ix) | @@ -1595,8 +1601,8 @@ gboolean v3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE ix) | ||
1595 | **/ | 1601 | **/ |
1596 | const gchar * v3270_set_url(GtkWidget *widget, const gchar *uri) | 1602 | const gchar * v3270_set_url(GtkWidget *widget, const gchar *uri) |
1597 | { | 1603 | { |
1598 | - g_return_if_fail(GTK_IS_V3270(widget)); | ||
1599 | - g_return_if_fail(uri != NULL); | 1604 | + g_return_val_if_fail(GTK_IS_V3270(widget),""); |
1605 | + g_return_val_if_fail(uri != NULL,""); | ||
1600 | return lib3270_set_url(GTK_V3270(widget)->host,uri); | 1606 | return lib3270_set_url(GTK_V3270(widget)->host,uri); |
1601 | } | 1607 | } |
1602 | 1608 | ||
@@ -1687,3 +1693,18 @@ GtkWidget * v3270_get_default_widget(void) | @@ -1687,3 +1693,18 @@ GtkWidget * v3270_get_default_widget(void) | ||
1687 | 1693 | ||
1688 | return GTK_WIDGET(hSession->user_data); | 1694 | return GTK_WIDGET(hSession->user_data); |
1689 | } | 1695 | } |
1696 | + | ||
1697 | +void v3270_disable_updates(GtkWidget *widget) | ||
1698 | +{ | ||
1699 | + GTK_V3270(widget)->drawing = 0; | ||
1700 | +} | ||
1701 | + | ||
1702 | +void v3270_enable_updates(GtkWidget *widget) | ||
1703 | +{ | ||
1704 | + if(gtk_widget_get_realized(widget)) | ||
1705 | + { | ||
1706 | + GTK_V3270(widget)->drawing = 1; | ||
1707 | + v3270_reload(widget); | ||
1708 | + gtk_widget_queue_draw(widget); | ||
1709 | + } | ||
1710 | +} |
src/pw3270/window.c
@@ -233,7 +233,7 @@ | @@ -233,7 +233,7 @@ | ||
233 | 233 | ||
234 | const gchar * pw3270_set_url(GtkWidget *widget, const gchar *uri) | 234 | const gchar * pw3270_set_url(GtkWidget *widget, const gchar *uri) |
235 | { | 235 | { |
236 | - g_return_if_fail(GTK_IS_PW3270(widget)); | 236 | + g_return_val_if_fail(GTK_IS_PW3270(widget),""); |
237 | return v3270_set_url(GTK_PW3270(widget)->terminal,uri); | 237 | return v3270_set_url(GTK_PW3270(widget)->terminal,uri); |
238 | } | 238 | } |
239 | 239 |