diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 2e07464ff..872a1fdcd 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -796,9 +796,6 @@ winUseMsg(void) "\tDo not draw a window border, title bar, etc. Windowed\n" "\tmode only.\n"); - ErrorF("-nounicodeclipboard\n" - "\tDo not use Unicode clipboard even if on a NT-based platform.\n"); - ErrorF("-[no]primary\n" "\tWhen clipboard integration is enabled, map the X11 PRIMARY selection\n" "\tto the Windows clipboard. Default is enabled.\n"); diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man index 56bea1c12..296ce4c9f 100644 --- a/hw/xwin/man/XWin.man +++ b/hw/xwin/man/XWin.man @@ -233,9 +233,6 @@ icon per screen. You can globally disable tray icons with \fB\-notrayicon\fP, then enable it for specific screens with \fB\-trayicon\fP for those screens. .TP 8 -.B \-nounicodeclipboard -Do not use Unicode clipboard even if on a NT-based platform. -.TP 8 .B \-[no]unixkill Enable or disable the \fICtrl-Alt-Backspace\fP key combination as a signal to exit the X Server. The \fICtrl-Alt-Backspace\fP key combination diff --git a/hw/xwin/winclipboard/internal.h b/hw/xwin/winclipboard/internal.h index 6dc2fb660..2c4a20426 100644 --- a/hw/xwin/winclipboard/internal.h +++ b/hw/xwin/winclipboard/internal.h @@ -100,7 +100,6 @@ typedef struct typedef struct { - Bool fUseUnicode; Atom *targetList; unsigned char *incr; unsigned long int incrsize; diff --git a/hw/xwin/winclipboard/thread.c b/hw/xwin/winclipboard/thread.c index 5669a2626..8949e7235 100644 --- a/hw/xwin/winclipboard/thread.c +++ b/hw/xwin/winclipboard/thread.c @@ -104,7 +104,7 @@ static int */ Bool -winClipboardProc(Bool fUseUnicode, char *szDisplay) +winClipboardProc(char *szDisplay) { ClipboardAtoms atoms; int iReturn; @@ -256,7 +256,6 @@ winClipboardProc(Bool fUseUnicode, char *szDisplay) } } - data.fUseUnicode = fUseUnicode; data.incr = NULL; data.incrsize = 0; diff --git a/hw/xwin/winclipboard/winclipboard.h b/hw/xwin/winclipboard/winclipboard.h index 9c5c568a7..2ae27fd2b 100644 --- a/hw/xwin/winclipboard/winclipboard.h +++ b/hw/xwin/winclipboard/winclipboard.h @@ -27,7 +27,7 @@ #ifndef WINCLIPBOARD_H #define WINCLIPBOARD_H -Bool winClipboardProc(Bool fUseUnicode, char *szDisplay); +Bool winClipboardProc(char *szDisplay); void winFixClipboardChain(void); diff --git a/hw/xwin/winclipboard/wndproc.c b/hw/xwin/winclipboard/wndproc.c index b6d92f6d8..ee2266a3d 100644 --- a/hw/xwin/winclipboard/wndproc.c +++ b/hw/xwin/winclipboard/wndproc.c @@ -316,7 +316,6 @@ winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_RENDERFORMAT: { int iReturn; - Bool fConvertToUnicode; Bool pasted = FALSE; Atom selection; ClipboardConversionData data; @@ -325,9 +324,6 @@ winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) winDebug("winClipboardWindowProc - WM_RENDERFORMAT %d - Hello.\n", (int)wParam); - /* Flag whether to convert to Unicode or not */ - fConvertToUnicode = (CF_UNICODETEXT == wParam); - selection = winClipboardGetLastOwnedSelectionAtom(atoms); if (selection == None) { ErrorF("winClipboardWindowProc - no monitored selection is owned\n"); @@ -344,7 +340,6 @@ winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) iWindow, CurrentTime); /* Process X events */ - data.fUseUnicode = fConvertToUnicode; data.incr = NULL; data.incrsize = 0; diff --git a/hw/xwin/winclipboard/xevents.c b/hw/xwin/winclipboard/xevents.c index 7d55f3d92..36e136148 100644 --- a/hw/xwin/winclipboard/xevents.c +++ b/hw/xwin/winclipboard/xevents.c @@ -200,7 +200,6 @@ winClipboardSelectionNotifyData(HWND hwnd, Window iWindow, Display *pDisplay, Cl char *pszReturnData = NULL; wchar_t *pwszUnicodeStr = NULL; HGLOBAL hGlobal = NULL; - char *pszConvertData = NULL; char *pszGlobalData = NULL; /* Retrieve the selection data and delete the property */ @@ -268,19 +267,13 @@ winClipboardSelectionNotifyData(HWND hwnd, Window iWindow, Display *pDisplay, Cl xtpText.nitems = nitems; } - if (data->fUseUnicode) { #ifdef X_HAVE_UTF8_STRING - /* Convert the text property to a text list */ - iReturn = Xutf8TextPropertyToTextList(pDisplay, - &xtpText, - &ppszTextList, &iCount); + /* Convert the text property to a text list */ + iReturn = Xutf8TextPropertyToTextList(pDisplay, + &xtpText, + &ppszTextList, &iCount); #endif - } - else { - iReturn = XmbTextPropertyToTextList(pDisplay, - &xtpText, - &ppszTextList, &iCount); - } + if (iReturn == Success || iReturn > 0) { /* Conversion succeeded or some unconvertible characters */ if (ppszTextList != NULL) { @@ -343,40 +336,30 @@ winClipboardSelectionNotifyData(HWND hwnd, Window iWindow, Display *pDisplay, Cl /* Convert the X clipboard string to DOS format */ winClipboardUNIXtoDOS(&pszReturnData, strlen(pszReturnData)); - if (data->fUseUnicode) { - /* Find out how much space needed to convert MBCS to Unicode */ - int iUnicodeLen = MultiByteToWideChar(CP_UTF8, - 0, - pszReturnData, -1, NULL, 0); + /* Find out how much space needed to convert MBCS to Unicode */ + int iUnicodeLen = MultiByteToWideChar(CP_UTF8, + 0, + pszReturnData, -1, NULL, 0); - /* NOTE: iUnicodeLen includes space for null terminator */ - pwszUnicodeStr = malloc(sizeof(wchar_t) * iUnicodeLen); - if (!pwszUnicodeStr) { - ErrorF("winClipboardFlushXEvents - SelectionNotify " - "malloc failed for pwszUnicodeStr, aborting.\n"); + /* NOTE: iUnicodeLen includes space for null terminator */ + pwszUnicodeStr = malloc(sizeof(wchar_t) * iUnicodeLen); + if (!pwszUnicodeStr) { + ErrorF("winClipboardFlushXEvents - SelectionNotify " + "malloc failed for pwszUnicodeStr, aborting.\n"); - /* Abort */ - goto winClipboardFlushXEvents_SelectionNotify_Done; - } - - /* Do the actual conversion */ - MultiByteToWideChar(CP_UTF8, - 0, - pszReturnData, - -1, pwszUnicodeStr, iUnicodeLen); - - /* Allocate global memory for the X clipboard data */ - hGlobal = GlobalAlloc(GMEM_MOVEABLE, - sizeof(wchar_t) * iUnicodeLen); + /* Abort */ + goto winClipboardFlushXEvents_SelectionNotify_Done; } - else { - int iConvertDataLen = 0; - pszConvertData = strdup(pszReturnData); - iConvertDataLen = strlen(pszConvertData) + 1; - /* Allocate global memory for the X clipboard data */ - hGlobal = GlobalAlloc(GMEM_MOVEABLE, iConvertDataLen); - } + /* Do the actual conversion */ + MultiByteToWideChar(CP_UTF8, + 0, + pszReturnData, + -1, pwszUnicodeStr, iUnicodeLen); + + /* Allocate global memory for the X clipboard data */ + hGlobal = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t) * iUnicodeLen); + free(pszReturnData); @@ -400,26 +383,16 @@ winClipboardSelectionNotifyData(HWND hwnd, Window iWindow, Display *pDisplay, Cl } /* Copy the returned string into the global memory */ - if (data->fUseUnicode) { - wcscpy((wchar_t *)pszGlobalData, pwszUnicodeStr); - free(pwszUnicodeStr); - pwszUnicodeStr = NULL; - } - else { - strcpy(pszGlobalData, pszConvertData); - free(pszConvertData); - pszConvertData = NULL; - } + wcscpy((wchar_t *)pszGlobalData, pwszUnicodeStr); + free(pwszUnicodeStr); + pwszUnicodeStr = NULL; /* Release the pointer to the global memory */ GlobalUnlock(hGlobal); pszGlobalData = NULL; /* Push the selection data to the Windows clipboard */ - if (data->fUseUnicode) - SetClipboardData(CF_UNICODETEXT, hGlobal); - else - SetClipboardData(CF_TEXT, hGlobal); + SetClipboardData(CF_UNICODETEXT, hGlobal); /* Flag that SetClipboardData has been called */ fSetClipboardData = FALSE; @@ -438,7 +411,6 @@ winClipboardSelectionNotifyData(HWND hwnd, Window iWindow, Display *pDisplay, Cl value = NULL; nitems = 0; } - free(pszConvertData); free(pwszUnicodeStr); if (hGlobal && pszGlobalData) GlobalUnlock(hGlobal); @@ -577,7 +549,7 @@ winClipboardFlushXEvents(HWND hwnd, fCloseClipboard = TRUE; /* Check that clipboard format is available */ - if (data->fUseUnicode && !IsClipboardFormatAvailable(CF_UNICODETEXT)) { + if (!IsClipboardFormatAvailable(CF_UNICODETEXT)) { static int count; /* Hack to stop acroread spamming the log */ static HWND lasthwnd; /* I've not seen any other client get here repeatedly? */ @@ -594,14 +566,6 @@ winClipboardFlushXEvents(HWND hwnd, fAbort = TRUE; goto winClipboardFlushXEvents_SelectionRequest_Done; } - else if (!data->fUseUnicode && !IsClipboardFormatAvailable(CF_TEXT)) { - ErrorF("winClipboardFlushXEvents - CF_TEXT is not " - "available from Win32 clipboard. Aborting.\n"); - - /* Abort */ - fAbort = TRUE; - goto winClipboardFlushXEvents_SelectionRequest_Done; - } /* Setup the string style */ if (event.xselectionrequest.target == XA_STRING) @@ -616,14 +580,9 @@ winClipboardFlushXEvents(HWND hwnd, xiccesStyle = XStringStyle; /* Get a pointer to the clipboard text, in desired format */ - if (data->fUseUnicode) { - /* Retrieve clipboard data */ - hGlobal = GetClipboardData(CF_UNICODETEXT); - } - else { - /* Retrieve clipboard data */ - hGlobal = GetClipboardData(CF_TEXT); - } + /* Retrieve clipboard data */ + hGlobal = GetClipboardData(CF_UNICODETEXT); + if (!hGlobal) { ErrorF("winClipboardFlushXEvents - SelectionRequest - " "GetClipboardData () failed: %08x\n", (unsigned int)GetLastError()); @@ -635,23 +594,18 @@ winClipboardFlushXEvents(HWND hwnd, pszGlobalData = (char *) GlobalLock(hGlobal); /* Convert the Unicode string to UTF8 (MBCS) */ - if (data->fUseUnicode) { - int iConvertDataLen = WideCharToMultiByte(CP_UTF8, + int iConvertDataLen = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR) pszGlobalData, -1, NULL, 0, NULL, NULL); - /* NOTE: iConvertDataLen includes space for null terminator */ - pszConvertData = malloc(iConvertDataLen); - WideCharToMultiByte(CP_UTF8, - 0, - (LPCWSTR) pszGlobalData, - -1, - pszConvertData, - iConvertDataLen, NULL, NULL); - } - else { - pszConvertData = strdup(pszGlobalData); - } + /* NOTE: iConvertDataLen includes space for null terminator */ + pszConvertData = malloc(iConvertDataLen); + WideCharToMultiByte(CP_UTF8, + 0, + (LPCWSTR) pszGlobalData, + -1, + pszConvertData, + iConvertDataLen, NULL, NULL); /* Convert DOS string to UNIX string */ winClipboardDOStoUNIX(pszConvertData, strlen(pszConvertData)); @@ -665,18 +619,12 @@ winClipboardFlushXEvents(HWND hwnd, xtpText.nitems = 0; /* Create the text property from the text list */ - if (data->fUseUnicode) { #ifdef X_HAVE_UTF8_STRING - iReturn = Xutf8TextListToTextProperty(pDisplay, - pszTextList, - 1, xiccesStyle, &xtpText); + iReturn = Xutf8TextListToTextProperty(pDisplay, + pszTextList, + 1, xiccesStyle, &xtpText); #endif - } - else { - iReturn = XmbTextListToTextProperty(pDisplay, - pszTextList, - 1, xiccesStyle, &xtpText); - } + if (iReturn == XNoMemory || iReturn == XLocaleNotSupported) { ErrorF("winClipboardFlushXEvents - SelectionRequest - " "X*TextListToTextProperty failed: %d\n", iReturn); diff --git a/hw/xwin/winclipboard/xwinclip.c b/hw/xwin/winclipboard/xwinclip.c index 856c4dd54..6fd1c7598 100644 --- a/hw/xwin/winclipboard/xwinclip.c +++ b/hw/xwin/winclipboard/xwinclip.c @@ -67,7 +67,6 @@ main (int argc, char *argv[]) { int i; char *pszDisplay = NULL; - int fUnicodeClipboard = 1; /* Parse command-line parameters */ for (i = 1; i < argc; ++i) @@ -85,13 +84,6 @@ main (int argc, char *argv[]) continue; } - /* Look for -nounicodeclipboard */ - if (!strcmp (argv[i], "-nounicodeclipboard")) - { - fUnicodeClipboard = 0; - continue; - } - /* Look for -noprimary */ if (!strcmp (argv[i], "-noprimary")) { @@ -104,16 +96,6 @@ main (int argc, char *argv[]) exit (1); } - /* Do we have Unicode support? */ - if (fUnicodeClipboard) - { - printf ("Unicode clipboard I/O\n"); - } - else - { - printf ("Non Unicode clipboard I/O\n"); - } - /* Apply locale specified in the LANG environment variable */ if (!setlocale (LC_ALL, "")) { @@ -128,7 +110,7 @@ main (int argc, char *argv[]) setlocale(LC_ALL, "C"); } - winClipboardProc(fUnicodeClipboard, pszDisplay); + winClipboardProc(pszDisplay); return 0; } diff --git a/hw/xwin/winclipboard/xwinclip.man b/hw/xwin/winclipboard/xwinclip.man index f9e0d3bfb..e3db50177 100644 --- a/hw/xwin/winclipboard/xwinclip.man +++ b/hw/xwin/winclipboard/xwinclip.man @@ -27,9 +27,6 @@ Do \fINOT\fP run \fIxwinclip\fP unless \fIXWin(1)\fP has been started with the - .B \-display [display] Specifies the X server display to connect to. .TP 8 -.B \-nounicodeclipboard -Do not use unicode text on the clipboard. -.TP 8 .B \-noprimary Do not monitor the PRIMARY selection. diff --git a/hw/xwin/winclipboardinit.c b/hw/xwin/winclipboardinit.c index 8aef8fe02..3324661df 100644 --- a/hw/xwin/winclipboardinit.c +++ b/hw/xwin/winclipboardinit.c @@ -82,7 +82,7 @@ winClipboardThreadProc(void *arg) /* Flag that clipboard client has been launched */ g_fClipboardStarted = TRUE; - fShutdown = winClipboardProc(g_fUnicodeClipboard, szDisplay); + fShutdown = winClipboardProc(szDisplay); /* Flag that clipboard client has stopped */ g_fClipboardStarted = FALSE; diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c index 3212c6beb..29abe1970 100644 --- a/hw/xwin/winglobals.c +++ b/hw/xwin/winglobals.c @@ -90,7 +90,6 @@ winDispatchProcPtr winProcEstablishConnectionOrig = NULL; * Clipboard variables */ -Bool g_fUnicodeClipboard = TRUE; Bool g_fClipboard = TRUE; Bool g_fClipboardStarted = FALSE; diff --git a/hw/xwin/winglobals.h b/hw/xwin/winglobals.h index 77af6125a..29535f05a 100644 --- a/hw/xwin/winglobals.h +++ b/hw/xwin/winglobals.h @@ -70,7 +70,6 @@ typedef int (*winDispatchProcPtr) (ClientPtr); * Wrapped DIX functions */ extern winDispatchProcPtr winProcEstablishConnectionOrig; -extern Bool g_fUnicodeClipboard; extern Bool g_fClipboard; extern Bool g_fClipboardStarted; diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c index b5c2643be..50b1f6c38 100644 --- a/hw/xwin/winprocarg.c +++ b/hw/xwin/winprocarg.c @@ -1004,15 +1004,6 @@ ddxProcessArgument(int argc, char *argv[], int i) return 2; } - /* - * Look for the '-nounicodeclipboard' argument - */ - if (IS_OPTION("-nounicodeclipboard")) { - g_fUnicodeClipboard = FALSE; - /* Indicate that we have processed the argument */ - return 1; - } - if (IS_OPTION("-xkbrules")) { CHECK_ARGS(1); g_cmdline.xkbRules = argv[++i];