Merge from CYGWIN branch

2004-08-02 Kensuke Matsuzaki
Fix the bug that we can't copy & paste multi-byte string to Unicode-base
    Windows application. Rename fUnicodeSupport to fUseUnicode, because it
    don't mean wheather Windows support Unicode or not.
This commit is contained in:
Alexander Gottwald 2004-08-03 10:12:25 +00:00
parent defcfe3c7e
commit 9c1d52a69d
5 changed files with 43 additions and 27 deletions

View File

@ -1,3 +1,12 @@
2004-08-02 Kensuke Matsuzaki
* winclipboardthread.c winclipboardwndproc.c:
* winclipboardxevents.c winwin32rootlesswndproc.c:
Fix the bug that we can't copy & paste multi-byte string to
Unicode-base Windows application. Rename fUnicodeSupport to
fUseUnicode, because it don't mean wheather Windows support
Unicode or not.
2004-07-31 Alexander Gottwald <ago@freedesktop.org>
* win.h:
@ -9,7 +18,6 @@
test if colormap with index really exists in the list of
installed maps before using it.
2004-07-09 Alexander Gottwald <ago@freedesktop.org>
* winconfig.c: Add entry for irish layout (ie)

View File

@ -61,6 +61,7 @@ extern Window g_iClipboardWindow;
static jmp_buf g_jmpEntry;
Bool g_fUnicodeSupport = FALSE;
Bool g_fUseUnicode = FALSE;
/*
@ -91,16 +92,19 @@ winClipboardProc (void *pvNotUsed)
Display *pDisplay = NULL;
Window iWindow = None;
int iRetries;
Bool fUnicodeSupport;
Bool fUseUnicode;
char szDisplay[512];
ErrorF ("winClipboardProc - Hello\n");
/* Do we have Unicode support? */
fUnicodeSupport = g_fUnicodeClipboard && winClipboardDetectUnicodeSupport ();
g_fUnicodeSupport = winClipboardDetectUnicodeSupport ();
/* Do we use Unicode clipboard? */
fUseUnicode = g_fUnicodeClipboard && g_fUnicodeSupport;
/* Save the Unicode support flag in a global */
g_fUnicodeSupport = fUnicodeSupport;
g_fUseUnicode = fUseUnicode;
/* Allow multiple threads to access Xlib */
if (XInitThreads () == 0)
@ -224,9 +228,6 @@ winClipboardProc (void *pvNotUsed)
atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False);
atomClipboardManager = XInternAtom (pDisplay, "CLIPBOARD_MANAGER", False);
/* FIXME: Save some values as globals for the window proc */
g_fUnicodeSupport = fUnicodeSupport;
/* Create a messaging window */
iWindow = XCreateSimpleWindow (pDisplay,
DefaultRootWindow (pDisplay),
@ -296,7 +297,7 @@ winClipboardProc (void *pvNotUsed)
winClipboardFlushXEvents (hwnd,
iWindow,
pDisplay,
fUnicodeSupport);
fUseUnicode);
/* Pre-flush Windows messages */
if (!winClipboardFlushWindowsMessageQueue (hwnd))
@ -344,7 +345,7 @@ winClipboardProc (void *pvNotUsed)
iReturn = winClipboardFlushXEvents (hwnd,
iWindow,
pDisplay,
fUnicodeSupport);
fUseUnicode);
if (WIN_XEVENTS_SHUTDOWN == iReturn)
{
ErrorF ("winClipboardProc - winClipboardFlushXEvents "

View File

@ -43,7 +43,7 @@
* References to external symbols
*/
extern Bool g_fUnicodeSupport;
extern Bool g_fUseUnicode;
extern void *g_pClipboardDisplay;
extern Window g_iClipboardWindow;
extern Atom g_atomLastOwnedSelection;
@ -55,7 +55,7 @@ extern Atom g_atomLastOwnedSelection;
static Bool
winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
Bool fUnicodeSupport, int iTimeoutSec);
Bool fUseUnicode, int iTimeoutSec);
/*
@ -64,7 +64,7 @@ winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
static int
winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
Bool fUnicodeSupport, int iTimeoutSec)
Bool fUseUnicode, int iTimeoutSec)
{
int iConnNumber;
struct timeval tv;
@ -115,7 +115,7 @@ winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
iReturn = winClipboardFlushXEvents (hwnd,
iWindow,
pDisplay,
fUnicodeSupport);
fUseUnicode);
if (WIN_XEVENTS_NOTIFY == iReturn
|| WIN_XEVENTS_CONVERT == iReturn)
{
@ -445,7 +445,7 @@ winClipboardWindowProc (HWND hwnd, UINT message,
if (message == WM_RENDERALLFORMATS)
fConvertToUnicode = FALSE;
else
fConvertToUnicode = g_fUnicodeSupport && (CF_UNICODETEXT == wParam);
fConvertToUnicode = g_fUseUnicode && (CF_UNICODETEXT == wParam);
/* Request the selection contents */
iReturn = XConvertSelection (pDisplay,

View File

@ -31,6 +31,13 @@
#include "winclipboard.h"
/*
* References to external symbols
*/
extern Bool g_fUnicodeSupport;
/*
* Process any pending X events
*/
@ -39,7 +46,7 @@ int
winClipboardFlushXEvents (HWND hwnd,
int iWindow,
Display *pDisplay,
Bool fUnicodeSupport)
Bool fUseUnicode)
{
Atom atomLocalProperty = XInternAtom (pDisplay,
WIN_LOCAL_PROPERTY,
@ -173,7 +180,7 @@ winClipboardFlushXEvents (HWND hwnd,
}
/* Check that clipboard format is available */
if (fUnicodeSupport
if (fUseUnicode
&& !IsClipboardFormatAvailable (CF_UNICODETEXT))
{
ErrorF ("winClipboardFlushXEvents - CF_UNICODETEXT is not "
@ -183,7 +190,7 @@ winClipboardFlushXEvents (HWND hwnd,
fAbort = TRUE;
goto winClipboardFlushXEvents_SelectionRequest_Done;
}
else if (!fUnicodeSupport
else if (!fUseUnicode
&& !IsClipboardFormatAvailable (CF_TEXT))
{
ErrorF ("winClipboardFlushXEvents - CF_TEXT is not "
@ -232,7 +239,7 @@ winClipboardFlushXEvents (HWND hwnd,
*/
/* Get a pointer to the clipboard text, in desired format */
if (fUnicodeSupport)
if (fUseUnicode)
{
/* Retrieve clipboard data */
hGlobal = GetClipboardData (CF_UNICODETEXT);
@ -255,7 +262,7 @@ winClipboardFlushXEvents (HWND hwnd,
pszGlobalData = (char *) GlobalLock (hGlobal);
/* Convert the Unicode string to UTF8 (MBCS) */
if (fUnicodeSupport)
if (fUseUnicode)
{
iConvertDataLen = WideCharToMultiByte (CP_UTF8,
0,
@ -293,7 +300,7 @@ winClipboardFlushXEvents (HWND hwnd,
xtpText.value = NULL;
/* Create the text property from the text list */
if (fUnicodeSupport)
if (fUseUnicode)
{
#ifdef X_HAVE_UTF8_STRING
iReturn = Xutf8TextListToTextProperty (pDisplay,
@ -586,7 +593,7 @@ winClipboardFlushXEvents (HWND hwnd,
}
#endif
if (fUnicodeSupport)
if (fUseUnicode)
{
#ifdef X_HAVE_UTF8_STRING
/* Convert the text property to a text list */
@ -657,7 +664,7 @@ winClipboardFlushXEvents (HWND hwnd,
/* Convert the X clipboard string to DOS format */
winClipboardUNIXtoDOS (&pszReturnData, strlen (pszReturnData));
if (fUnicodeSupport)
if (fUseUnicode)
{
/* Find out how much space needed to convert MBCS to Unicode */
iUnicodeLen = MultiByteToWideChar (CP_UTF8,
@ -726,7 +733,7 @@ winClipboardFlushXEvents (HWND hwnd,
}
/* Copy the returned string into the global memory */
if (fUnicodeSupport)
if (fUseUnicode)
{
memcpy (pszGlobalData,
pwszUnicodeStr,
@ -746,7 +753,7 @@ winClipboardFlushXEvents (HWND hwnd,
pszGlobalData = NULL;
/* Push the selection data to the Windows clipboard */
if (fUnicodeSupport)
if (fUseUnicode)
SetClipboardData (CF_UNICODETEXT, hGlobal);
else
SetClipboardData (CF_TEXT, hGlobal);
@ -771,9 +778,9 @@ winClipboardFlushXEvents (HWND hwnd,
free (pwszUnicodeStr);
if (hGlobal && pszGlobalData)
GlobalUnlock (hGlobal);
if (fSetClipboardData && fUnicodeSupport)
if (fSetClipboardData && g_fUnicodeSupport)
SetClipboardData (CF_UNICODETEXT, NULL);
if (fSetClipboardData && !fUnicodeSupport)
if (fSetClipboardData)
SetClipboardData (CF_TEXT, NULL);
return WIN_XEVENTS_NOTIFY;

View File

@ -932,7 +932,7 @@ winMWExtWMWindowProc (HWND hwnd, UINT message,
if ((dwWindowProcessID == dwCurrentProcessID)
&& GetProp (Above, WIN_WINDOW_PROP)
&& !IsIconic (hwnd) ) /* ignore minimized windows */
&& !IsIconic (hWndAbove) ) /* ignore minimized windows */
break;
}
/* If this is top of X windows in Windows stack,