Changeset 106808 in vbox for trunk/src/VBox
- Timestamp:
- Oct 31, 2024 2:20:11 PM (3 months ago)
- Location:
- trunk/src/VBox/Additions/x11/VBoxClient
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/vboxwl.cpp
r106790 r106808 534 534 535 535 /** 536 * Get IPC server socket name prefix depending on session type. 537 * 538 * @returns Prefix name or NULL if session type is unknown. 539 */ 540 static const char *vboxwl_ipc_srv_name_prefix(void) 541 { 542 const char *pcszPrefix; 543 544 switch (g_enmSessionType) 545 { 546 case VBCL_WL_CLIPBOARD_SESSION_TYPE_COPY_TO_GUEST: 547 case VBCL_WL_CLIPBOARD_SESSION_TYPE_ANNOUNCE_TO_HOST: 548 case VBCL_WL_CLIPBOARD_SESSION_TYPE_COPY_TO_HOST: 549 { 550 pcszPrefix = VBOXWL_SRV_NAME_PREFIX_CLIP; 551 break; 552 } 553 554 default: 555 pcszPrefix = NULL; 556 } 557 558 return pcszPrefix; 559 } 560 561 /** 536 562 * Connect to VBoxClient service. 537 563 * … … 543 569 int rc; 544 570 char szIpcServerName[128]; 571 const char *pcszPrefix = vboxwl_ipc_srv_name_prefix(); 545 572 546 573 AssertPtrReturn(phIpcSession, VERR_INVALID_PARAMETER); 547 548 rc = vbcl_wayland_hlp_gtk_ipc_srv_name(szIpcServerName, sizeof(szIpcServerName)); 574 AssertPtrReturn(pcszPrefix, VERR_INVALID_POINTER); 575 576 rc = vbcl_wayland_hlp_gtk_ipc_srv_name(pcszPrefix, szIpcServerName, sizeof(szIpcServerName)); 549 577 if (RT_SUCCESS(rc)) 550 578 rc = RTLocalIpcSessionConnect(phIpcSession, szIpcServerName, 0); -
trunk/src/VBox/Additions/x11/VBoxClient/wayland-helper-gtk.cpp
r106807 r106808 83 83 /** Local IPC server object. */ 84 84 RTLOCALIPCSERVER hIpcServer; 85 86 /** IPC server socket name prefix. */ 87 const char *pcszIpcSockPrefix; 85 88 } vbox_wl_gtk_ctx_t; 86 89 … … 337 340 char szIpcServerName[128]; 338 341 342 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 343 AssertPtrReturn(pCtx->pcszIpcSockPrefix, VERR_INVALID_POINTER); 344 339 345 RTThreadUserSignal(hThreadSelf); 340 346 341 347 VBClLogVerbose(1, "starting IPC\n"); 342 348 343 rc = vbcl_wayland_hlp_gtk_ipc_srv_name( szIpcServerName, sizeof(szIpcServerName));349 rc = vbcl_wayland_hlp_gtk_ipc_srv_name(pCtx->pcszIpcSockPrefix, szIpcServerName, sizeof(szIpcServerName)); 344 350 345 351 if (RT_SUCCESS(rc)) … … 429 435 430 436 RT_ZERO(g_GtkClipCtx); 437 438 /* Set IPC server socket name prefix before server is started. */ 439 g_GtkClipCtx.pcszIpcSockPrefix = VBOXWL_SRV_NAME_PREFIX_CLIP; 431 440 432 441 return vbcl_wayland_thread_start(&g_GtkClipCtx.Thread, vbcl_wayland_hlp_gtk_worker, "wl-gtk-ipc", &g_GtkClipCtx); -
trunk/src/VBox/Additions/x11/VBoxClient/wayland-helper-ipc.cpp
r106790 r106808 45 45 #include "wayland-helper-ipc.h" 46 46 47 RTDECL(int) vbcl_wayland_hlp_gtk_ipc_srv_name(c har *szBuf, size_t cbBuf)47 RTDECL(int) vbcl_wayland_hlp_gtk_ipc_srv_name(const char *szNamePrefix, char *szBuf, size_t cbBuf) 48 48 { 49 49 int rc; … … 53 53 struct passwd *pwd; 54 54 55 AssertReturn(RT_VALID_PTR(szBuf), VERR_INVALID_PARAMETER); 55 AssertPtrReturn(szNamePrefix, VERR_INVALID_POINTER); 56 AssertPtrReturn(szBuf, VERR_INVALID_POINTER); 56 57 AssertReturn(cbBuf > 0, VERR_INVALID_PARAMETER); 57 58 … … 60 61 61 62 rc = RTStrCat(szBuf, cbBuf, "GtkHlpIpcServer-"); 63 if (RT_SUCCESS(rc)) 64 rc = RTStrCat(szBuf, cbBuf, szNamePrefix); 65 if (RT_SUCCESS(rc)) 66 rc = RTStrCat(szBuf, cbBuf, "-"); 62 67 if (RT_SUCCESS(rc)) 63 68 rc = RTLinuxSysFsReadStrFile(pszActiveTTY, sizeof(pszActiveTTY) - 1 /* reserve last byte for string termination */, -
trunk/src/VBox/Additions/x11/VBoxClient/wayland-helper-ipc.h
r106790 r106808 60 60 /** Limit maximum log verbosity level for popup tool. */ 61 61 #define VBOXWL_VERBOSITY_MAX (5) 62 63 /** IPC server socket name prefixes. */ 64 #define VBOXWL_SRV_NAME_PREFIX_CLIP "clip" 62 65 63 66 /** Arguments to vboxwl tool. */ … … 415 418 * This function should be used by both IPC server and client code 416 419 * in order to connect one to another. Output string will be in 417 * format: GtkHlpIpcServer-< active tty>-<user name>.420 * format: GtkHlpIpcServer-<prefix>--<active tty>-<user name>. 418 421 * 419 422 * @returns IPRT status code. 420 * @param szBuf Where to store generated name string. 421 * @param cbBuf Size of buffer. 423 * @param szNamePrefix Name prefix. 424 * @param szBuf Where to store generated name string. 425 * @param cbBuf Size of buffer. 422 426 */ 423 RTDECL(int) vbcl_wayland_hlp_gtk_ipc_srv_name(c har *szBuf, size_t cbBuf);427 RTDECL(int) vbcl_wayland_hlp_gtk_ipc_srv_name(const char *szNamePrefix, char *szBuf, size_t cbBuf); 424 428 425 429 #endif /* !GA_INCLUDED_SRC_x11_VBoxClient_wayland_helper_ipc_h */
Note:
See TracChangeset
for help on using the changeset viewer.