Commit 245f6d5a587c058116f46c81f78d42dda63b08ef

Authored by Perry Werneck
1 parent 1280051c
Exists in master and in 1 other branch develop

Moving terminal definitions to separated include file.

Fixing memory leaks detected with valgrind
@@ -94,8 +94,7 @@ DEPENDS= \ @@ -94,8 +94,7 @@ DEPENDS= \
94 src/include/v3270/*.h \ 94 src/include/v3270/*.h \
95 src/filetransfer/marshal.h \ 95 src/filetransfer/marshal.h \
96 src/filetransfer/private.h \ 96 src/filetransfer/private.h \
97 - src/terminal/marshal.h \  
98 - src/terminal/private.h 97 + src/terminal/marshal.h
99 98
100 CFLAGS= \ 99 CFLAGS= \
101 @CFLAGS@ \ 100 @CFLAGS@ \
src/dialogs/print/print.c
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 29
30 #include "private.h" 30 #include "private.h"
31 #include <sys/param.h> 31 #include <sys/param.h>
32 - #include "../../terminal/private.h" // Required for v3270 signal. 32 + #include <terminal.h>
33 #include <v3270/colorscheme.h> 33 #include <v3270/colorscheme.h>
34 #include <lib3270/selection.h> 34 #include <lib3270/selection.h>
35 35
src/include/terminal.h 0 → 100644
@@ -0,0 +1,183 @@ @@ -0,0 +1,183 @@
  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 <internals.h>
  32 +
  33 +G_BEGIN_DECLS
  34 +
  35 + struct _v3270Class
  36 + {
  37 + GtkWidgetClass parent_class;
  38 +
  39 + // Internal properties.
  40 + struct {
  41 +
  42 + size_t count; // Number of properties.
  43 +
  44 + GParamSpec * font_family;
  45 + GParamSpec * toggle[LIB3270_TOGGLE_COUNT]; // Toggle properties.
  46 +
  47 + // Signal related properties
  48 + GParamSpec * online;
  49 + GParamSpec * luname;
  50 + GParamSpec * model;
  51 + GParamSpec * selection;
  52 +
  53 + struct
  54 + {
  55 + guint toggle;
  56 + guint boolean;
  57 + guint integer;
  58 + guint str;
  59 + } type;
  60 +
  61 + } properties;
  62 +
  63 + // Cursors
  64 + GdkCursor * cursors[LIB3270_POINTER_COUNT];
  65 +
  66 + // Signals
  67 + void (*activate)(GtkWidget *widget);
  68 + void (*toggle_changed)(v3270 *widget,LIB3270_TOGGLE toggle_id,gboolean toggle_state,const gchar *toggle_name);
  69 + void (*message_changed)(v3270 *widget, LIB3270_MESSAGE id);
  70 + void (*popup_message)(GtkWidget *widget, LIB3270_NOTIFY id , const gchar *title, const gchar *message, const gchar *text);
  71 +
  72 + };
  73 +
  74 +/*--[ Defines]---------------------------------------------------------------------------------------*/
  75 +
  76 + #define OIA_TOP_MARGIN 2
  77 +
  78 + #define KEY_FLAG_SHIFT 0x0001
  79 +
  80 + #ifndef WIN32
  81 + #define KEY_FLAG_ALT 0x0002
  82 + #endif // !WIN32
  83 +
  84 +/*--[ Globals ]--------------------------------------------------------------------------------------*/
  85 +
  86 + struct v3270_ssl_status_msg
  87 + {
  88 + long id;
  89 + const gchar * icon;
  90 + const gchar * text;
  91 + const gchar * message;
  92 + };
  93 +
  94 +/*--[ Widget data ]----------------------------------------------------------------------------------*/
  95 +
  96 + struct _v3270
  97 + {
  98 + GtkWidget parent;
  99 +
  100 + // flags
  101 + int selecting : 1; /**< Selecting region */
  102 + int moving : 1; /**< Moving selected region */
  103 + int resizing : 1; /**< Resizing selected region */
  104 + int table : 1; /**< Copy mode is table */
  105 + int scaled_fonts : 1; /**< Use scaled fonts */
  106 + int drawing : 1; /**< Draw widget? */
  107 +
  108 +#if GTK_CHECK_VERSION(3,0,0)
  109 +
  110 +#else
  111 + gint width;
  112 + gint height;
  113 +#endif // GTK_CHECK_VERSION(3,0,0)
  114 +
  115 + GSource * timer;
  116 + GtkIMContext * input_method;
  117 + unsigned short keyflags;
  118 +
  119 + struct
  120 + {
  121 + char * text; /**< Clipboard contents (lib3270 charset) */
  122 + int baddr; /**< Selection addr */
  123 + } selection;
  124 +
  125 + LIB3270_POINTER pointer_id;
  126 + unsigned char pointer; /**< Mouse pointer ID */
  127 +
  128 + // Font info
  129 + cairo_surface_t * surface;
  130 + v3270FontInfo font;
  131 +
  132 + gint minimum_width;
  133 + gint minimum_height;
  134 +
  135 + // Colors
  136 + GdkRGBA color[V3270_COLOR_COUNT]; /**< Terminal widget colors */
  137 +
  138 + // OIA
  139 + struct
  140 + {
  141 + GdkRectangle rect[V3270_OIA_FIELD_COUNT];
  142 + V3270_OIA_FIELD selected; /**< Clicked OIA field */
  143 + } oia;
  144 +
  145 + struct
  146 + {
  147 + unsigned char show; /**< Cursor flag */
  148 + unsigned char chr; /**< Char at cursor position */
  149 + unsigned short attr; /**< Attribute at cursor position */
  150 + GdkRectangle rect; /**< Cursor rectangle */
  151 + GSource * timer; /**< Cursor blinking timer */
  152 + cairo_surface_t * surface; /**< Cursor image */
  153 + } cursor;
  154 +
  155 + // Acessibility
  156 + GtkAccessible * accessible;
  157 +
  158 + // Session
  159 + H3270 * host; /**< Related 3270 session */
  160 + gchar * session_name; /**< Session name (for window title) */
  161 +
  162 + // Auto disconnect
  163 + struct
  164 + {
  165 + time_t timestamp; /**< Last action in this widget */
  166 + guint disconnect; /**< Time (in minutes) for auto disconnect */
  167 + GSource * timer; /**< Auto disconnect timer */
  168 + } activity;
  169 +
  170 + char script; /**< @brief Script ID */
  171 +
  172 + // Blink
  173 + struct
  174 + {
  175 + int show : 1; /**< @brief Show element? */
  176 + GSource * timer; /**< @brief Timer source. */
  177 + } blink;
  178 +
  179 + };
  180 +
  181 +/*--[ Globals ]--------------------------------------------------------------------------------------*/
  182 +
  183 +G_END_DECLS
src/terminal/accessible.c
@@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
40 #include <lib3270/log.h> 40 #include <lib3270/log.h>
41 #include <v3270.h> 41 #include <v3270.h>
42 #include <internals.h> 42 #include <internals.h>
43 - #include "private.h" 43 + #include <terminal.h>
44 #include <v3270/accessible.h> 44 #include <v3270/accessible.h>
45 45
46 #ifdef GDK_WINDOWING_X11 46 #ifdef GDK_WINDOWING_X11
src/terminal/blink.c
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 */ 28 */
29 29
30 #include <config.h> 30 #include <config.h>
31 - #include "private.h" 31 + #include <terminal.h>
32 #include <internals.h> 32 #include <internals.h>
33 33
34 /*--[ Implement ]------------------------------------------------------------------------------------*/ 34 /*--[ Implement ]------------------------------------------------------------------------------------*/
src/terminal/callbacks.c
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 #include <winsock2.h> 33 #include <winsock2.h>
34 #endif // _WIN32 34 #endif // _WIN32
35 35
36 - #include "private.h" 36 + #include <terminal.h>
37 #include <internals.h> 37 #include <internals.h>
38 38
39 #include <gtk/gtk.h> 39 #include <gtk/gtk.h>
src/terminal/charset.c
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 * 27 *
28 */ 28 */
29 29
30 - #include "private.h" 30 + #include <terminal.h>
31 #include <v3270.h> 31 #include <v3270.h>
32 #include <lib3270/charset.h> 32 #include <lib3270/charset.h>
33 #include <lib3270/log.h> 33 #include <lib3270/log.h>
src/terminal/colors.c
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 */ 28 */
29 29
30 #include <config.h> 30 #include <config.h>
31 - #include "private.h" 31 + #include <terminal.h>
32 32
33 #include <lib3270.h> 33 #include <lib3270.h>
34 #include <lib3270/log.h> 34 #include <lib3270/log.h>
src/terminal/draw.c
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 #include <internals.h> 42 #include <internals.h>
43 43
44 #include <v3270.h> 44 #include <v3270.h>
45 - #include "private.h" 45 + #include <terminal.h>
46 46
47 /*--[ Implement ]------------------------------------------------------------------------------------*/ 47 /*--[ Implement ]------------------------------------------------------------------------------------*/
48 48
src/terminal/font.c
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 */ 28 */
29 29
30 #include <config.h> 30 #include <config.h>
31 - #include "private.h" 31 + #include <terminal.h>
32 #include <lib3270.h> 32 #include <lib3270.h>
33 #include <lib3270/log.h> 33 #include <lib3270/log.h>
34 34
src/terminal/iocallback.c
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 #include <lib3270.h> 31 #include <lib3270.h>
32 #include <lib3270/log.h> 32 #include <lib3270/log.h>
33 #include <internals.h> 33 #include <internals.h>
34 -#include "private.h" 34 +#include <terminal.h>
35 35
36 static void * static_AddSource(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata); 36 static void * static_AddSource(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata);
37 static void static_RemoveSource(H3270 *session, void *id); 37 static void static_RemoveSource(H3270 *session, void *id);
src/terminal/keyboard.c
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 39
40 #include <v3270.h> 40 #include <v3270.h>
41 #include <internals.h> 41 #include <internals.h>
42 - #include "private.h" 42 + #include <terminal.h>
43 43
44 #if GTK_CHECK_VERSION(3,0,0) 44 #if GTK_CHECK_VERSION(3,0,0)
45 #include <gdk/gdkkeysyms-compat.h> 45 #include <gdk/gdkkeysyms-compat.h>
src/terminal/linux/iosource.c
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 #include <lib3270/log.h> 32 #include <lib3270/log.h>
33 #include <poll.h> 33 #include <poll.h>
34 #include <internals.h> 34 #include <internals.h>
35 - #include "../private.h" 35 + #include <terminal.h>
36 36
37 /*---[ Structs ]-------------------------------------------------------------------------------------------*/ 37 /*---[ Structs ]-------------------------------------------------------------------------------------------*/
38 38
src/terminal/mouse.c
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 #include <gdk/gdk.h> 31 #include <gdk/gdk.h>
32 #include <lib3270.h> 32 #include <lib3270.h>
33 #include <v3270.h> 33 #include <v3270.h>
34 - #include "private.h" 34 + #include <terminal.h>
35 #include <internals.h> 35 #include <internals.h>
36 #include <lib3270/selection.h> 36 #include <lib3270/selection.h>
37 #include <lib3270/actions.h> 37 #include <lib3270/actions.h>
src/terminal/oia.c
@@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
55 #endif // HAVE_LIBM 55 #endif // HAVE_LIBM
56 56
57 #include <v3270.h> 57 #include <v3270.h>
58 - #include "private.h" 58 + #include <terminal.h>
59 #include <internals.h> 59 #include <internals.h>
60 #include <v3270/accessible.h> 60 #include <v3270/accessible.h>
61 61
src/terminal/private.h
@@ -1,183 +0,0 @@ @@ -1,183 +0,0 @@
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 private.h 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 <internals.h>  
32 -  
33 -G_BEGIN_DECLS  
34 -  
35 - struct _v3270Class  
36 - {  
37 - GtkWidgetClass parent_class;  
38 -  
39 - // Internal properties.  
40 - struct {  
41 -  
42 - size_t count; // Number of properties.  
43 -  
44 - GParamSpec * font_family;  
45 - GParamSpec * toggle[LIB3270_TOGGLE_COUNT]; // Toggle properties.  
46 -  
47 - // Signal related properties  
48 - GParamSpec * online;  
49 - GParamSpec * luname;  
50 - GParamSpec * model;  
51 - GParamSpec * selection;  
52 -  
53 - struct  
54 - {  
55 - guint toggle;  
56 - guint boolean;  
57 - guint integer;  
58 - guint str;  
59 - } type;  
60 -  
61 - } properties;  
62 -  
63 - // Cursors  
64 - GdkCursor * cursors[LIB3270_POINTER_COUNT];  
65 -  
66 - // Signals  
67 - void (*activate)(GtkWidget *widget);  
68 - void (*toggle_changed)(v3270 *widget,LIB3270_TOGGLE toggle_id,gboolean toggle_state,const gchar *toggle_name);  
69 - void (*message_changed)(v3270 *widget, LIB3270_MESSAGE id);  
70 - void (*popup_message)(GtkWidget *widget, LIB3270_NOTIFY id , const gchar *title, const gchar *message, const gchar *text);  
71 -  
72 - };  
73 -  
74 -/*--[ Defines]---------------------------------------------------------------------------------------*/  
75 -  
76 - #define OIA_TOP_MARGIN 2  
77 -  
78 - #define KEY_FLAG_SHIFT 0x0001  
79 -  
80 - #ifndef WIN32  
81 - #define KEY_FLAG_ALT 0x0002  
82 - #endif // !WIN32  
83 -  
84 -/*--[ Globals ]--------------------------------------------------------------------------------------*/  
85 -  
86 - struct v3270_ssl_status_msg  
87 - {  
88 - long id;  
89 - const gchar * icon;  
90 - const gchar * text;  
91 - const gchar * message;  
92 - };  
93 -  
94 -/*--[ Widget data ]----------------------------------------------------------------------------------*/  
95 -  
96 - struct _v3270  
97 - {  
98 - GtkWidget parent;  
99 -  
100 - // flags  
101 - int selecting : 1; /**< Selecting region */  
102 - int moving : 1; /**< Moving selected region */  
103 - int resizing : 1; /**< Resizing selected region */  
104 - int table : 1; /**< Copy mode is table */  
105 - int scaled_fonts : 1; /**< Use scaled fonts */  
106 - int drawing : 1; /**< Draw widget? */  
107 -  
108 -#if GTK_CHECK_VERSION(3,0,0)  
109 -  
110 -#else  
111 - gint width;  
112 - gint height;  
113 -#endif // GTK_CHECK_VERSION(3,0,0)  
114 -  
115 - GSource * timer;  
116 - GtkIMContext * input_method;  
117 - unsigned short keyflags;  
118 -  
119 - struct  
120 - {  
121 - char * text; /**< Clipboard contents (lib3270 charset) */  
122 - int baddr; /**< Selection addr */  
123 - } selection;  
124 -  
125 - LIB3270_POINTER pointer_id;  
126 - unsigned char pointer; /**< Mouse pointer ID */  
127 -  
128 - // Font info  
129 - cairo_surface_t * surface;  
130 - v3270FontInfo font;  
131 -  
132 - gint minimum_width;  
133 - gint minimum_height;  
134 -  
135 - // Colors  
136 - GdkRGBA color[V3270_COLOR_COUNT]; /**< Terminal widget colors */  
137 -  
138 - // OIA  
139 - struct  
140 - {  
141 - GdkRectangle rect[V3270_OIA_FIELD_COUNT];  
142 - V3270_OIA_FIELD selected; /**< Clicked OIA field */  
143 - } oia;  
144 -  
145 - struct  
146 - {  
147 - unsigned char show; /**< Cursor flag */  
148 - unsigned char chr; /**< Char at cursor position */  
149 - unsigned short attr; /**< Attribute at cursor position */  
150 - GdkRectangle rect; /**< Cursor rectangle */  
151 - GSource * timer; /**< Cursor blinking timer */  
152 - cairo_surface_t * surface; /**< Cursor image */  
153 - } cursor;  
154 -  
155 - // Acessibility  
156 - GtkAccessible * accessible;  
157 -  
158 - // Session  
159 - H3270 * host; /**< Related 3270 session */  
160 - gchar * session_name; /**< Session name (for window title) */  
161 -  
162 - // Auto disconnect  
163 - struct  
164 - {  
165 - time_t timestamp; /**< Last action in this widget */  
166 - guint disconnect; /**< Time (in minutes) for auto disconnect */  
167 - GSource * timer; /**< Auto disconnect timer */  
168 - } activity;  
169 -  
170 - char script; /**< @brief Script ID */  
171 -  
172 - // Blink  
173 - struct  
174 - {  
175 - int show : 1; /**< @brief Show element? */  
176 - GSource * timer; /**< @brief Timer source. */  
177 - } blink;  
178 -  
179 - };  
180 -  
181 -/*--[ Globals ]--------------------------------------------------------------------------------------*/  
182 -  
183 -G_END_DECLS  
src/terminal/properties.c
@@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
43 #include <stdlib.h> 43 #include <stdlib.h>
44 #include <errno.h> 44 #include <errno.h>
45 #include <v3270.h> 45 #include <v3270.h>
46 - #include "private.h" 46 + #include <terminal.h>
47 47
48 #define PROP_BEGIN 2 48 #define PROP_BEGIN 2
49 49
src/terminal/security.c
@@ -35,8 +35,7 @@ @@ -35,8 +35,7 @@
35 #include <gtk/gtk.h> 35 #include <gtk/gtk.h>
36 #include <libintl.h> 36 #include <libintl.h>
37 #include <glib/gi18n.h> 37 #include <glib/gi18n.h>
38 -  
39 - #include "private.h" 38 + #include <terminal.h>
40 39
41 /*--[ Implement ]------------------------------------------------------------------------------------*/ 40 /*--[ Implement ]------------------------------------------------------------------------------------*/
42 41
src/terminal/selection.c
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 #include <gtk/gtk.h> 30 #include <gtk/gtk.h>
31 #include <lib3270.h> 31 #include <lib3270.h>
32 #include <v3270.h> 32 #include <v3270.h>
33 - #include "private.h" 33 + #include <terminal.h>
34 #include <internals.h> 34 #include <internals.h>
35 #include <lib3270/selection.h> 35 #include <lib3270/selection.h>
36 #include <lib3270/log.h> 36 #include <lib3270/log.h>
src/terminal/widget.c
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 */ 28 */
29 29
30 #include <config.h> 30 #include <config.h>
31 - #include "private.h" 31 + #include <terminal.h>
32 #include "marshal.h" 32 #include "marshal.h"
33 33
34 #include <lib3270.h> 34 #include <lib3270.h>
valgrind.suppression
1 { 1 {
  2 + libcrypto_BIO_read
  3 + Memcheck:Cond
  4 + ...
  5 + fun:BIO_read
  6 +}
  7 +
  8 +{
2 libcrypt_FIPS_selftest 9 libcrypt_FIPS_selftest
3 Memcheck:Cond 10 Memcheck:Cond
4 ... 11 ...
@@ -138,3 +145,18 @@ @@ -138,3 +145,18 @@
138 fun:cairo_mask 145 fun:cairo_mask
139 } 146 }
140 147
  148 +{
  149 + gtk_css_dimension_value_new
  150 + Memcheck:Leak
  151 + ...
  152 + fun:gtk_css_dimension_value_new
  153 +}
  154 +
  155 +{
  156 + gtk_style_constructed
  157 + Memcheck:Leak
  158 + ...
  159 + fun:gtk_style_constructed
  160 +}
  161 +
  162 +