diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 2e07464ff0ce60fc89002d28fa23eb24f28aecaf..872a1fdcdd4ac121707c858dcee5239a0d2c57a5 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 56bea1c12fc3b405f0cc846260d8506d0f7f928d..296ce4c9f04c084c7785e4d37d1ad2edd09e8f2c 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 6dc2fb66022bf1f3fbd005b9908fcdef22768784..2c4a204262d21ec13194879bd1778b302ec20ec8 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 5669a2626a7b7ed48d26cfeb2f20153b24e2e674..8949e7235649f99bd90b01a056e306c78e4cba9d 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 9c5c568a78f75ff7fb3fe14e5afe3dd89270b606..2ae27fd2bd51f820a86c1fef2c0a1b8c290a8757 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 b6d92f6d81643ba7f83d8daa2f5c1b829263f7ab..ee2266a3d76bd0b7c8afd07d92e1e8e81998d3b5 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 7d55f3d9227a67506c93a517bb5cac49dba7e69d..36e13614842d492d82c05907afd502123baa33b3 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; - } + /* Abort */ + goto winClipboardFlushXEvents_SelectionNotify_Done; + } - /* Do the actual conversion */ - MultiByteToWideChar(CP_UTF8, - 0, - pszReturnData, - -1, pwszUnicodeStr, iUnicodeLen); + /* 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); - } - else { - int iConvertDataLen = 0; - pszConvertData = strdup(pszReturnData); - iConvertDataLen = strlen(pszConvertData) + 1; + /* Allocate global memory for the X clipboard data */ + hGlobal = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t) * iUnicodeLen); - /* Allocate global memory for the X clipboard data */ - hGlobal = GlobalAlloc(GMEM_MOVEABLE, iConvertDataLen); - } 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 856c4dd540912814d47374b45b2b19bfe67f88d1..6fd1c75983f365c4694b777583c2f5d0224ccfd3 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 f9e0d3bfb06b7a6149854e6ea54411b15368600f..e3db501771851d760407b7e9bd889bf342eb15d8 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 8aef8fe0235ae0374a01234ef4d76ef307a1536a..3324661dfc2924822de34dc98cd811b2bbaf1c52 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 3212c6beb16794a8abfb24892a62c0d4e74fca1c..29abe1970f0468c733bb82c545eed9b0bbb7a810 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 77af6125affcb4e28e8db530c3611ce75bc6ce64..29535f05a7f87d74c6df6ce4850e5f32214ca449 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 b5c2643befb3d1f8129edda833ce90ddb8fb713f..50b1f6c3866bbd84175becd61c1f503173ca5fb4 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];