Commit 78aeb9536368cec9bec44eaf5ed1ed5ba5263de5

Authored by Perry Werneck
1 parent 58d051b4
Exists in master and in 1 other branch develop

Fixing windows server.

README.md
1   -IPC (interprocess communication) plugin for pw3270.
2   -===================================================
  1 +IPC (interprocess communication) plugin & library for pw3270.
  2 +=============================================================
3 3  
4 4 Created originally as part of PW3270 application.
5 5  
6 6 See more details at https://softwarepublico.gov.br/social/pw3270/
7 7  
  8 +Installation repositories
  9 +=========================
  10 +
  11 +The latest version packaged for many linux distributions can be found in SuSE Build Service (https://build.opensuse.org/project/show/home:PerryWerneck:pw3270)
  12 +
  13 +Requirements
  14 +============
  15 +
  16 + * GTK-3 (https://www.gtk.org/)
  17 + * lib3270 (https://github.com/PerryWerneck/lib3270)
  18 + * libv3270 (https://github.com/PerryWerneck/libv3270)
  19 +
  20 +
  21 +Building for Linux
  22 +==================
  23 +
  24 +
  25 +Cross-compiling for Windows
  26 +===========================
  27 +
  28 +Cross-compiling on SuSE Linux (Native or WSL)
  29 +---------------------------------------------
  30 +
  31 +1. First add the MinGW Repositories for your SuSE version from:
  32 +
  33 + * https://build.opensuse.org/project/show/windows:mingw:win32
  34 + * https://build.opensuse.org/project/show/windows:mingw:win64
  35 + * https://build.opensuse.org/project/show/home:PerryWerneck:pw3270
  36 +
  37 +2. Get libv3270 sources from git
  38 +
  39 + * git clone https://github.com/PerryWerneck/pw3270-plugin-ipc.git ./ipc3270
  40 +
  41 +3. Install cross compilers
  42 +
  43 +3. Configure build
  44 +
  45 +4. Build
  46 +
  47 + * cd ipc3270
  48 + * make clean
  49 + * make all
  50 +
  51 +
  52 +Compiling for Windows (With MSYS2)
  53 +----------------------------------
  54 +
  55 +1. Build and install lib3270
  56 +
  57 + * Follow the guide on https://github.com/PerryWerneck/lib3270
  58 +
  59 +2. Build and install libv3270
  60 +
  61 + * Follow the guide on https://github.com/PerryWerneck/libv3270
  62 +
  63 +2. Get ip3270 sources from git
  64 +
  65 + * git clone https://github.com/PerryWerneck/pw3270-plugin-ipc.git ./ipc3270
  66 +
  67 +4. Build library using the mingw shell
  68 +
  69 + * cd ipc3270
  70 + * ./autogen.sh
  71 + * make all
  72 +
8 73  
... ...
server/src/core/linux/gobject.c
... ... @@ -51,9 +51,8 @@ G_DEFINE_TYPE(ipc3270, ipc3270, G_TYPE_OBJECT)
51 51 static void ipc3270_finalize(GObject *object) {
52 52  
53 53 ipc3270 * ipc = IPC3270(object);
54   - debug("ipc3270::%s(%p)",__FUNCTION__,object);
55 54  
56   - ipc3270_release_object(IPC3270(object));
  55 + ipc3270_release_object(ipc);
57 56  
58 57 g_autofree gchar * widget_name = g_strdup(v3270_get_session_name(ipc->terminal));
59 58 gchar * ptr = strrchr(widget_name,':');
... ... @@ -64,6 +63,7 @@ static void ipc3270_finalize(GObject *object) {
64 63 lib3270_set_session_id(ipc->hSession, 0);
65 64  
66 65 G_OBJECT_CLASS(ipc3270_parent_class)->finalize(object);
  66 +
67 67 }
68 68  
69 69  
... ...
server/src/core/windows/gobject.c
... ... @@ -32,6 +32,7 @@
32 32 #include <lib3270/actions.h>
33 33 #include <lib3270/properties.h>
34 34 #include <lib3270/ipc-glib.h>
  35 +#include <v3270.h>
35 36  
36 37 /*--[ Widget definition ]----------------------------------------------------------------------------*/
37 38  
... ... @@ -41,9 +42,19 @@ G_DEFINE_TYPE(ipc3270, ipc3270, G_TYPE_OBJECT)
41 42  
42 43 static void ipc3270_finalize(GObject *object) {
43 44  
44   - debug("ipc3270::%s(%p)",__FUNCTION__,object);
  45 + ipc3270 * ipc = IPC3270(object);
  46 +
  47 + debug("%s(%p)",__FUNCTION__,object);
45 48  
46   - ipc3270_release_object(IPC3270(object));
  49 + ipc3270_release_object(ipc);
  50 +
  51 + g_autofree gchar * widget_name = g_strdup(v3270_get_session_name(ipc->terminal));
  52 + gchar * ptr = strrchr(widget_name,':');
  53 + if(ptr)
  54 + *ptr = 0;
  55 +
  56 + v3270_set_session_name(ipc->terminal,widget_name);
  57 + lib3270_set_session_id(ipc->hSession, 0);
47 58  
48 59 G_OBJECT_CLASS(ipc3270_parent_class)->finalize(object);
49 60  
... ... @@ -71,10 +82,12 @@ GObject * ipc3270_new() {
71 82 return g_object_new(GLIB_TYPE_IPC3270, NULL);
72 83 }
73 84  
74   -void ipc3270_set_session(GObject *object, H3270 *hSession) {
  85 +void ipc3270_set_terminal_widget(GObject *object, GtkWidget *terminal) {
75 86  
76 87 ipc3270 * ipc = IPC3270(object);
77   - ipc->hSession = hSession;
  88 +
  89 + ipc->terminal = terminal;
  90 + ipc->hSession = v3270_get_session(terminal);
78 91  
79 92 }
80 93  
... ...
server/src/core/windows/gobject.h
... ... @@ -80,6 +80,7 @@
80 80 struct _ipc3270 {
81 81 GObject parent;
82 82 H3270 * hSession;
  83 + GtkWidget * terminal;
83 84 IPC3270_PIPE_SOURCE * source;
84 85 GQuark error_domain;
85 86 };
... ...
server/src/core/windows/pipesource.c
... ... @@ -30,6 +30,7 @@
30 30 #include "gobject.h"
31 31 #include <lib3270/ipc-glib.h>
32 32 #include <lib3270/trace.h>
  33 +#include <lib3270/toggle.h>
33 34  
34 35 void ipc3270_wait_for_client(IPC3270_PIPE_SOURCE *source) {
35 36  
... ... @@ -251,7 +252,10 @@ static gboolean IO_dispatch(GSource *source, GSourceFunc G_GNUC_UNUSED(callback)
251 252 return TRUE;
252 253 }
253 254  
254   -static gboolean IO_closure(gpointer G_GNUC_UNUSED(data)) {
  255 +static gboolean IO_closure(gpointer source) {
  256 +
  257 + debug("%s(%p)",__FUNCTION__,source);
  258 +
255 259 return 0;
256 260 }
257 261  
... ...
server/src/core/windows/stop.c
... ... @@ -38,9 +38,12 @@
38 38  
39 39 void ipc3270_release_object(ipc3270 *object) {
40 40  
  41 + debug("%s(%p) source=%p",__FUNCTION__,object,object->source);
  42 +
41 43 if(object->source)
42 44 {
43 45 g_source_destroy((GSource *) object->source);
  46 + g_source_unref((GSource *) object->source);
44 47 object->source = NULL;
45 48 }
46 49  
... ...
server/src/plugin/plugin.c
... ... @@ -77,8 +77,11 @@
77 77 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"%s",error->message);
78 78 g_error_free(error);
79 79  
80   - gtk_dialog_run(GTK_DIALOG(dialog));
81   - gtk_widget_destroy(dialog);
  80 + g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL);
  81 + g_signal_connect(dialog,"response",G_CALLBACK(gtk_widget_destroy),NULL);
  82 +
  83 + gtk_widget_show_all(dialog);
  84 +
82 85 return 0;
83 86  
84 87 }
... ...
server/src/testprogram/testprogram.c
... ... @@ -130,6 +130,9 @@
130 130  
131 131 #ifdef _WIN32
132 132 {
  133 + // Setup font name
  134 + v3270_set_font_family(terminal,"Droid Sans Mono");
  135 +
133 136 // WIN32 path settings.
134 137 static const char * sep = "\\/.";
135 138  
... ...