Commit 90abdceb03f97156456b481068dc89f0202fc7b1
1 parent
925acbf8
Exists in
master
and in
5 other branches
Corrigindo problemas no plugin rexx, iniciando implementação de script para "paste" justificado
Showing
11 changed files
with
192 additions
and
32 deletions
Show diff stats
pw3270.cbp
@@ -290,6 +290,7 @@ | @@ -290,6 +290,7 @@ | ||
290 | <Unit filename="src/plugins/rx3270/rx3270.cls" /> | 290 | <Unit filename="src/plugins/rx3270/rx3270.cls" /> |
291 | <Unit filename="src/plugins/rx3270/rx3270.h" /> | 291 | <Unit filename="src/plugins/rx3270/rx3270.h" /> |
292 | <Unit filename="src/plugins/rx3270/rxapimain.cc" /> | 292 | <Unit filename="src/plugins/rx3270/rxapimain.cc" /> |
293 | + <Unit filename="src/plugins/rx3270/sample/clipboard.rex" /> | ||
293 | <Unit filename="src/plugins/rx3270/sample/object.rex" /> | 294 | <Unit filename="src/plugins/rx3270/sample/object.rex" /> |
294 | <Unit filename="src/plugins/rx3270/sample/remote.rex" /> | 295 | <Unit filename="src/plugins/rx3270/sample/remote.rex" /> |
295 | <Unit filename="src/plugins/rx3270/text.cc" /> | 296 | <Unit filename="src/plugins/rx3270/text.cc" /> |
src/plugins/dbus3270/gobject.c
@@ -326,7 +326,7 @@ void pw3270_dbus_pa_key(PW3270Dbus *object, int key, DBusGMethodInvocation *cont | @@ -326,7 +326,7 @@ void pw3270_dbus_pa_key(PW3270Dbus *object, int key, DBusGMethodInvocation *cont | ||
326 | dbus_g_method_return(context,lib3270_get_field_start(pw3270_dbus_get_session_handle(object),baddr)); | 326 | dbus_g_method_return(context,lib3270_get_field_start(pw3270_dbus_get_session_handle(object),baddr)); |
327 | } | 327 | } |
328 | 328 | ||
329 | -void pw3270_dbus_get_field_len(PW3270Dbus *object, int baddr, DBusGMethodInvocation *context) | 329 | +void pw3270_dbus_get_field_length(PW3270Dbus *object, int baddr, DBusGMethodInvocation *context) |
330 | { | 330 | { |
331 | trace("%s object=%p context=%p",__FUNCTION__,object,context); | 331 | trace("%s object=%p context=%p",__FUNCTION__,object,context); |
332 | dbus_g_method_return(context,lib3270_get_field_len(pw3270_dbus_get_session_handle(object),baddr)); | 332 | dbus_g_method_return(context,lib3270_get_field_len(pw3270_dbus_get_session_handle(object),baddr)); |
src/plugins/rx3270/local.cc
@@ -123,6 +123,7 @@ | @@ -123,6 +123,7 @@ | ||
123 | 123 | ||
124 | rx3270 * rx3270::create_local(void) | 124 | rx3270 * rx3270::create_local(void) |
125 | { | 125 | { |
126 | + trace("%s",__FUNCTION__); | ||
126 | return new dynamic(); | 127 | return new dynamic(); |
127 | } | 128 | } |
128 | 129 | ||
@@ -362,6 +363,8 @@ dynamic::~dynamic() | @@ -362,6 +363,8 @@ dynamic::~dynamic() | ||
362 | { | 363 | { |
363 | static void (*session_free)(void *h); | 364 | static void (*session_free)(void *h); |
364 | 365 | ||
366 | + trace("%s",__FUNCTION__); | ||
367 | + | ||
365 | if(!hModule) | 368 | if(!hModule) |
366 | return; | 369 | return; |
367 | 370 |
src/plugins/rx3270/pluginmain.cc
@@ -64,6 +64,9 @@ | @@ -64,6 +64,9 @@ | ||
64 | { | 64 | { |
65 | public: | 65 | public: |
66 | plugin(H3270 *hSession); | 66 | plugin(H3270 *hSession); |
67 | + virtual ~plugin(); | ||
68 | + | ||
69 | + void free(char *ptr); | ||
67 | 70 | ||
68 | char * get_version(void); | 71 | char * get_version(void); |
69 | LIB3270_CSTATE get_cstate(void); | 72 | LIB3270_CSTATE get_cstate(void); |
@@ -97,37 +100,41 @@ | @@ -97,37 +100,41 @@ | ||
97 | int set_copy(const char *text); | 100 | int set_copy(const char *text); |
98 | char * get_copy(void); | 101 | char * get_copy(void); |
99 | 102 | ||
103 | + char * get_clipboard(void); | ||
104 | + | ||
105 | + protected: | ||
106 | + | ||
100 | private: | 107 | private: |
101 | - H3270 *hSession; | 108 | + H3270 * hSession; |
102 | 109 | ||
103 | }; | 110 | }; |
104 | 111 | ||
105 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ | 112 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
106 | 113 | ||
107 | - static plugin * session = NULL; #if GTK_CHECK_VERSION(2,32,0) | 114 | +#if GTK_CHECK_VERSION(2,32,0) |
108 | static GMutex mutex; #else static GStaticMutex mutex = G_STATIC_MUTEX_INIT; #endif // GTK_CHECK_VERSION | 115 | static GMutex mutex; #else static GStaticMutex mutex = G_STATIC_MUTEX_INIT; #endif // GTK_CHECK_VERSION |
109 | 116 | ||
110 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 117 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
111 | 118 | ||
112 | - LIB3270_EXPORT int pw3270_plugin_init(GtkWidget *window) | 119 | + static rx3270 * factory(const char *name) |
113 | { | 120 | { |
121 | + return new plugin(lib3270_get_default_session_handle()); | ||
122 | + } | ||
123 | + | ||
124 | + LIB3270_EXPORT int pw3270_plugin_start(GtkWidget *window) | ||
125 | + { | ||
126 | + trace("%s",__FUNCTION__); | ||
114 | #if GTK_CHECK_VERSION(2,32,0) | 127 | #if GTK_CHECK_VERSION(2,32,0) |
115 | g_mutex_init(&mutex); #endif // GTK_CHECK_VERSION | 128 | g_mutex_init(&mutex); #endif // GTK_CHECK_VERSION |
116 | - session = new plugin(lib3270_get_default_session_handle()); | ||
117 | - session->set_plugin(); | ||
118 | - trace("%s: Rexx object is %p",__FUNCTION__,session); | 129 | + rx3270::set_plugin(factory); |
119 | return 0; | 130 | return 0; |
120 | } | 131 | } |
121 | 132 | ||
122 | - LIB3270_EXPORT int pw3270_plugin_deinit(GtkWidget *window) | 133 | + LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window) |
123 | { | 134 | { |
124 | - if(session) | ||
125 | - { | ||
126 | - delete session; | ||
127 | - session = NULL; | ||
128 | - } | ||
129 | #if GTK_CHECK_VERSION(2,32,0) | 135 | #if GTK_CHECK_VERSION(2,32,0) |
130 | g_mutex_clear(&mutex); #endif // GTK_CHECK_VERSION | 136 | g_mutex_clear(&mutex); #endif // GTK_CHECK_VERSION |
137 | + trace("%s",__FUNCTION__); | ||
131 | return 0; | 138 | return 0; |
132 | } | 139 | } |
133 | 140 | ||
@@ -136,6 +143,12 @@ | @@ -136,6 +143,12 @@ | ||
136 | this->hSession = hSession; | 143 | this->hSession = hSession; |
137 | } | 144 | } |
138 | 145 | ||
146 | + plugin::~plugin() | ||
147 | + { | ||
148 | + trace("%s",__FUNCTION__); | ||
149 | + } | ||
150 | + | ||
151 | + | ||
139 | char * plugin::get_version(void) | 152 | char * plugin::get_version(void) |
140 | { | 153 | { |
141 | return strdup(lib3270_get_version()); | 154 | return strdup(lib3270_get_version()); |
@@ -258,6 +271,17 @@ | @@ -258,6 +271,17 @@ | ||
258 | return v3270_get_copy(GTK_WIDGET(lib3270_get_widget(hSession))); | 271 | return v3270_get_copy(GTK_WIDGET(lib3270_get_widget(hSession))); |
259 | } | 272 | } |
260 | 273 | ||
274 | + char * plugin::get_clipboard(void) | ||
275 | + { | ||
276 | + trace("%s toplevel=%p",__FUNCTION__,pw3270_get_toplevel()); | ||
277 | + return gtk_clipboard_wait_for_text(gtk_widget_get_clipboard(pw3270_get_toplevel(),GDK_SELECTION_CLIPBOARD)); | ||
278 | + } | ||
279 | + | ||
280 | + void plugin::free(char *ptr) | ||
281 | + { | ||
282 | + g_free(ptr); | ||
283 | + } | ||
284 | + | ||
261 | static int REXXENTRY Rexx_IO_exit(RexxExitContext *context, int exitnumber, int subfunction, PEXIT parmBlock) | 285 | static int REXXENTRY Rexx_IO_exit(RexxExitContext *context, int exitnumber, int subfunction, PEXIT parmBlock) |
262 | { | 286 | { |
263 | trace("%s call with ExitNumber: %d Subfunction: %d",__FUNCTION__,(int) exitnumber, (int) subfunction); | 287 | trace("%s call with ExitNumber: %d Subfunction: %d",__FUNCTION__,(int) exitnumber, (int) subfunction); |
@@ -324,6 +348,8 @@ | @@ -324,6 +348,8 @@ | ||
324 | { | 348 | { |
325 | RexxArrayObject rxArgs; | 349 | RexxArrayObject rxArgs; |
326 | 350 | ||
351 | + trace("%s start",__FUNCTION__); | ||
352 | + | ||
327 | if(args) | 353 | if(args) |
328 | { | 354 | { |
329 | gchar **arg = g_strsplit(args,",",-1); | 355 | gchar **arg = g_strsplit(args,",",-1); |
@@ -381,6 +407,8 @@ | @@ -381,6 +407,8 @@ | ||
381 | } | 407 | } |
382 | 408 | ||
383 | instance->Terminate(); | 409 | instance->Terminate(); |
410 | + | ||
411 | + trace("%s ends",__FUNCTION__); | ||
384 | } | 412 | } |
385 | 413 | ||
386 | } | 414 | } |
src/plugins/rx3270/rexx_methods.cc
@@ -49,8 +49,13 @@ RexxMethod1(int, rx3270_method_init, CSTRING, type) | @@ -49,8 +49,13 @@ RexxMethod1(int, rx3270_method_init, CSTRING, type) | ||
49 | RexxMethod1(int, rx3270_method_uninit, CSELF, sessionPtr) | 49 | RexxMethod1(int, rx3270_method_uninit, CSELF, sessionPtr) |
50 | { | 50 | { |
51 | rx3270 *hSession = (rx3270 *) sessionPtr; | 51 | rx3270 *hSession = (rx3270 *) sessionPtr; |
52 | + | ||
53 | + trace("rx3270_method_uninit hSession=%p",hSession); | ||
54 | + | ||
52 | if(hSession) | 55 | if(hSession) |
53 | delete hSession; | 56 | delete hSession; |
57 | + | ||
58 | + trace("%s","rx3270_method_uninit"); | ||
54 | return 0; | 59 | return 0; |
55 | } | 60 | } |
56 | 61 | ||
@@ -373,3 +378,61 @@ RexxMethod2(int, rx3270_method_get_field_start, CSELF, sessionPtr, OPTIONAL_int, | @@ -373,3 +378,61 @@ RexxMethod2(int, rx3270_method_get_field_start, CSELF, sessionPtr, OPTIONAL_int, | ||
373 | return -1; | 378 | return -1; |
374 | return hSession->get_field_start(baddr); | 379 | return hSession->get_field_start(baddr); |
375 | } | 380 | } |
381 | + | ||
382 | +RexxMethod1(RexxStringObject, rx3270_method_get_selection, CSELF, sessionPtr) | ||
383 | +{ | ||
384 | + rx3270 * hSession = (rx3270 *) sessionPtr; | ||
385 | + | ||
386 | + if(hSession) | ||
387 | + { | ||
388 | + char *str = hSession->get_copy(); | ||
389 | + if(str) | ||
390 | + { | ||
391 | + char * text = hSession->get_local_string(str); | ||
392 | + RexxStringObject ret = context->String((CSTRING) text); | ||
393 | + free(str); | ||
394 | + free(text); | ||
395 | + return ret; | ||
396 | + } | ||
397 | + } | ||
398 | + | ||
399 | + return context->String(""); | ||
400 | +} | ||
401 | + | ||
402 | +RexxMethod2(int, rx3270_method_set_selection, CSELF, sessionPtr, CSTRING, text) | ||
403 | +{ | ||
404 | + rx3270 * session = (rx3270 *) sessionPtr; | ||
405 | + | ||
406 | + if(session) | ||
407 | + { | ||
408 | + char * str = session->get_3270_string(text); | ||
409 | + int rc; | ||
410 | + rc = session->set_copy(str); | ||
411 | + free(str); | ||
412 | + return rc; | ||
413 | + } | ||
414 | + return -1; | ||
415 | +} | ||
416 | + | ||
417 | +RexxMethod1(RexxStringObject, rx3270_method_get_clipboard, CSELF, sessionPtr) | ||
418 | +{ | ||
419 | + rx3270 * hSession = (rx3270 *) sessionPtr; | ||
420 | + | ||
421 | + if(hSession) | ||
422 | + { | ||
423 | + char *str = hSession->get_clipboard(); | ||
424 | + | ||
425 | + trace("str=%p (%s)",str,str); | ||
426 | + | ||
427 | + if(str) | ||
428 | + { | ||
429 | + RexxStringObject ret = context->String((CSTRING) str); | ||
430 | + hSession->free(str); | ||
431 | + return ret; | ||
432 | + } | ||
433 | + } | ||
434 | + | ||
435 | + trace("%s","rx3270_method_get_clipboard: Clipboard is empty"); | ||
436 | + return context->String(""); | ||
437 | +} | ||
438 | + |
src/plugins/rx3270/rx3270.cc
@@ -45,10 +45,13 @@ | @@ -45,10 +45,13 @@ | ||
45 | 45 | ||
46 | #include <string.h> | 46 | #include <string.h> |
47 | 47 | ||
48 | + | ||
49 | + static rx3270 * factory_default(const char *type); | ||
50 | + | ||
48 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ | 51 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
49 | 52 | ||
50 | - static bool plugin = false; | ||
51 | - static rx3270 * defSession = NULL; | 53 | + static rx3270 * defSession = NULL; |
54 | + static rx3270 * (*factory)(const char *type) = factory_default; | ||
52 | 55 | ||
53 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 56 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
54 | 57 | ||
@@ -86,13 +89,21 @@ rx3270::~rx3270() | @@ -86,13 +89,21 @@ rx3270::~rx3270() | ||
86 | 89 | ||
87 | if(defSession == this) | 90 | if(defSession == this) |
88 | defSession = NULL; | 91 | defSession = NULL; |
92 | + | ||
93 | + trace("%s",__FUNCTION__); | ||
89 | } | 94 | } |
90 | 95 | ||
91 | -rx3270 * rx3270::create(const char *name) | 96 | +static rx3270 * factory_default(const char *type) |
92 | { | 97 | { |
93 | - if(name && *name) | ||
94 | - return create_remote(name); | ||
95 | - return create_local(); | 98 | + trace("%s",__FUNCTION__); |
99 | + if(type && *type) | ||
100 | + return rx3270::create_remote(type); | ||
101 | + return rx3270::create_local(); | ||
102 | +} | ||
103 | + | ||
104 | +rx3270 * rx3270::create(const char *type) | ||
105 | +{ | ||
106 | + return factory(type); | ||
96 | } | 107 | } |
97 | 108 | ||
98 | char * rx3270::get_version(void) | 109 | char * rx3270::get_version(void) |
@@ -149,9 +160,15 @@ int rx3270::wait_for_text_at(int row, int col, const char *key, int timeout) | @@ -149,9 +160,15 @@ int rx3270::wait_for_text_at(int row, int col, const char *key, int timeout) | ||
149 | return ETIMEDOUT; | 160 | return ETIMEDOUT; |
150 | } | 161 | } |
151 | 162 | ||
152 | -void rx3270::set_plugin(void) | 163 | +void rx3270::set_plugin(rx3270 * (*ptr)(const char *name)) |
153 | { | 164 | { |
154 | - plugin = true; | 165 | + trace("%s factory=%p",__FUNCTION__,ptr); |
166 | + | ||
167 | + if(ptr) | ||
168 | + factory = ptr; | ||
169 | + else | ||
170 | + factory = factory_default; | ||
171 | + | ||
155 | } | 172 | } |
156 | 173 | ||
157 | int rx3270::set_copy(const char *text) | 174 | int rx3270::set_copy(const char *text) |
@@ -165,6 +182,15 @@ char * rx3270::get_copy(void) | @@ -165,6 +182,15 @@ char * rx3270::get_copy(void) | ||
165 | return NULL; | 182 | return NULL; |
166 | } | 183 | } |
167 | 184 | ||
185 | +char * rx3270::get_clipboard(void) | ||
186 | +{ | ||
187 | + errno = EINVAL; | ||
188 | + return NULL; | ||
189 | +} | ||
168 | 190 | ||
191 | +void rx3270::free(char *ptr) | ||
192 | +{ | ||
193 | + free(ptr); | ||
194 | +} | ||
169 | 195 | ||
170 | 196 |
src/plugins/rx3270/rx3270.cls
@@ -33,7 +33,6 @@ | @@ -33,7 +33,6 @@ | ||
33 | 33 | ||
34 | ::class rx3270 public subclass object | 34 | ::class rx3270 public subclass object |
35 | 35 | ||
36 | - | ||
37 | ::METHOD INIT EXTERNAL "LIBRARY rx3270 rx3270_method_init" | 36 | ::METHOD INIT EXTERNAL "LIBRARY rx3270 rx3270_method_init" |
38 | ::METHOD UNINIT EXTERNAL "LIBRARY rx3270 rx3270_method_uninit" | 37 | ::METHOD UNINIT EXTERNAL "LIBRARY rx3270 rx3270_method_uninit" |
39 | 38 | ||
@@ -71,15 +70,10 @@ | @@ -71,15 +70,10 @@ | ||
71 | ::METHOD GETFIELDSTART EXTERNAL "LIBRARY rx3270 rx3270_method_get_field_start" | 70 | ::METHOD GETFIELDSTART EXTERNAL "LIBRARY rx3270 rx3270_method_get_field_start" |
72 | ::METHOD GETFIELDLEN EXTERNAL "LIBRARY rx3270 rx3270_method_get_field_len" | 71 | ::METHOD GETFIELDLEN EXTERNAL "LIBRARY rx3270 rx3270_method_get_field_len" |
73 | 72 | ||
74 | -/* | ||
75 | -getConnectionState | ||
76 | -waitForEvents | ||
77 | -RunMode | ||
78 | - | ||
79 | -::method isConnected | ||
80 | -return self~getConnectionState() = "CONNECTED_TN3270E" | 73 | +::METHOD GETSELECTION EXTERNAL "LIBRARY rx3270 rx3270_method_get_selection" |
74 | +::METHOD SETSELECTION EXTERNAL "LIBRARY rx3270 rx3270_method_set_selection" | ||
81 | 75 | ||
82 | -*/ | 76 | +::METHOD GETCLIPBOARD EXTERNAL "LIBRARY rx3270 rx3270_method_get_clipboard" |
83 | 77 | ||
84 | ::method waitForStringAt | 78 | ::method waitForStringAt |
85 | use arg row, col, key, timeout | 79 | use arg row, col, key, timeout |
src/plugins/rx3270/rx3270.h
@@ -105,6 +105,12 @@ | @@ -105,6 +105,12 @@ | ||
105 | REXX_METHOD_PROTOTYPE(rx3270_method_set_option); | 105 | REXX_METHOD_PROTOTYPE(rx3270_method_set_option); |
106 | REXX_METHOD_PROTOTYPE(rx3270_method_test); | 106 | REXX_METHOD_PROTOTYPE(rx3270_method_test); |
107 | REXX_METHOD_PROTOTYPE(rx3270_method_wait_for_text_at); | 107 | REXX_METHOD_PROTOTYPE(rx3270_method_wait_for_text_at); |
108 | + REXX_METHOD_PROTOTYPE(rx3270_method_get_field_len); | ||
109 | + REXX_METHOD_PROTOTYPE(rx3270_method_get_field_start); | ||
110 | + REXX_METHOD_PROTOTYPE(rx3270_method_get_selection); | ||
111 | + REXX_METHOD_PROTOTYPE(rx3270_method_set_selection); | ||
112 | + REXX_METHOD_PROTOTYPE(rx3270_method_get_clipboard); | ||
113 | + | ||
108 | 114 | ||
109 | /*---[ Globals ]---------------------------------------------------------------------------------------------*/ | 115 | /*---[ Globals ]---------------------------------------------------------------------------------------------*/ |
110 | 116 | ||
@@ -131,12 +137,15 @@ | @@ -131,12 +137,15 @@ | ||
131 | 137 | ||
132 | virtual ~rx3270(); | 138 | virtual ~rx3270(); |
133 | 139 | ||
140 | + virtual void free(char *ptr); | ||
141 | + | ||
142 | + | ||
134 | static rx3270 * create(const char *name = NULL); | 143 | static rx3270 * create(const char *name = NULL); |
135 | static rx3270 * create_remote(const char *name); | 144 | static rx3270 * create_remote(const char *name); |
136 | static rx3270 * create_local(void); | 145 | static rx3270 * create_local(void); |
137 | static rx3270 * get_default(void); | 146 | static rx3270 * get_default(void); |
138 | 147 | ||
139 | - static void set_plugin(void); | 148 | + static void set_plugin(rx3270 * (*factory)(const char *name)); |
140 | 149 | ||
141 | char * get_3270_string(const char *str); | 150 | char * get_3270_string(const char *str); |
142 | char * get_local_string(const char *str); | 151 | char * get_local_string(const char *str); |
@@ -174,6 +183,8 @@ | @@ -174,6 +183,8 @@ | ||
174 | virtual int set_copy(const char *text); | 183 | virtual int set_copy(const char *text); |
175 | virtual char * get_copy(void); | 184 | virtual char * get_copy(void); |
176 | 185 | ||
186 | + virtual char * get_clipboard(void); | ||
187 | + | ||
177 | }; | 188 | }; |
178 | 189 | ||
179 | rx3270 * create_lib3270_instance(void); | 190 | rx3270 * create_lib3270_instance(void); |
src/plugins/rx3270/rxapimain.cc
@@ -143,6 +143,12 @@ RexxMethodEntry rx3270_methods[] = | @@ -143,6 +143,12 @@ RexxMethodEntry rx3270_methods[] = | ||
143 | REXX_METHOD(rx3270_method_test, rx3270_method_test ), | 143 | REXX_METHOD(rx3270_method_test, rx3270_method_test ), |
144 | REXX_METHOD(rx3270_method_wait_for_text_at, rx3270_method_wait_for_text_at ), | 144 | REXX_METHOD(rx3270_method_wait_for_text_at, rx3270_method_wait_for_text_at ), |
145 | 145 | ||
146 | + REXX_METHOD(rx3270_method_get_field_len, rx3270_method_get_field_len ), | ||
147 | + REXX_METHOD(rx3270_method_get_field_start, rx3270_method_get_field_start ), | ||
148 | + REXX_METHOD(rx3270_method_get_selection, rx3270_method_get_selection ), | ||
149 | + REXX_METHOD(rx3270_method_set_selection, rx3270_method_set_selection ), | ||
150 | + REXX_METHOD(rx3270_method_get_clipboard, rx3270_method_get_clipboard ), | ||
151 | + | ||
146 | REXX_LAST_METHOD() | 152 | REXX_LAST_METHOD() |
147 | }; | 153 | }; |
148 | 154 |
@@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
1 | +/* | ||
2 | + * Sample rexx code to justified paste the clipboard contents. | ||
3 | + * | ||
4 | + * Autor: Perry Werneck <perry.werneck@gmail.com> | ||
5 | + * | ||
6 | + */ | ||
7 | + | ||
8 | + host = .rx3270~new("") | ||
9 | + | ||
10 | + text = host~GetClipboard() | ||
11 | + if text = "" then | ||
12 | + do | ||
13 | + say "Clipboard is empty" | ||
14 | + return 0 | ||
15 | + end | ||
16 | + | ||
17 | + say "["||text||"]" | ||
18 | + | ||
19 | + | ||
20 | +return 0 | ||
21 | + | ||
22 | +::requires "rx3270.cls" | ||
23 | + | ||
24 | + | ||
25 | + |
src/pw3270/v3270/selection.c
@@ -236,7 +236,10 @@ gchar * v3270_get_copy(GtkWidget *widget) | @@ -236,7 +236,10 @@ gchar * v3270_get_copy(GtkWidget *widget) | ||
236 | const char *text; | 236 | const char *text; |
237 | g_return_val_if_fail(GTK_IS_V3270(widget),NULL); | 237 | g_return_val_if_fail(GTK_IS_V3270(widget),NULL); |
238 | 238 | ||
239 | - text = update_selected_text(widget,FALSE); | 239 | + text = GTK_V3270(widget)->selection.text; |
240 | + | ||
241 | + if(!text) | ||
242 | + text = update_selected_text(widget,FALSE); | ||
240 | 243 | ||
241 | if(text) | 244 | if(text) |
242 | return g_convert(text, -1, "UTF-8", lib3270_get_charset(GTK_V3270(widget)->host), NULL, NULL, NULL); | 245 | return g_convert(text, -1, "UTF-8", lib3270_get_charset(GTK_V3270(widget)->host), NULL, NULL, NULL); |