Commit cd3c0d8f7c1336c92fc88e46a2ee6ef7f1189d72
1 parent
8321d0f5
Exists in
master
and in
5 other branches
Adicionando suporte D-Bus para a função set_unlock_delay.
Showing
13 changed files
with
95 additions
and
1 deletions
Show diff stats
pw3270.spec.in
@@ -51,7 +51,7 @@ | @@ -51,7 +51,7 @@ | ||
51 | %endif | 51 | %endif |
52 | 52 | ||
53 | %if %{?suse_version} >= 1310 | 53 | %if %{?suse_version} >= 1310 |
54 | - %define _office 1 | 54 | + %define _office 0 |
55 | %define _bldreq gtk3-devel libopenssl-devel | 55 | %define _bldreq gtk3-devel libopenssl-devel |
56 | %endif | 56 | %endif |
57 | %endif | 57 | %endif |
src/classlib/local.cc
@@ -163,6 +163,7 @@ | @@ -163,6 +163,7 @@ | ||
163 | int (*_erase_eol)(H3270 *hSession); | 163 | int (*_erase_eol)(H3270 *hSession); |
164 | int (*_erase_input)(H3270 *hSession); | 164 | int (*_erase_input)(H3270 *hSession); |
165 | int (*_action)(H3270 *hSession, const char *name); | 165 | int (*_action)(H3270 *hSession, const char *name); |
166 | + int (*_set_unlock_delay)(H3270 *hSession, unsigned short ms); | ||
166 | 167 | ||
167 | const char * (*_ebc2asc)(H3270 *hSession, unsigned char *buffer, int sz); | 168 | const char * (*_ebc2asc)(H3270 *hSession, unsigned char *buffer, int sz); |
168 | const char * (*_asc2ebc)(H3270 *hSession, unsigned char *buffer, int sz); | 169 | const char * (*_asc2ebc)(H3270 *hSession, unsigned char *buffer, int sz); |
@@ -231,6 +232,8 @@ | @@ -231,6 +232,8 @@ | ||
231 | { (void **) & _asc2ebc, "lib3270_asc2ebc" }, | 232 | { (void **) & _asc2ebc, "lib3270_asc2ebc" }, |
232 | 233 | ||
233 | { (void **) & _action, "lib3270_action" }, | 234 | { (void **) & _action, "lib3270_action" }, |
235 | + { (void **) & _set_unlock_delay, "lib3270_set_unlock_delay" }, | ||
236 | + | ||
234 | }; | 237 | }; |
235 | 238 | ||
236 | for(unsigned int f = 0; f < (sizeof (call) / sizeof ((call)[0]));f++) | 239 | for(unsigned int f = 0; f < (sizeof (call) / sizeof ((call)[0]));f++) |
@@ -518,6 +521,11 @@ | @@ -518,6 +521,11 @@ | ||
518 | return _action(hSession,name); | 521 | return _action(hSession,name); |
519 | } | 522 | } |
520 | 523 | ||
524 | + void set_unlock_delay(unsigned short ms) | ||
525 | + { | ||
526 | + _set_unlock_delay(hSession,ms); | ||
527 | + } | ||
528 | + | ||
521 | }; | 529 | }; |
522 | 530 | ||
523 | session * session::create_local(void) throw (std::exception) | 531 | session * session::create_local(void) throw (std::exception) |
src/classlib/remote.cc
@@ -65,6 +65,7 @@ | @@ -65,6 +65,7 @@ | ||
65 | #define HLLAPI_PACKET_PRINT "print" | 65 | #define HLLAPI_PACKET_PRINT "print" |
66 | #define HLLAPI_PACKET_ASC2EBC "asc2ebc" | 66 | #define HLLAPI_PACKET_ASC2EBC "asc2ebc" |
67 | #define HLLAPI_PACKET_EBC2ASC "ebc2asc" | 67 | #define HLLAPI_PACKET_EBC2ASC "ebc2asc" |
68 | + #define HLLAPI_PACKET_SET_UNLOCK_DELAY "setUnlockDelay" | ||
68 | #endif // WIN32 | 69 | #endif // WIN32 |
69 | 70 | ||
70 | #include <pw3270/class.h> | 71 | #include <pw3270/class.h> |
@@ -182,6 +183,25 @@ | @@ -182,6 +183,25 @@ | ||
182 | 183 | ||
183 | } | 184 | } |
184 | 185 | ||
186 | + void set_intval(HLLAPI_PACKET id, int value) | ||
187 | + { | ||
188 | + struct hllapi_packet_set_int packet; | ||
189 | + DWORD cbSize = (DWORD) sizeof(packet); | ||
190 | + BOOL status; | ||
191 | + | ||
192 | + memset(&packet,0,sizeof(packet)); | ||
193 | + packet.packet_id = id; | ||
194 | + packet.value = value; | ||
195 | + | ||
196 | + status = TransactNamedPipe(hPipe,(LPVOID) &packet, cbSize, &packet, sizeof(packet), &cbSize,NULL); | ||
197 | + | ||
198 | + if(status) | ||
199 | + return packet.rc; | ||
200 | + | ||
201 | + throw exception(GetLastError(),"%s","Transaction error"); | ||
202 | + | ||
203 | + } | ||
204 | + | ||
185 | 205 | ||
186 | #elif defined(HAVE_DBUS) | 206 | #elif defined(HAVE_DBUS) |
187 | 207 | ||
@@ -350,6 +370,22 @@ | @@ -350,6 +370,22 @@ | ||
350 | return -1; | 370 | return -1; |
351 | } | 371 | } |
352 | 372 | ||
373 | + void set_intval(const char *method, int value) | ||
374 | + { | ||
375 | + DBusMessage * outMsg = create_message(method); | ||
376 | + | ||
377 | + if(outMsg) | ||
378 | + { | ||
379 | + dbus_int32_t v = (dbus_int32_t) value; | ||
380 | + | ||
381 | + dbus_message_append_args(outMsg, DBUS_TYPE_INT32, &v, DBUS_TYPE_INVALID); | ||
382 | + | ||
383 | + DBusMessage * rspMsg = call(outMsg); | ||
384 | + dbus_message_unref(rspMsg); | ||
385 | + | ||
386 | + } | ||
387 | + } | ||
388 | + | ||
353 | #else | 389 | #else |
354 | 390 | ||
355 | 391 | ||
@@ -1516,6 +1552,11 @@ | @@ -1516,6 +1552,11 @@ | ||
1516 | return (const char *) text; | 1552 | return (const char *) text; |
1517 | } | 1553 | } |
1518 | 1554 | ||
1555 | + void set_unlock_delay(unsigned short ms) | ||
1556 | + { | ||
1557 | + set_intval(HLLAPI_PACKET_SET_UNLOCK_DELAY,(int) ms); | ||
1558 | + } | ||
1559 | + | ||
1519 | }; | 1560 | }; |
1520 | 1561 | ||
1521 | session * session::create_remote(const char *session) throw (std::exception) | 1562 | session * session::create_remote(const char *session) throw (std::exception) |
src/include/pw3270/class.h
@@ -157,6 +157,9 @@ | @@ -157,6 +157,9 @@ | ||
157 | virtual LIB3270_MESSAGE get_program_message(void) = 0; | 157 | virtual LIB3270_MESSAGE get_program_message(void) = 0; |
158 | virtual LIB3270_SSL_STATE get_secure(void) = 0; | 158 | virtual LIB3270_SSL_STATE get_secure(void) = 0; |
159 | 159 | ||
160 | + // Misc | ||
161 | + virtual void set_unlock_delay(unsigned short ms) = 0; | ||
162 | + | ||
160 | // charset | 163 | // charset |
161 | #ifdef WIN32 | 164 | #ifdef WIN32 |
162 | void set_display_charset(const char *remote = 0, const char *local = "CP1252"); | 165 | void set_display_charset(const char *remote = 0, const char *local = "CP1252"); |
src/include/pw3270/ipcpackets.h
@@ -72,6 +72,7 @@ | @@ -72,6 +72,7 @@ | ||
72 | HLLAPI_PACKET_FILE_TRANSFER, | 72 | HLLAPI_PACKET_FILE_TRANSFER, |
73 | 73 | ||
74 | HLLAPI_PACKET_GET_SSL_STATE, | 74 | HLLAPI_PACKET_GET_SSL_STATE, |
75 | + HLLAPI_PACKET_SET_UNLOCK_DELAY, | ||
75 | 76 | ||
76 | HLLAPI_PACKET_INVALID | 77 | HLLAPI_PACKET_INVALID |
77 | 78 | ||
@@ -185,6 +186,13 @@ struct hllapi_packet_set_text | @@ -185,6 +186,13 @@ struct hllapi_packet_set_text | ||
185 | char text[1]; | 186 | char text[1]; |
186 | }; | 187 | }; |
187 | 188 | ||
189 | +struct hllapi_packet_set_int | ||
190 | +{ | ||
191 | + unsigned char packet_id; | ||
192 | + int rc; | ||
193 | + int value; | ||
194 | +}; | ||
195 | + | ||
188 | struct hllapi_packet_file_transfer | 196 | struct hllapi_packet_file_transfer |
189 | { | 197 | { |
190 | unsigned char packet_id; | 198 | unsigned char packet_id; |
src/java/jni3270.cbp
@@ -47,6 +47,7 @@ | @@ -47,6 +47,7 @@ | ||
47 | <Unit filename="../classlib/testprogram.cc" /> | 47 | <Unit filename="../classlib/testprogram.cc" /> |
48 | <Unit filename="../include/lib3270.h" /> | 48 | <Unit filename="../include/lib3270.h" /> |
49 | <Unit filename="../include/pw3270/class.h" /> | 49 | <Unit filename="../include/pw3270/class.h" /> |
50 | + <Unit filename="../include/pw3270/ipcpackets.h" /> | ||
50 | <Unit filename="Makefile.in" /> | 51 | <Unit filename="Makefile.in" /> |
51 | <Unit filename="actions.cc" /> | 52 | <Unit filename="actions.cc" /> |
52 | <Unit filename="clipboard.cc" /> | 53 | <Unit filename="clipboard.cc" /> |
src/java/plugin.cc
@@ -343,6 +343,11 @@ | @@ -343,6 +343,11 @@ | ||
343 | return v3270_transfer_file(v3270_get_default_widget(),options,local,remote,lrecl,blksize,primspace,secspace,dft); | 343 | return v3270_transfer_file(v3270_get_default_widget(),options,local,remote,lrecl,blksize,primspace,secspace,dft); |
344 | } | 344 | } |
345 | 345 | ||
346 | + void set_unlock_delay(unsigned short ms) | ||
347 | + { | ||
348 | + lib3270_set_unlock_delay(hSession, ms); | ||
349 | + } | ||
350 | + | ||
346 | int quit(void) { | 351 | int quit(void) { |
347 | gtk_main_quit(); | 352 | gtk_main_quit(); |
348 | return 0; | 353 | return 0; |
src/lib3270/kybd.c
@@ -2977,5 +2977,8 @@ int kybd_prime(H3270 *hSession) | @@ -2977,5 +2977,8 @@ int kybd_prime(H3270 *hSession) | ||
2977 | LIB3270_EXPORT void lib3270_set_unlock_delay(H3270 *session, unsigned short delay) | 2977 | LIB3270_EXPORT void lib3270_set_unlock_delay(H3270 *session, unsigned short delay) |
2978 | { | 2978 | { |
2979 | CHECK_SESSION_HANDLE(session); | 2979 | CHECK_SESSION_HANDLE(session); |
2980 | + | ||
2981 | + trace("%s(%d)",__FUNCTION__,(int) delay); | ||
2982 | + | ||
2980 | session->unlock_delay_ms = delay; | 2983 | session->unlock_delay_ms = delay; |
2981 | } | 2984 | } |
src/plugins/dbus3270/gobject.c
@@ -524,6 +524,13 @@ void pw3270_dbus_print(PW3270Dbus *object, DBusGMethodInvocation *context) | @@ -524,6 +524,13 @@ void pw3270_dbus_print(PW3270Dbus *object, DBusGMethodInvocation *context) | ||
524 | dbus_g_method_return(context,lib3270_print(pw3270_dbus_get_session_handle(object))); | 524 | dbus_g_method_return(context,lib3270_print(pw3270_dbus_get_session_handle(object))); |
525 | } | 525 | } |
526 | 526 | ||
527 | +void pw3270_dbus_set_unlock_delay(PW3270Dbus *object, int value, DBusGMethodInvocation *context) | ||
528 | +{ | ||
529 | + lib3270_set_unlock_delay(pw3270_dbus_get_session_handle(object),(unsigned short) value); | ||
530 | + dbus_g_method_return(context,0); | ||
531 | +} | ||
532 | + | ||
533 | + | ||
527 | void pw3270_dbus_ebc2asc(PW3270Dbus *object, const gchar *from, DBusGMethodInvocation *context) | 534 | void pw3270_dbus_ebc2asc(PW3270Dbus *object, const gchar *from, DBusGMethodInvocation *context) |
528 | { | 535 | { |
529 | int sz = strlen(from); | 536 | int sz = strlen(from); |
src/plugins/dbus3270/pw3270dbus.xml
@@ -220,6 +220,12 @@ | @@ -220,6 +220,12 @@ | ||
220 | <arg type="i" name="result" direction="out" /> | 220 | <arg type="i" name="result" direction="out" /> |
221 | </method> | 221 | </method> |
222 | 222 | ||
223 | + <method name="setUnlockDelay"> | ||
224 | + <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | ||
225 | + <arg type="i" name="value" direction="in" /> | ||
226 | + <arg type="i" name="result" direction="out" /> | ||
227 | + </method> | ||
228 | + | ||
223 | </interface> | 229 | </interface> |
224 | 230 | ||
225 | </node> | 231 | </node> |
src/plugins/dbus3270/service.h
@@ -126,6 +126,8 @@ | @@ -126,6 +126,8 @@ | ||
126 | 126 | ||
127 | void pw3270_dbus_filetransfer(PW3270Dbus *object, const gchar *local, const gchar *remote, int flags, int lrecl, int blksize, int primspace, int secspace, int dft, DBusGMethodInvocation *context); | 127 | void pw3270_dbus_filetransfer(PW3270Dbus *object, const gchar *local, const gchar *remote, int flags, int lrecl, int blksize, int primspace, int secspace, int dft, DBusGMethodInvocation *context); |
128 | 128 | ||
129 | + void pw3270_dbus_set_unlock_delay(PW3270Dbus *object, int value, DBusGMethodInvocation *context); | ||
130 | + | ||
129 | G_END_DECLS | 131 | G_END_DECLS |
130 | 132 | ||
131 | #endif // _PW3270_DBUS_SERVICE_H | 133 | #endif // _PW3270_DBUS_SERVICE_H |
src/plugins/dbus3270/test.sh
@@ -65,6 +65,9 @@ run_command() | @@ -65,6 +65,9 @@ run_command() | ||
65 | dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getDisplayCharset | 65 | dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getDisplayCharset |
66 | ;; | 66 | ;; |
67 | 67 | ||
68 | + unlockdelay) | ||
69 | + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.setUnlockDelay int32:$2 | ||
70 | + ;; | ||
68 | 71 | ||
69 | *) | 72 | *) |
70 | echo "Comando $1 desconhecido" | 73 | echo "Comando $1 desconhecido" |
src/plugins/rx3270/pluginmain.cc
@@ -154,6 +154,8 @@ | @@ -154,6 +154,8 @@ | ||
154 | int quit(void); | 154 | int quit(void); |
155 | int action(const char *name); | 155 | int action(const char *name); |
156 | 156 | ||
157 | + void set_unlock_delay(unsigned short ms); | ||
158 | + | ||
157 | protected: | 159 | protected: |
158 | 160 | ||
159 | private: | 161 | private: |
@@ -836,3 +838,8 @@ int plugin::file_transfer(LIB3270_FT_OPTION options, const gchar *local, const g | @@ -836,3 +838,8 @@ int plugin::file_transfer(LIB3270_FT_OPTION options, const gchar *local, const g | ||
836 | { | 838 | { |
837 | return v3270_transfer_file(v3270_get_default_widget(),options,local,remote,lrecl,blksize,primspace,secspace,dft); | 839 | return v3270_transfer_file(v3270_get_default_widget(),options,local,remote,lrecl,blksize,primspace,secspace,dft); |
838 | } | 840 | } |
841 | + | ||
842 | +void plugin::set_unlock_delay(unsigned short ms) | ||
843 | +{ | ||
844 | + lib3270_set_unlock_delay(hSession, (unsigned short) ms); | ||
845 | +} |