- Timestamp:
- Aug 13, 2008 11:56:52 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedClipboard/x11.cpp
r10891 r11382 32 32 #include <iprt/asm.h> /* For atomic operations */ 33 33 #include <iprt/assert.h> 34 #include <iprt/env.h> 34 35 #include <iprt/mem.h> 35 36 #include <iprt/string.h> … … 167 168 /* Only one client is supported. There seems to be no need for more clients. */ 168 169 static VBOXCLIPBOARDCONTEXT g_ctx; 170 171 /* Are we actually connected to the X11 servicer? */ 172 static bool g_fHaveX11; 169 173 170 174 /** … … 775 779 int rc; 776 780 781 if (!RTEnvGet("DISPLAY")) 782 { 783 /* 784 * If we don't find the DISPLAY environment variable we assume that we are not 785 * connected to an X11 server. Don't actually try to do this then, just fail 786 * silently and report success on every call. This is important for VBoxHeadless. 787 */ 788 LogRel(("vboxClipboardInit: no X11 detected -- host clipboard disabled\n")); 789 g_fHaveX11 = false; 790 return VINF_SUCCESS; 791 } 792 793 g_fHaveX11 = true; 794 777 795 LogRel(("vboxClipboardInit: initializing host clipboard\n")); 778 796 RTSemEventCreate(&g_ctx.waitForData); … … 793 811 void vboxClipboardDestroy (void) 794 812 { 795 LogRel(("vboxClipboardDestroy: shutting down host clipboard\n"));796 813 int rc, rcThread; 797 814 unsigned count = 0; 798 815 XEvent ev; 816 817 /* 818 * Immetiately return if we are not connected to the host X server. 819 */ 820 if (!g_fHaveX11) 821 return; 822 823 LogRel(("vboxClipboardDestroy: shutting down host clipboard\n")); 799 824 800 825 /* Set the termination flag. */ … … 828 853 int vboxClipboardConnect (VBOXCLIPBOARDCLIENTDATA *pClient) 829 854 { 855 /* 856 * Immetiately return if we are not connected to the host X server. 857 */ 858 if (!g_fHaveX11) 859 return VINF_SUCCESS; 860 830 861 LogFlow(("vboxClipboardConnect\n")); 831 862 … … 850 881 int vboxClipboardSync (VBOXCLIPBOARDCLIENTDATA *pClient) 851 882 { 883 /* 884 * Immetiately return if we are not connected to the host X server. 885 */ 886 if (!g_fHaveX11) 887 return VINF_SUCCESS; 888 852 889 /* On a Linux host, the guest should never synchronise/cache its clipboard contents, as 853 890 we have no way of reliably telling when the host clipboard data changes. So instead … … 865 902 void vboxClipboardDisconnect (VBOXCLIPBOARDCLIENTDATA *pClient) 866 903 { 904 /* 905 * Immetiately return if we are not connected to the host X server. 906 */ 907 if (!g_fHaveX11) 908 return; 909 867 910 LogFlow(("vboxClipboardDisconnect\n")); 868 911 … … 1306 1349 void vboxClipboardFormatAnnounce (VBOXCLIPBOARDCLIENTDATA *pClient, uint32_t u32Formats) 1307 1350 { 1351 /* 1352 * Immetiately return if we are not connected to the host X server. 1353 */ 1354 if (!g_fHaveX11) 1355 return; 1356 1308 1357 pClient->pCtx->guestFormats = u32Formats; 1309 1358 LogFlowFunc (("u32Formats=%d\n", u32Formats)); … … 1353 1402 uint32_t cb, uint32_t *pcbActual) 1354 1403 { 1404 /* 1405 * Immetiately return if we are not connected to the host X server. 1406 */ 1407 if (!g_fHaveX11) 1408 { 1409 /* no data available */ 1410 *pcbActual = 0; 1411 return VINF_SUCCESS; 1412 } 1413 1355 1414 LogFlow(("vboxClipboardReadData: u32Format = %d, cb = %d\n", u32Format, cb)); 1356 1415 … … 1409 1468 void vboxClipboardWriteData (VBOXCLIPBOARDCLIENTDATA *pClient, void *pv, uint32_t cb, uint32_t u32Format) 1410 1469 { 1470 if (!g_fHaveX11) 1471 return; 1472 1411 1473 LogFlow(("vboxClipboardWriteData\n")); 1412 1474
Note:
See TracChangeset
for help on using the changeset viewer.