diff options
author | marha <marha@users.sourceforge.net> | 2014-10-06 10:07:50 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-10-06 10:09:07 +0200 |
commit | c774a734a9d990789abfe25c2f2dcbd74f4afe44 (patch) | |
tree | eae4a2a0f19cc59dda6e4dadf96de32d22b3e174 /xorg-server/hw/xwin/winclipboard | |
parent | 37facdad11007fb89d30d7de5328ad900de7760d (diff) | |
download | vcxsrv-c774a734a9d990789abfe25c2f2dcbd74f4afe44.tar.gz vcxsrv-c774a734a9d990789abfe25c2f2dcbd74f4afe44.tar.bz2 vcxsrv-c774a734a9d990789abfe25c2f2dcbd74f4afe44.zip |
Some more synchronisation with released branch
Diffstat (limited to 'xorg-server/hw/xwin/winclipboard')
-rwxr-xr-x | xorg-server/hw/xwin/winclipboard/internal.h | 10 | ||||
-rwxr-xr-x | xorg-server/hw/xwin/winclipboard/thread.c | 57 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winclipboard/winclipboard.h | 1 | ||||
-rwxr-xr-x | xorg-server/hw/xwin/winclipboard/wndproc.c | 12 |
4 files changed, 27 insertions, 53 deletions
diff --git a/xorg-server/hw/xwin/winclipboard/internal.h b/xorg-server/hw/xwin/winclipboard/internal.h index fece50740..55c7771af 100755 --- a/xorg-server/hw/xwin/winclipboard/internal.h +++ b/xorg-server/hw/xwin/winclipboard/internal.h @@ -1,5 +1,3 @@ -#ifndef _WINCLIPBOARD_H_ -#define _WINCLIPBOARD_H_ /* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. * @@ -30,6 +28,9 @@ * Authors: Harold L Hunt II */ +#ifndef WINCLIPBOARD_INTERNAL_H +#define WINCLIPBOARD_INTERNAL_H + /* Standard library headers */ #include <assert.h> #include <stdio.h> @@ -79,8 +80,6 @@ extern char *display; Bool winInitClipboard(void); -HWND winClipboardCreateMessagingWindow(void); - /* * winclipboardtextconv.c */ @@ -95,13 +94,12 @@ void * winclipboardthread.c */ -void *winClipboardProc(void *); /* * winclipboardwndproc.c */ -BOOL winClipboardFlushWindowsMessageQueue(HWND hwnd); +Bool winClipboardFlushWindowsMessageQueue(HWND hwnd); LRESULT CALLBACK winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); diff --git a/xorg-server/hw/xwin/winclipboard/thread.c b/xorg-server/hw/xwin/winclipboard/thread.c index 1ba687eb1..50cf997fb 100755 --- a/xorg-server/hw/xwin/winclipboard/thread.c +++ b/xorg-server/hw/xwin/winclipboard/thread.c @@ -89,6 +89,9 @@ Bool g_fUseUnicode = FALSE; * Local function prototypes */ +static HWND +winClipboardCreateMessagingWindow(void); + static int winClipboardErrorHandler(Display * pDisplay, XErrorEvent * pErr); @@ -101,8 +104,8 @@ winClipboardThreadExit(void *arg); * Main thread function */ -void * -winClipboardProc(void *pvNotUsed) +Bool +winClipboardProc(Bool fUseUnicode, char *szDisplay) { Atom atomClipboard; int iReturn; @@ -118,30 +121,25 @@ winClipboardProc(void *pvNotUsed) int iMaxDescriptor; Display *pDisplay = NULL; Window iWindow = None; - int iRetries; - Bool fUseUnicode; - char szDisplay[512]; int iSelectError; pthread_cleanup_push(&winClipboardThreadExit, NULL); winDebug ("winClipboardProc - Hello\n"); - /* Do we use Unicode clipboard? */ - fUseUnicode = g_fUnicodeClipboard; - /* Save the Unicode support flag in a global */ g_fUseUnicode = fUseUnicode; /* Create Windows messaging window */ hwnd = winClipboardCreateMessagingWindow (); - + /* Save copy of HWND in screen privates */ g_hwndClipboard = hwnd; + g_winClipboardProcThread = pthread_self(); + /* Set error handler */ XSetErrorHandler(winClipboardErrorHandler); - g_winClipboardProcThread = pthread_self(); g_winClipboardOldIOErrorHandler = XSetIOErrorHandler(winClipboardIOErrorHandler); @@ -159,41 +157,8 @@ winClipboardProc(void *pvNotUsed) ErrorF("winClipboardProc - setjmp returned for IO Error Handler.\n"); } - /* Use our generated cookie for authentication */ - winSetAuthorization(); - - /* Initialize retry count */ - iRetries = 0; - - /* Setup the display connection string x */ - /* - * NOTE: Always connect to screen 0 since we require that screen - * numbers start at 0 and increase without gaps. We only need - * to connect to one screen on the display to get events - * for all screens on the display. That is why there is only - * one clipboard client thread. - */ - winGetDisplayName(szDisplay, 0); - - /* Print the display connection string */ - winDebug ("winClipboardProc - DISPLAY=%s\n", szDisplay); - - /* Open the X display */ - do { - pDisplay = XOpenDisplay(szDisplay); - if (pDisplay == NULL) { - ErrorF("winClipboardProc - Could not open display, " - "try: %d, sleeping: %d\n", iRetries + 1, WIN_CONNECT_DELAY); - ++iRetries; - sleep(WIN_CONNECT_DELAY); - continue; - } - else - break; - } - while (pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES); - /* Make sure that the display opened */ + pDisplay = XOpenDisplay(szDisplay); if (pDisplay == NULL) { ErrorF("winClipboardProc - Failed opening the display, giving up\n"); goto thread_errorexit; @@ -282,7 +247,7 @@ winClipboardProc(void *pvNotUsed) } /* Pre-flush X events */ - /* + /* * NOTE: Apparently you'll freeze if you don't do this, * because there may be events in local data structures * already. @@ -432,7 +397,7 @@ commonexit: pthread_cleanup_pop(0); - return NULL; + return FALSE; } /* diff --git a/xorg-server/hw/xwin/winclipboard/winclipboard.h b/xorg-server/hw/xwin/winclipboard/winclipboard.h index e4011a172..7b172739a 100644 --- a/xorg-server/hw/xwin/winclipboard/winclipboard.h +++ b/xorg-server/hw/xwin/winclipboard/winclipboard.h @@ -27,5 +27,6 @@ #ifndef WINCLIPBOARD_H #define WINCLIPBOARD_H +void winFixClipboardChain (int Removed); #endif diff --git a/xorg-server/hw/xwin/winclipboard/wndproc.c b/xorg-server/hw/xwin/winclipboard/wndproc.c index 0819de4a5..f5f931f74 100755 --- a/xorg-server/hw/xwin/winclipboard/wndproc.c +++ b/xorg-server/hw/xwin/winclipboard/wndproc.c @@ -33,6 +33,16 @@ #ifdef HAVE_XWIN_CONFIG_H #include <xwin-config.h> #endif + +/* + * Including any server header might define the macro _XSERVER64 on 64 bit machines. + * That macro must _NOT_ be defined for Xlib client code, otherwise bad things happen. + * So let's undef that macro if necessary. + */ +#ifdef _XSERVER64 +#undef _XSERVER64 +#endif + #include <sys/types.h> #include <sys/time.h> #include "winclipboard.h" @@ -494,7 +504,7 @@ winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) * Process any pending Windows messages */ -BOOL +Bool winClipboardFlushWindowsMessageQueue(HWND hwnd) { MSG msg; |