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:
parent
defcfe3c7e
commit
9c1d52a69d
@ -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>
|
2004-07-31 Alexander Gottwald <ago@freedesktop.org>
|
||||||
|
|
||||||
* win.h:
|
* win.h:
|
||||||
@ -9,7 +18,6 @@
|
|||||||
test if colormap with index really exists in the list of
|
test if colormap with index really exists in the list of
|
||||||
installed maps before using it.
|
installed maps before using it.
|
||||||
|
|
||||||
|
|
||||||
2004-07-09 Alexander Gottwald <ago@freedesktop.org>
|
2004-07-09 Alexander Gottwald <ago@freedesktop.org>
|
||||||
|
|
||||||
* winconfig.c: Add entry for irish layout (ie)
|
* winconfig.c: Add entry for irish layout (ie)
|
||||||
|
@ -61,6 +61,7 @@ extern Window g_iClipboardWindow;
|
|||||||
|
|
||||||
static jmp_buf g_jmpEntry;
|
static jmp_buf g_jmpEntry;
|
||||||
Bool g_fUnicodeSupport = FALSE;
|
Bool g_fUnicodeSupport = FALSE;
|
||||||
|
Bool g_fUseUnicode = FALSE;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -91,16 +92,19 @@ winClipboardProc (void *pvNotUsed)
|
|||||||
Display *pDisplay = NULL;
|
Display *pDisplay = NULL;
|
||||||
Window iWindow = None;
|
Window iWindow = None;
|
||||||
int iRetries;
|
int iRetries;
|
||||||
Bool fUnicodeSupport;
|
Bool fUseUnicode;
|
||||||
char szDisplay[512];
|
char szDisplay[512];
|
||||||
|
|
||||||
ErrorF ("winClipboardProc - Hello\n");
|
ErrorF ("winClipboardProc - Hello\n");
|
||||||
|
|
||||||
/* Do we have Unicode support? */
|
/* 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 */
|
/* Save the Unicode support flag in a global */
|
||||||
g_fUnicodeSupport = fUnicodeSupport;
|
g_fUseUnicode = fUseUnicode;
|
||||||
|
|
||||||
/* Allow multiple threads to access Xlib */
|
/* Allow multiple threads to access Xlib */
|
||||||
if (XInitThreads () == 0)
|
if (XInitThreads () == 0)
|
||||||
@ -224,9 +228,6 @@ winClipboardProc (void *pvNotUsed)
|
|||||||
atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False);
|
atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False);
|
||||||
atomClipboardManager = XInternAtom (pDisplay, "CLIPBOARD_MANAGER", False);
|
atomClipboardManager = XInternAtom (pDisplay, "CLIPBOARD_MANAGER", False);
|
||||||
|
|
||||||
/* FIXME: Save some values as globals for the window proc */
|
|
||||||
g_fUnicodeSupport = fUnicodeSupport;
|
|
||||||
|
|
||||||
/* Create a messaging window */
|
/* Create a messaging window */
|
||||||
iWindow = XCreateSimpleWindow (pDisplay,
|
iWindow = XCreateSimpleWindow (pDisplay,
|
||||||
DefaultRootWindow (pDisplay),
|
DefaultRootWindow (pDisplay),
|
||||||
@ -296,7 +297,7 @@ winClipboardProc (void *pvNotUsed)
|
|||||||
winClipboardFlushXEvents (hwnd,
|
winClipboardFlushXEvents (hwnd,
|
||||||
iWindow,
|
iWindow,
|
||||||
pDisplay,
|
pDisplay,
|
||||||
fUnicodeSupport);
|
fUseUnicode);
|
||||||
|
|
||||||
/* Pre-flush Windows messages */
|
/* Pre-flush Windows messages */
|
||||||
if (!winClipboardFlushWindowsMessageQueue (hwnd))
|
if (!winClipboardFlushWindowsMessageQueue (hwnd))
|
||||||
@ -344,7 +345,7 @@ winClipboardProc (void *pvNotUsed)
|
|||||||
iReturn = winClipboardFlushXEvents (hwnd,
|
iReturn = winClipboardFlushXEvents (hwnd,
|
||||||
iWindow,
|
iWindow,
|
||||||
pDisplay,
|
pDisplay,
|
||||||
fUnicodeSupport);
|
fUseUnicode);
|
||||||
if (WIN_XEVENTS_SHUTDOWN == iReturn)
|
if (WIN_XEVENTS_SHUTDOWN == iReturn)
|
||||||
{
|
{
|
||||||
ErrorF ("winClipboardProc - winClipboardFlushXEvents "
|
ErrorF ("winClipboardProc - winClipboardFlushXEvents "
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
* References to external symbols
|
* References to external symbols
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern Bool g_fUnicodeSupport;
|
extern Bool g_fUseUnicode;
|
||||||
extern void *g_pClipboardDisplay;
|
extern void *g_pClipboardDisplay;
|
||||||
extern Window g_iClipboardWindow;
|
extern Window g_iClipboardWindow;
|
||||||
extern Atom g_atomLastOwnedSelection;
|
extern Atom g_atomLastOwnedSelection;
|
||||||
@ -55,7 +55,7 @@ extern Atom g_atomLastOwnedSelection;
|
|||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
|
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
|
static int
|
||||||
winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
|
winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
|
||||||
Bool fUnicodeSupport, int iTimeoutSec)
|
Bool fUseUnicode, int iTimeoutSec)
|
||||||
{
|
{
|
||||||
int iConnNumber;
|
int iConnNumber;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
@ -115,7 +115,7 @@ winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
|
|||||||
iReturn = winClipboardFlushXEvents (hwnd,
|
iReturn = winClipboardFlushXEvents (hwnd,
|
||||||
iWindow,
|
iWindow,
|
||||||
pDisplay,
|
pDisplay,
|
||||||
fUnicodeSupport);
|
fUseUnicode);
|
||||||
if (WIN_XEVENTS_NOTIFY == iReturn
|
if (WIN_XEVENTS_NOTIFY == iReturn
|
||||||
|| WIN_XEVENTS_CONVERT == iReturn)
|
|| WIN_XEVENTS_CONVERT == iReturn)
|
||||||
{
|
{
|
||||||
@ -445,7 +445,7 @@ winClipboardWindowProc (HWND hwnd, UINT message,
|
|||||||
if (message == WM_RENDERALLFORMATS)
|
if (message == WM_RENDERALLFORMATS)
|
||||||
fConvertToUnicode = FALSE;
|
fConvertToUnicode = FALSE;
|
||||||
else
|
else
|
||||||
fConvertToUnicode = g_fUnicodeSupport && (CF_UNICODETEXT == wParam);
|
fConvertToUnicode = g_fUseUnicode && (CF_UNICODETEXT == wParam);
|
||||||
|
|
||||||
/* Request the selection contents */
|
/* Request the selection contents */
|
||||||
iReturn = XConvertSelection (pDisplay,
|
iReturn = XConvertSelection (pDisplay,
|
||||||
|
@ -31,6 +31,13 @@
|
|||||||
#include "winclipboard.h"
|
#include "winclipboard.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* References to external symbols
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern Bool g_fUnicodeSupport;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Process any pending X events
|
* Process any pending X events
|
||||||
*/
|
*/
|
||||||
@ -39,7 +46,7 @@ int
|
|||||||
winClipboardFlushXEvents (HWND hwnd,
|
winClipboardFlushXEvents (HWND hwnd,
|
||||||
int iWindow,
|
int iWindow,
|
||||||
Display *pDisplay,
|
Display *pDisplay,
|
||||||
Bool fUnicodeSupport)
|
Bool fUseUnicode)
|
||||||
{
|
{
|
||||||
Atom atomLocalProperty = XInternAtom (pDisplay,
|
Atom atomLocalProperty = XInternAtom (pDisplay,
|
||||||
WIN_LOCAL_PROPERTY,
|
WIN_LOCAL_PROPERTY,
|
||||||
@ -173,7 +180,7 @@ winClipboardFlushXEvents (HWND hwnd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check that clipboard format is available */
|
/* Check that clipboard format is available */
|
||||||
if (fUnicodeSupport
|
if (fUseUnicode
|
||||||
&& !IsClipboardFormatAvailable (CF_UNICODETEXT))
|
&& !IsClipboardFormatAvailable (CF_UNICODETEXT))
|
||||||
{
|
{
|
||||||
ErrorF ("winClipboardFlushXEvents - CF_UNICODETEXT is not "
|
ErrorF ("winClipboardFlushXEvents - CF_UNICODETEXT is not "
|
||||||
@ -183,7 +190,7 @@ winClipboardFlushXEvents (HWND hwnd,
|
|||||||
fAbort = TRUE;
|
fAbort = TRUE;
|
||||||
goto winClipboardFlushXEvents_SelectionRequest_Done;
|
goto winClipboardFlushXEvents_SelectionRequest_Done;
|
||||||
}
|
}
|
||||||
else if (!fUnicodeSupport
|
else if (!fUseUnicode
|
||||||
&& !IsClipboardFormatAvailable (CF_TEXT))
|
&& !IsClipboardFormatAvailable (CF_TEXT))
|
||||||
{
|
{
|
||||||
ErrorF ("winClipboardFlushXEvents - CF_TEXT is not "
|
ErrorF ("winClipboardFlushXEvents - CF_TEXT is not "
|
||||||
@ -232,7 +239,7 @@ winClipboardFlushXEvents (HWND hwnd,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Get a pointer to the clipboard text, in desired format */
|
/* Get a pointer to the clipboard text, in desired format */
|
||||||
if (fUnicodeSupport)
|
if (fUseUnicode)
|
||||||
{
|
{
|
||||||
/* Retrieve clipboard data */
|
/* Retrieve clipboard data */
|
||||||
hGlobal = GetClipboardData (CF_UNICODETEXT);
|
hGlobal = GetClipboardData (CF_UNICODETEXT);
|
||||||
@ -255,7 +262,7 @@ winClipboardFlushXEvents (HWND hwnd,
|
|||||||
pszGlobalData = (char *) GlobalLock (hGlobal);
|
pszGlobalData = (char *) GlobalLock (hGlobal);
|
||||||
|
|
||||||
/* Convert the Unicode string to UTF8 (MBCS) */
|
/* Convert the Unicode string to UTF8 (MBCS) */
|
||||||
if (fUnicodeSupport)
|
if (fUseUnicode)
|
||||||
{
|
{
|
||||||
iConvertDataLen = WideCharToMultiByte (CP_UTF8,
|
iConvertDataLen = WideCharToMultiByte (CP_UTF8,
|
||||||
0,
|
0,
|
||||||
@ -293,7 +300,7 @@ winClipboardFlushXEvents (HWND hwnd,
|
|||||||
xtpText.value = NULL;
|
xtpText.value = NULL;
|
||||||
|
|
||||||
/* Create the text property from the text list */
|
/* Create the text property from the text list */
|
||||||
if (fUnicodeSupport)
|
if (fUseUnicode)
|
||||||
{
|
{
|
||||||
#ifdef X_HAVE_UTF8_STRING
|
#ifdef X_HAVE_UTF8_STRING
|
||||||
iReturn = Xutf8TextListToTextProperty (pDisplay,
|
iReturn = Xutf8TextListToTextProperty (pDisplay,
|
||||||
@ -586,7 +593,7 @@ winClipboardFlushXEvents (HWND hwnd,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (fUnicodeSupport)
|
if (fUseUnicode)
|
||||||
{
|
{
|
||||||
#ifdef X_HAVE_UTF8_STRING
|
#ifdef X_HAVE_UTF8_STRING
|
||||||
/* Convert the text property to a text list */
|
/* Convert the text property to a text list */
|
||||||
@ -657,7 +664,7 @@ winClipboardFlushXEvents (HWND hwnd,
|
|||||||
/* Convert the X clipboard string to DOS format */
|
/* Convert the X clipboard string to DOS format */
|
||||||
winClipboardUNIXtoDOS (&pszReturnData, strlen (pszReturnData));
|
winClipboardUNIXtoDOS (&pszReturnData, strlen (pszReturnData));
|
||||||
|
|
||||||
if (fUnicodeSupport)
|
if (fUseUnicode)
|
||||||
{
|
{
|
||||||
/* Find out how much space needed to convert MBCS to Unicode */
|
/* Find out how much space needed to convert MBCS to Unicode */
|
||||||
iUnicodeLen = MultiByteToWideChar (CP_UTF8,
|
iUnicodeLen = MultiByteToWideChar (CP_UTF8,
|
||||||
@ -726,7 +733,7 @@ winClipboardFlushXEvents (HWND hwnd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the returned string into the global memory */
|
/* Copy the returned string into the global memory */
|
||||||
if (fUnicodeSupport)
|
if (fUseUnicode)
|
||||||
{
|
{
|
||||||
memcpy (pszGlobalData,
|
memcpy (pszGlobalData,
|
||||||
pwszUnicodeStr,
|
pwszUnicodeStr,
|
||||||
@ -746,7 +753,7 @@ winClipboardFlushXEvents (HWND hwnd,
|
|||||||
pszGlobalData = NULL;
|
pszGlobalData = NULL;
|
||||||
|
|
||||||
/* Push the selection data to the Windows clipboard */
|
/* Push the selection data to the Windows clipboard */
|
||||||
if (fUnicodeSupport)
|
if (fUseUnicode)
|
||||||
SetClipboardData (CF_UNICODETEXT, hGlobal);
|
SetClipboardData (CF_UNICODETEXT, hGlobal);
|
||||||
else
|
else
|
||||||
SetClipboardData (CF_TEXT, hGlobal);
|
SetClipboardData (CF_TEXT, hGlobal);
|
||||||
@ -771,9 +778,9 @@ winClipboardFlushXEvents (HWND hwnd,
|
|||||||
free (pwszUnicodeStr);
|
free (pwszUnicodeStr);
|
||||||
if (hGlobal && pszGlobalData)
|
if (hGlobal && pszGlobalData)
|
||||||
GlobalUnlock (hGlobal);
|
GlobalUnlock (hGlobal);
|
||||||
if (fSetClipboardData && fUnicodeSupport)
|
if (fSetClipboardData && g_fUnicodeSupport)
|
||||||
SetClipboardData (CF_UNICODETEXT, NULL);
|
SetClipboardData (CF_UNICODETEXT, NULL);
|
||||||
if (fSetClipboardData && !fUnicodeSupport)
|
if (fSetClipboardData)
|
||||||
SetClipboardData (CF_TEXT, NULL);
|
SetClipboardData (CF_TEXT, NULL);
|
||||||
return WIN_XEVENTS_NOTIFY;
|
return WIN_XEVENTS_NOTIFY;
|
||||||
|
|
||||||
|
@ -932,7 +932,7 @@ winMWExtWMWindowProc (HWND hwnd, UINT message,
|
|||||||
|
|
||||||
if ((dwWindowProcessID == dwCurrentProcessID)
|
if ((dwWindowProcessID == dwCurrentProcessID)
|
||||||
&& GetProp (Above, WIN_WINDOW_PROP)
|
&& GetProp (Above, WIN_WINDOW_PROP)
|
||||||
&& !IsIconic (hwnd) ) /* ignore minimized windows */
|
&& !IsIconic (hWndAbove) ) /* ignore minimized windows */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* If this is top of X windows in Windows stack,
|
/* If this is top of X windows in Windows stack,
|
||||||
|
Loading…
Reference in New Issue
Block a user