Commit 34f7ad747d1796420bef179c966d9eecf1282d8e
1 parent
5076a548
Exists in
master
and in
5 other branches
Corrigindo tratamento do dbus em rexx
Showing
6 changed files
with
36 additions
and
9 deletions
Show diff stats
src/plugins/dbus3270/gobject.c
... | ... | @@ -370,14 +370,19 @@ void pw3270_dbus_pa_key(PW3270Dbus *object, int key, DBusGMethodInvocation *cont |
370 | 370 | dbus_g_method_return(context,lib3270_get_next_unprotected(pw3270_dbus_get_session_handle(object),baddr)); |
371 | 371 | } |
372 | 372 | |
373 | -void pw3270_dbus_get_clipboard(PW3270Dbus *object, int row, int col, int len, DBusGMethodInvocation *context) | |
373 | +void pw3270_dbus_get_clipboard(PW3270Dbus *object, DBusGMethodInvocation *context) | |
374 | 374 | { |
375 | 375 | gchar *text; |
376 | 376 | |
377 | + trace("%s object=%p context=%p",__FUNCTION__,object,context); | |
378 | + | |
377 | 379 | if(pw3270_dbus_check_valid_state(object,context)) |
378 | 380 | return; |
379 | 381 | |
380 | 382 | text = gtk_clipboard_wait_for_text(gtk_widget_get_clipboard(pw3270_get_toplevel(),GDK_SELECTION_CLIPBOARD)); |
383 | + | |
384 | + trace("Clipboard:\n%s\n",text); | |
385 | + | |
381 | 386 | if(!text) |
382 | 387 | { |
383 | 388 | GError *error = pw3270_dbus_get_error_from_errno(ENOENT); |
... | ... | @@ -393,6 +398,7 @@ void pw3270_dbus_get_clipboard(PW3270Dbus *object, int row, int col, int len, DB |
393 | 398 | |
394 | 399 | void pw3270_dbus_set_clipboard(PW3270Dbus *object, const gchar *text, DBusGMethodInvocation *context) |
395 | 400 | { |
401 | + trace("%s object=%p context=%p",__FUNCTION__,object,context); | |
396 | 402 | gtk_clipboard_set_text(gtk_widget_get_clipboard(pw3270_get_toplevel(),GDK_SELECTION_CLIPBOARD),(gchar *) text, -1); |
397 | 403 | dbus_g_method_return(context,0); |
398 | 404 | } | ... | ... |
src/plugins/dbus3270/pw3270dbus.xml
... | ... | @@ -64,6 +64,7 @@ |
64 | 64 | <method name="setClipboard"> |
65 | 65 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> |
66 | 66 | <arg type="s" name="text" direction="in" /> |
67 | + <arg type="i" name="result" direction="out" /> | |
67 | 68 | </method> |
68 | 69 | <method name="getClipboard"> |
69 | 70 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | ... | ... |
src/plugins/dbus3270/service.h
... | ... | @@ -101,7 +101,7 @@ |
101 | 101 | void pw3270_dbus_input(PW3270Dbus *object, const gchar *utftext, DBusGMethodInvocation *context); |
102 | 102 | |
103 | 103 | void pw3270_dbus_set_clipboard(PW3270Dbus *object, const gchar *text, DBusGMethodInvocation *context); |
104 | - void pw3270_dbus_get_clipboard(PW3270Dbus *object, int row, int col, int len, DBusGMethodInvocation *context); | |
104 | + void pw3270_dbus_get_clipboard(PW3270Dbus *object, DBusGMethodInvocation *context); | |
105 | 105 | |
106 | 106 | G_END_DECLS |
107 | 107 | ... | ... |
src/plugins/dbus3270/test.sh
... | ... | @@ -41,6 +41,10 @@ run_command() |
41 | 41 | dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.enter |
42 | 42 | ;; |
43 | 43 | |
44 | + isconnected) | |
45 | + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.isConnected | |
46 | + ;; | |
47 | + | |
44 | 48 | *) |
45 | 49 | echo "Comando $1 desconhecido" |
46 | 50 | ;; | ... | ... |
src/plugins/rx3270/remote.cc
... | ... | @@ -192,6 +192,9 @@ remote::remote(const char *name) |
192 | 192 | int rc; |
193 | 193 | char * str = strdup(name); |
194 | 194 | char * ptr; |
195 | + char busname[4096]; | |
196 | + char pidname[10]; | |
197 | + int pid = (int) getpid(); | |
195 | 198 | |
196 | 199 | trace("%s str=%p",__FUNCTION__,str); |
197 | 200 | |
... | ... | @@ -272,7 +275,18 @@ remote::remote(const char *name) |
272 | 275 | return; |
273 | 276 | } |
274 | 277 | |
275 | - rc = dbus_bus_request_name(conn, "br.com.bb." PACKAGE_NAME ".rexx", DBUS_NAME_FLAG_REPLACE_EXISTING , &err); | |
278 | + memset(pidname,0,10); | |
279 | + for(int f = 0; f < 9 && pid > 0;f++) | |
280 | + { | |
281 | + pidname[f] = 'a'+(pid % 25); | |
282 | + pid /= 25; | |
283 | + } | |
284 | + | |
285 | + snprintf(busname, 4095, "%s.rx3270.br.com.bb",pidname); | |
286 | + | |
287 | + trace("Busname: [%s]",busname); | |
288 | + | |
289 | + rc = dbus_bus_request_name(conn, busname, DBUS_NAME_FLAG_REPLACE_EXISTING , &err); | |
276 | 290 | trace("dbus_bus_request_name rc=%d",rc); |
277 | 291 | |
278 | 292 | if (dbus_error_is_set(&err)) |
... | ... | @@ -285,11 +299,14 @@ remote::remote(const char *name) |
285 | 299 | |
286 | 300 | if(rc != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) |
287 | 301 | { |
288 | - log("%s", "DBUS request name failed"); | |
302 | + trace("%s: DBUS request for name %s failed",__FUNCTION__, busname); | |
303 | + log("DBUS for \"%s\" failed",name); | |
289 | 304 | conn = NULL; |
290 | 305 | return; |
291 | 306 | } |
292 | 307 | |
308 | + trace("%s: Using DBUS name %s",__FUNCTION__,busname); | |
309 | + | |
293 | 310 | |
294 | 311 | #else |
295 | 312 | |
... | ... | @@ -1191,11 +1208,8 @@ char * remote::get_clipboard(void) |
1191 | 1208 | |
1192 | 1209 | #elif defined(HAVE_DBUS) |
1193 | 1210 | |
1194 | - DBusMessage * msg = create_message("getClipboard"); | |
1195 | - if(!msg) | |
1196 | - return NULL; | |
1197 | - | |
1198 | - return get_string(call(msg)); | |
1211 | + trace("%s",__FUNCTION__); | |
1212 | + return query_string("getClipboard"); | |
1199 | 1213 | |
1200 | 1214 | #endif |
1201 | 1215 | ... | ... |