From 797299a238c72e1add2fd56d9706346a46861e0a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 23 Sep 2019 18:50:49 +0000 Subject: Use more explicit *W()-forms of the Win32 API, instead of relying on -DUNICODE --- win/tkWinButton.c | 8 ++--- win/tkWinClipboard.c | 50 ++++++++--------------------- win/tkWinColor.c | 2 +- win/tkWinDialog.c | 62 +++++++++++++++++------------------- win/tkWinDraw.c | 2 +- win/tkWinEmbed.c | 10 +++--- win/tkWinFont.c | 38 +++++++++++----------- win/tkWinInt.h | 18 ----------- win/tkWinKey.c | 14 ++++---- win/tkWinMenu.c | 56 ++++++++++++++++---------------- win/tkWinScrlbr.c | 8 ++--- win/tkWinTest.c | 4 +-- win/tkWinWm.c | 90 ++++++++++++++++++++++++++-------------------------- win/tkWinX.c | 20 ++++++------ win/ttkWinMonitor.c | 6 ++-- 15 files changed, 172 insertions(+), 216 deletions(-) diff --git a/win/tkWinButton.c b/win/tkWinButton.c index fc5d9e2..f7b8ed2 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -242,7 +242,7 @@ CreateProc( { Window window; HWND parent; - const WCHAR *class; + LPCWSTR class; WinButton *butPtr = (WinButton *)instanceData; parent = Tk_GetHWND(parentWin); @@ -258,7 +258,7 @@ CreateProc( parent, NULL, Tk_GetHINSTANCE(), NULL); SetWindowPos(butPtr->hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); - butPtr->oldProc = (WNDPROC)SetWindowLongPtr(butPtr->hwnd, GWLP_WNDPROC, + butPtr->oldProc = (WNDPROC)SetWindowLongPtrW(butPtr->hwnd, GWLP_WNDPROC, (LONG_PTR) ButtonProc); window = Tk_AttachHWND(tkwin, butPtr->hwnd); @@ -289,7 +289,7 @@ TkpDestroyButton( HWND hwnd = winButPtr->hwnd; if (hwnd) { - SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) winButPtr->oldProc); + SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR) winButPtr->oldProc); } } @@ -1306,7 +1306,7 @@ ButtonProc( return result; } } - return DefWindowProc(hwnd, message, wParam, lParam); + return DefWindowProcW(hwnd, message, wParam, lParam); } /* diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c index 418b872..c4399ab 100644 --- a/win/tkWinClipboard.c +++ b/win/tkWinClipboard.c @@ -327,43 +327,21 @@ TkWinClipboardRender( } *buffer = '\0'; - /* - * Depending on the platform, turn the data into Unicode or the system - * encoding before placing it on the clipboard. - */ - -#ifdef UNICODE - Tcl_DStringInit(&ds); - Tcl_WinUtfToTChar(rawText, -1, &ds); - ckfree(rawText); - handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, - (unsigned) Tcl_DStringLength(&ds) + 2); - if (!handle) { - Tcl_DStringFree(&ds); - return; - } - buffer = GlobalLock(handle); - memcpy(buffer, Tcl_DStringValue(&ds), - (unsigned) Tcl_DStringLength(&ds) + 2); - GlobalUnlock(handle); + Tcl_DStringInit(&ds); + Tcl_WinUtfToTChar(rawText, -1, &ds); + ckfree(rawText); + handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, + Tcl_DStringLength(&ds) + 2); + if (!handle) { Tcl_DStringFree(&ds); - SetClipboardData(CF_UNICODETEXT, handle); -#else - Tcl_UtfToExternalDString(NULL, rawText, -1, &ds); - ckfree(rawText); - handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, - (unsigned) Tcl_DStringLength(&ds) + 1); - if (!handle) { - Tcl_DStringFree(&ds); - return; - } - buffer = GlobalLock(handle); - memcpy(buffer, Tcl_DStringValue(&ds), - (unsigned) Tcl_DStringLength(&ds) + 1); - GlobalUnlock(handle); - Tcl_DStringFree(&ds); - SetClipboardData(CF_TEXT, handle); -#endif + return; + } + buffer = GlobalLock(handle); + memcpy(buffer, Tcl_DStringValue(&ds), + Tcl_DStringLength(&ds) + 2); + GlobalUnlock(handle); + Tcl_DStringFree(&ds); + SetClipboardData(CF_UNICODETEXT, handle); } /* diff --git a/win/tkWinColor.c b/win/tkWinColor.c index ba9815c..fa3f233 100644 --- a/win/tkWinColor.c +++ b/win/tkWinColor.c @@ -347,7 +347,7 @@ XAllocColor( color->blue = closeEntry.peBlue * 257; entry = closeEntry; if (index >= cmap->size) { - OutputDebugStringA("XAllocColor: Colormap is bigger than we thought"); + OutputDebugStringW(L"XAllocColor: Colormap is bigger than we thought"); } } else { cmap->size++; diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index afee8f2..8f61428 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -40,13 +40,9 @@ #define BIF_NEWDIALOGSTYLE 0x0040 #endif -#ifndef BFFM_VALIDATEFAILED -#ifdef UNICODE -#define BFFM_VALIDATEFAILED 4 -#else -#define BFFM_VALIDATEFAILED 3 -#endif -#endif /* BFFM_VALIDATEFAILED */ +#ifndef BFFM_VALIDATEFAILEDW +#define BFFM_VALIDATEFAILEDW 4 +#endif /* BFFM_VALIDATEFAILEDW */ typedef struct { int debugFlag; /* Flags whether we should output debugging @@ -120,11 +116,11 @@ static const struct {int type; int btnIds[3];} allowedTypes[] = { */ #define TkWinGetHInstance(from) \ - ((HINSTANCE) GetWindowLongPtr((from), GWLP_HINSTANCE)) + ((HINSTANCE) GetWindowLongPtrW((from), GWLP_HINSTANCE)) #define TkWinGetUserData(from) \ - GetWindowLongPtr((from), GWLP_USERDATA) + GetWindowLongPtrW((from), GWLP_USERDATA) #define TkWinSetUserData(to,what) \ - SetWindowLongPtr((to), GWLP_USERDATA, (LPARAM)(what)) + SetWindowLongPtrW((to), GWLP_USERDATA, (LPARAM)(what)) /* * The value of TK_MULTI_MAX_PATH dictates how many files can be retrieved @@ -696,7 +692,7 @@ EatSpuriousMessageBugFix(void) DWORD nTime = GetTickCount() + 250; while (GetTickCount() < nTime) { - PeekMessage(&msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE); + PeekMessageW(&msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE); } } @@ -1409,7 +1405,7 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr, normPath = Tcl_FSGetNormalizedPath(interp, iniDirPath); /* XXX - Note on failures do not raise error, simply ignore ini dir */ if (normPath) { - const WCHAR *nativePath; + LPCWSTR nativePath; Tcl_IncrRefCount(normPath); nativePath = Tcl_FSGetNativePath(normPath); /* Points INTO normPath*/ if (nativePath) { @@ -1954,8 +1950,8 @@ OFNHookProc( buffer = ofnData->dynFileBuffer; hdlg = GetParent(hdlg); - selsize = (int) SendMessage(hdlg, CDM_GETSPEC, 0, 0); - dirsize = (int) SendMessage(hdlg, CDM_GETFOLDERPATH, 0, 0); + selsize = (int) SendMessageW(hdlg, CDM_GETSPEC, 0, 0); + dirsize = (int) SendMessageW(hdlg, CDM_GETFOLDERPATH, 0, 0); buffersize = (selsize + dirsize + 1); /* @@ -1970,10 +1966,10 @@ OFNHookProc( ofnData->dynFileBuffer = buffer; } - SendMessage(hdlg, CDM_GETFOLDERPATH, dirsize, (LPARAM) buffer); + SendMessageW(hdlg, CDM_GETFOLDERPATH, dirsize, (LPARAM) buffer); buffer += dirsize; - SendMessage(hdlg, CDM_GETSPEC, selsize, (LPARAM) buffer); + SendMessageW(hdlg, CDM_GETSPEC, selsize, (LPARAM) buffer); /* * If there are multiple files, delete the quotes and change @@ -2012,7 +2008,7 @@ OFNHookProc( Tcl_GetPathType(Tcl_DStringValue(&tmpfile))) { /* re-get the full path to the start of the buffer */ buffer = (WCHAR *) ofnData->dynFileBuffer; - SendMessage(hdlg, CDM_GETSPEC, selsize, (LPARAM) buffer); + SendMessageW(hdlg, CDM_GETSPEC, selsize, (LPARAM) buffer); } else { *(buffer-1) = '\\'; } @@ -2463,7 +2459,7 @@ Tk_ChooseDirectoryObjCmd( utfDir = Tcl_DStringValue(&ofnOpts.utfDirString); if (utfDir[0] != '\0') { - const WCHAR *uniStr; + LPCWSTR uniStr; Tcl_WinUtfToTChar(Tcl_DStringValue(&ofnOpts.utfDirString), -1, &tempString); @@ -2497,8 +2493,8 @@ Tk_ChooseDirectoryObjCmd( bInfo.lParam = (LPARAM) &cdCBData; if (ofnOpts.titleObj != NULL) { - Tcl_WinUtfToTChar(Tcl_GetString(ofnOpts.titleObj), -1, &titleString); - bInfo.lpszTitle = (LPWSTR) Tcl_DStringValue(&titleString); + bInfo.lpszTitle = (LPCWSTR) Tcl_WinUtfToTChar( + Tcl_GetString(ofnOpts.titleObj), -1, &titleString); } else { bInfo.lpszTitle = L"Please choose a directory, then select OK."; } @@ -2631,7 +2627,7 @@ ChooseDirectoryValidateProc( } chooseDirSharedData->retDir[0] = '\0'; switch (message) { - case BFFM_VALIDATEFAILED: + case BFFM_VALIDATEFAILEDW: /* * First save and check to see if it is a valid path name, if so then * make that path the one shown in the window. Otherwise, it failed @@ -2703,12 +2699,12 @@ ChooseDirectoryValidateProc( */ if (SHGetPathFromIDListW((LPITEMIDLIST) lParam, selDir)) { - SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM) selDir); + SendMessageW(hwnd, BFFM_SETSTATUSTEXTW, 0, (LPARAM) selDir); // enable the OK button - SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1); + SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1); } else { // disable the OK button - SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0); + SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0); } UpdateWindow(hwnd); return 1; @@ -2725,7 +2721,7 @@ ChooseDirectoryValidateProc( if (*initDir == '\\') { /* - * BFFM_SETSELECTION only understands UNC paths as pidls, so + * BFFM_SETSELECTIONW only understands UNC paths as pidls, so * convert path to pidl using IShellFolder interface. */ @@ -2741,7 +2737,7 @@ ChooseDirectoryValidateProc( psfFolder, hwnd, NULL, (WCHAR *) initDir, &ulCount,&pidlMain,&ulAttr)) && (pidlMain != NULL)) { - SendMessage(hwnd, BFFM_SETSELECTION, FALSE, + SendMessageW(hwnd, BFFM_SETSELECTIONW, FALSE, (LPARAM) pidlMain); pMalloc->lpVtbl->Free(pMalloc, pidlMain); } @@ -2750,9 +2746,9 @@ ChooseDirectoryValidateProc( pMalloc->lpVtbl->Release(pMalloc); } } else { - SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM) initDir); + SendMessageW(hwnd, BFFM_SETSELECTIONW, TRUE, (LPARAM) initDir); } - SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1); + SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1); break; } @@ -2802,7 +2798,7 @@ Tk_MessageBoxObjCmd( ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_DString titleBuf, tmpBuf; - const WCHAR *titlePtr, *tmpPtr; + LPCWSTR titlePtr, tmpPtr; const char *src; defaultBtn = -1; @@ -2930,7 +2926,7 @@ Tk_MessageBoxObjCmd( tsdPtr->hSmallIcon = TkWinGetIcon(parent, ICON_SMALL); tsdPtr->hBigIcon = TkWinGetIcon(parent, ICON_BIG); - tsdPtr->hMsgBoxHook = SetWindowsHookEx(WH_CBT, MsgBoxCBTProc, NULL, + tsdPtr->hMsgBoxHook = SetWindowsHookExW(WH_CBT, MsgBoxCBTProc, NULL, GetCurrentThreadId()); src = Tcl_GetString(tmpObj); tmpPtr = Tcl_WinUtfToTChar(src, tmpObj->length, &tmpBuf); @@ -2984,9 +2980,9 @@ MsgBoxCBTProc( if (WC_DIALOG == lpcbtcreate->lpcs->lpszClass) { HWND hwnd = (HWND) wParam; - SendMessage(hwnd, WM_SETICON, ICON_SMALL, + SendMessageW(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) tsdPtr->hSmallIcon); - SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) tsdPtr->hBigIcon); + SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM) tsdPtr->hBigIcon); } } @@ -3194,7 +3190,7 @@ HookProc( LOGFONTW lf = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0}}; HDC hdc = GetDC(hwndDlg); - SendMessage(hwndDlg, WM_CHOOSEFONT_GETLOGFONT, 0, (LPARAM) &lf); + SendMessageW(hwndDlg, WM_CHOOSEFONT_GETLOGFONT, 0, (LPARAM) &lf); if (phd && phd->cmdObj) { ApplyLogfont(phd->interp, phd->cmdObj, hdc, &lf); } diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c index 4341424..042d1b1 100644 --- a/win/tkWinDraw.c +++ b/win/tkWinDraw.c @@ -1448,7 +1448,7 @@ TkWinFillRect( rect.bottom = y + height; oldColor = SetBkColor(dc, (COLORREF)pixel); SetBkMode(dc, OPAQUE); - ExtTextOut(dc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL); + ExtTextOutW(dc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL); SetBkColor(dc, oldColor); } diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c index ec2a2c3..1c6ba6c 100644 --- a/win/tkWinEmbed.c +++ b/win/tkWinEmbed.c @@ -160,7 +160,7 @@ void Tk_MapEmbeddedWindow( { if(!(winPtr->flags & TK_ALREADY_DEAD)) { HWND hwnd = (HWND)winPtr->privatePtr; - int state = SendMessage(hwnd, TK_STATE, -1, -1) - 1; + int state = SendMessageW(hwnd, TK_STATE, -1, -1) - 1; if (state < 0 || state > 3) { state = NormalState; @@ -283,9 +283,9 @@ TkpUseWindow( return TCL_ERROR; } - id = SendMessage(hwnd, TK_INFO, TK_CONTAINER_VERIFY, 0); + id = SendMessageW(hwnd, TK_INFO, TK_CONTAINER_VERIFY, 0); if (id == PTR2INT(hwnd)) { - if (!SendMessage(hwnd, TK_INFO, TK_CONTAINER_ISAVAILABLE, 0)) { + if (!SendMessageW(hwnd, TK_INFO, TK_CONTAINER_ISAVAILABLE, 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "The container is already in use", -1)); Tcl_SetErrorCode(interp, "TK", "EMBED", "IN_USE", NULL); @@ -1018,7 +1018,7 @@ TkpClaimFocus( * it. */ { HWND hwnd = GetParent(Tk_GetHWND(topLevelPtr->window)); - SendMessage(hwnd, TK_CLAIMFOCUS, (WPARAM) force, 0); + SendMessageW(hwnd, TK_CLAIMFOCUS, (WPARAM) force, 0); } /* @@ -1096,7 +1096,7 @@ EmbedWindowDeleted( break; } if (containerPtr->parentPtr == winPtr) { - SendMessage(containerPtr->embeddedHWnd, WM_CLOSE, 0, 0); + SendMessageW(containerPtr->embeddedHWnd, WM_CLOSE, 0, 0); containerPtr->parentPtr = NULL; containerPtr->embeddedPtr = NULL; break; diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 85a0131..bcac5c5 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -406,7 +406,7 @@ TkWinSetupSystemFonts( ZeroMemory(&ncMetrics, sizeof(ncMetrics)); ncMetrics.cbSize = sizeof(ncMetrics); - if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, + if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncMetrics), &ncMetrics, 0)) { CreateNamedSystemLogFont(interp, tkwin, "TkDefaultFont", &ncMetrics.lfMessageFont); @@ -425,7 +425,7 @@ TkWinSetupSystemFonts( } iconMetrics.cbSize = sizeof(iconMetrics); - if (SystemParametersInfo(SPI_GETICONMETRICS, sizeof(iconMetrics), + if (SystemParametersInfoW(SPI_GETICONMETRICS, sizeof(iconMetrics), &iconMetrics, 0)) { CreateNamedSystemLogFont(interp, tkwin, "TkIconFont", &iconMetrics.lfFont); @@ -743,14 +743,14 @@ TkpGetFontAttrsForChar( * character */ FontFamily *familyPtr = thisSubFontPtr->familyPtr; HFONT oldfont; /* Saved font from the device context */ - TEXTMETRIC tm; /* Font metrics of the selected subfont */ + TEXTMETRICW tm; /* Font metrics of the selected subfont */ /* * Get the font attributes. */ oldfont = SelectObject(hdc, thisSubFontPtr->hFont0); - GetTextMetrics(hdc, &tm); + GetTextMetricsW(hdc, &tm); SelectObject(hdc, oldfont); ReleaseDC(fontPtr->hwnd, hdc); faPtr->family = familyPtr->faceName; @@ -1101,7 +1101,7 @@ Tk_DrawChars( HBRUSH oldBrush, stipple; HBITMAP oldBitmap, bitmap; HDC dcMem; - TEXTMETRIC tm; + TEXTMETRICW tm; SIZE size; if (twdPtr->type != TWD_BITMAP) { @@ -1128,7 +1128,7 @@ Tk_DrawChars( */ GetTextExtentPointA(dcMem, source, numBytes, &size); - GetTextMetrics(dcMem, &tm); + GetTextMetricsW(dcMem, &tm); size.cx -= tm.tmOverhang; bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy); oldBitmap = SelectObject(dcMem, bitmap); @@ -1167,7 +1167,7 @@ Tk_DrawChars( } else { HBITMAP oldBitmap, bitmap; HDC dcMem; - TEXTMETRIC tm; + TEXTMETRICW tm; SIZE size; dcMem = CreateCompatibleDC(dc); @@ -1182,7 +1182,7 @@ Tk_DrawChars( */ GetTextExtentPointA(dcMem, source, numBytes, &size); - GetTextMetrics(dcMem, &tm); + GetTextMetricsW(dcMem, &tm); size.cx -= tm.tmOverhang; bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy); oldBitmap = SelectObject(dcMem, bitmap); @@ -1249,7 +1249,7 @@ TkDrawAngledChars( HBRUSH oldBrush, stipple; HBITMAP oldBitmap, bitmap; HDC dcMem; - TEXTMETRIC tm; + TEXTMETRICW tm; SIZE size; if (twdPtr->type != TWD_BITMAP) { @@ -1276,7 +1276,7 @@ TkDrawAngledChars( */ GetTextExtentPointA(dcMem, source, numBytes, &size); - GetTextMetrics(dcMem, &tm); + GetTextMetricsW(dcMem, &tm); size.cx -= tm.tmOverhang; bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy); oldBitmap = SelectObject(dcMem, bitmap); @@ -1315,7 +1315,7 @@ TkDrawAngledChars( } else { HBITMAP oldBitmap, bitmap; HDC dcMem; - TEXTMETRIC tm; + TEXTMETRICW tm; SIZE size; dcMem = CreateCompatibleDC(dc); @@ -1330,7 +1330,7 @@ TkDrawAngledChars( */ GetTextExtentPointA(dcMem, source, numBytes, &size); - GetTextMetrics(dcMem, &tm); + GetTextMetricsW(dcMem, &tm); size.cx -= tm.tmOverhang; bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy); oldBitmap = SelectObject(dcMem, bitmap); @@ -1437,11 +1437,11 @@ MultiFontTextOut( Tcl_DString runString; const char *p, *end, *next; SubFont *lastSubFontPtr, *thisSubFontPtr; - TEXTMETRIC tm; + TEXTMETRICW tm; lastSubFontPtr = &fontPtr->subFontArray[0]; oldFont = SelectFont(hdc, fontPtr, lastSubFontPtr, angle); - GetTextMetrics(hdc, &tm); + GetTextMetricsW(hdc, &tm); end = source + numBytes; for (p = source; p < end; ) { @@ -1473,7 +1473,7 @@ MultiFontTextOut( lastSubFontPtr = thisSubFontPtr; source = p; SelectFont(hdc, fontPtr, lastSubFontPtr, angle); - GetTextMetrics(hdc, &tm); + GetTextMetricsW(hdc, &tm); } p = next; } @@ -1543,7 +1543,7 @@ InitFont( HFONT hFont, /* Windows token for font. */ int overstrike, /* The overstrike attribute of logfont used to * allocate this font. For some reason, the - * TEXTMETRICs may contain incorrect info in + * TEXTMETRICWs may contain incorrect info in * the tmStruckOut field. */ WinFont *fontPtr) /* Filled with information constructed from * the above arguments. */ @@ -1551,7 +1551,7 @@ InitFont( HDC hdc; HWND hwnd; HFONT oldFont; - TEXTMETRIC tm; + TEXTMETRICW tm; Window window; TkFontMetrics *fmPtr; Tcl_Encoding encoding; @@ -1564,7 +1564,7 @@ InitFont( hdc = GetDC(hwnd); oldFont = SelectObject(hdc, hFont); - GetTextMetrics(hdc, &tm); + GetTextMetricsW(hdc, &tm); GetTextFaceW(hdc, LF_FACESIZE, buf); Tcl_WinTCharToUtf(buf, -1, &faceString); @@ -1596,7 +1596,7 @@ InitFont( encoding = fontPtr->subFontArray[0].familyPtr->encoding; if (encoding == TkWinGetUnicodeEncoding()) { - GetCharWidth(hdc, 0, BASE_CHARS - 1, fontPtr->widths); + GetCharWidthW(hdc, 0, BASE_CHARS - 1, fontPtr->widths); } else { GetCharWidthA(hdc, 0, BASE_CHARS - 1, fontPtr->widths); } diff --git a/win/tkWinInt.h b/win/tkWinInt.h index 08c695f..ef4f1bd 100644 --- a/win/tkWinInt.h +++ b/win/tkWinInt.h @@ -219,17 +219,8 @@ MODULE_SCOPE Tcl_Obj * TkWin32ErrorObj(HRESULT hrError); */ #ifndef GetClassLongPtr -# define GetClassLongPtrA GetClassLongA # define GetClassLongPtrW GetClassLongW -# define SetClassLongPtrA SetClassLongA # define SetClassLongPtrW SetClassLongW -# ifdef UNICODE -# define GetClassLongPtr GetClassLongPtrW -# define SetClassLongPtr SetClassLongPtrW -# else -# define GetClassLongPtr GetClassLongPtrA -# define SetClassLongPtr SetClassLongPtrA -# endif /* !UNICODE */ #endif /* !GetClassLongPtr */ #ifndef GCLP_HICON # define GCLP_HICON GCL_HICON @@ -239,17 +230,8 @@ MODULE_SCOPE Tcl_Obj * TkWin32ErrorObj(HRESULT hrError); #endif /* !GCLP_HICONSM */ #ifndef GetWindowLongPtr -# define GetWindowLongPtrA GetWindowLongA # define GetWindowLongPtrW GetWindowLongW -# define SetWindowLongPtrA SetWindowLongA # define SetWindowLongPtrW SetWindowLongW -# ifdef UNICODE -# define GetWindowLongPtr GetWindowLongPtrW -# define SetWindowLongPtr SetWindowLongPtrW -# else -# define GetWindowLongPtr GetWindowLongPtrW -# define SetWindowLongPtr SetWindowLongPtrW -# endif /* !UNICODE */ #endif /* !GetWindowLongPtr */ #ifndef GWLP_WNDPROC #define GWLP_WNDPROC GWL_WNDPROC diff --git a/win/tkWinKey.c b/win/tkWinKey.c index c1f9891..234a158 100644 --- a/win/tkWinKey.c +++ b/win/tkWinKey.c @@ -187,7 +187,7 @@ KeycodeToKeysym( BYTE keys[256]; int result, deadkey, shift; WCHAR buf[4]; - unsigned int scancode = MapVirtualKey(keycode, 0); + unsigned int scancode = MapVirtualKeyW(keycode, 0); /* * Do not run keycodes of lock keys through ToUnicode(). One of ToUnicode()'s @@ -201,10 +201,10 @@ KeycodeToKeysym( } /* - * Use MapVirtualKey() to detect some dead keys. + * Use MapVirtualKeyW() to detect some dead keys. */ - if (MapVirtualKey(keycode, 2) > 0x7fffUL) { + if (MapVirtualKeyW(keycode, 2) > 0x7fffUL) { return XK_Multi_key; } @@ -261,10 +261,10 @@ KeycodeToKeysym( * Get information about the old char */ - deadkey = VkKeyScan(buf[0]); + deadkey = VkKeyScanW(buf[0]); shift = deadkey >> 8; deadkey &= 255; - scancode = MapVirtualKey(deadkey, 0); + scancode = MapVirtualKeyW(deadkey, 0); /* * Set up a keyboard with proper modifier keys @@ -572,7 +572,7 @@ TkpSetKeycodeAndState( } } if (keySym >= 0x20) { - result = VkKeyScan((WCHAR) keySym); + result = VkKeyScanW((WCHAR) keySym); if (result != -1) { shift = result >> 8; if (shift & 1) @@ -625,7 +625,7 @@ XKeysymToKeycode( } } if (keysym >= 0x20) { - result = VkKeyScan((WCHAR) keysym); + result = VkKeyScanW((WCHAR) keysym); if (result != -1) { return (KeyCode) (result & 0xff); } diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index f93c052..0d25ca9 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -573,7 +573,7 @@ ReconfigureWindowsMenu( TkMenuEntry *mePtr; HMENU winMenuHdl = (HMENU) menuPtr->platformData; char *itemText = NULL; - const WCHAR *lpNewItem; + LPCWSTR lpNewItem; UINT flags; UINT itemID; int i, count, systemMenu = 0, base; @@ -610,7 +610,7 @@ ReconfigureWindowsMenu( if ((menuPtr->menuType == MENUBAR) || (menuPtr->menuFlags & MENU_SYSTEM_MENU)) { Tcl_WinUtfToTChar(itemText, -1, &translatedText); - lpNewItem = (const WCHAR *) Tcl_DStringValue(&translatedText); + lpNewItem = (LPCWSTR) Tcl_DStringValue(&translatedText); flags |= MF_STRING; } else { lpNewItem = (LPCWSTR) mePtr; @@ -1003,7 +1003,7 @@ TkWinMenuProc( LRESULT lResult; if (!TkWinHandleMenuEvent(&hwnd, &message, &wParam, &lParam, &lResult)) { - lResult = DefWindowProc(hwnd, message, wParam, lParam); + lResult = DefWindowProcW(hwnd, message, wParam, lParam); } return lResult; } @@ -1102,7 +1102,7 @@ TkWinEmbeddedMenuProc( } /* FALLTHRU */ default: - lResult = DefWindowProc(hwnd, message, wParam, lParam); + lResult = DefWindowProcW(hwnd, message, wParam, lParam); break; } return lResult; @@ -1746,7 +1746,7 @@ DrawWindowsSystemBitmap( SetTextColor(hdc, gc->foreground); scratchDC = CreateCompatibleDC(hdc); - bitmap = LoadBitmap(NULL, MAKEINTRESOURCE(bitmapID)); + bitmap = LoadBitmapW(NULL, (LPCWSTR)MAKEINTRESOURCE(bitmapID)); SelectObject(scratchDC, bitmap); SetMapMode(scratchDC, GetMapMode(hdc)); @@ -2099,7 +2099,7 @@ DrawMenuUnderline( * * This function is invoked when keys related to pulling down menus is * pressed. The corresponding Windows events are generated and passed to - * DefWindowProc if appropriate. This cmd is registered as tk::WinMenuKey + * DefWindowProcW if appropriate. This cmd is registered as tk::WinMenuKey * in the interp. * * Results: @@ -2154,33 +2154,33 @@ TkWinMenuKeyObjCmd( if (eventPtr->type == KeyPress) { switch (keySym) { case XK_Alt_L: - scanCode = MapVirtualKey(VK_LMENU, 0); - CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), + scanCode = MapVirtualKeyW(VK_LMENU, 0); + CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYDOWN, VK_MENU, (int) (scanCode << 16) | (1 << 29)); break; case XK_Alt_R: - scanCode = MapVirtualKey(VK_RMENU, 0); - CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), + scanCode = MapVirtualKeyW(VK_RMENU, 0); + CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYDOWN, VK_MENU, (int) (scanCode << 16) | (1 << 29) | (1 << 24)); break; case XK_F10: - scanCode = MapVirtualKey(VK_F10, 0); - CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), + scanCode = MapVirtualKeyW(VK_F10, 0); + CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYDOWN, VK_F10, (int) (scanCode << 16)); break; default: virtualKey = XKeysymToKeycode(winPtr->display, keySym); - scanCode = MapVirtualKey(virtualKey, 0); + scanCode = MapVirtualKeyW(virtualKey, 0); if (0 != scanCode) { XKeyEvent xkey = eventPtr->xkey; - CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), + CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYDOWN, virtualKey, (int) ((scanCode << 16) | (1 << 29))); if (xkey.nbytes > 0) { for (i = 0; i < xkey.nbytes; i++) { - CallWindowProc(DefWindowProc, + CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSCHAR, xkey.trans_chars[i], (int) ((scanCode << 16) | (1 << 29))); @@ -2191,28 +2191,28 @@ TkWinMenuKeyObjCmd( } else if (eventPtr->type == KeyRelease) { switch (keySym) { case XK_Alt_L: - scanCode = MapVirtualKey(VK_LMENU, 0); - CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), + scanCode = MapVirtualKeyW(VK_LMENU, 0); + CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16) | (1 << 29) | (1 << 30) | (1 << 31)); break; case XK_Alt_R: - scanCode = MapVirtualKey(VK_RMENU, 0); - CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), + scanCode = MapVirtualKeyW(VK_RMENU, 0); + CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16) | (1 << 24) | (1 << 29) | (1 << 30) | (1 << 31)); break; case XK_F10: - scanCode = MapVirtualKey(VK_F10, 0); - CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), + scanCode = MapVirtualKeyW(VK_F10, 0); + CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYUP, VK_F10, (int) (scanCode << 16) | (1 << 30) | (1 << 31)); break; default: virtualKey = XKeysymToKeycode(winPtr->display, keySym); - scanCode = MapVirtualKey(virtualKey, 0); + scanCode = MapVirtualKeyW(virtualKey, 0); if (0 != scanCode) { - CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), + CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYUP, virtualKey, (int) ((scanCode << 16) | (1 << 29) | (1 << 30) | (1 << 31))); } @@ -3314,7 +3314,7 @@ SetDefaults( HDC scratchDC; int bold = 0; int italic = 0; - TEXTMETRIC tm; + TEXTMETRICW tm; int pointSize; HFONT menuFont; /* See: [Bug #3239768] tk8.4.19 (and later) WIN32 menu font support */ @@ -3336,7 +3336,7 @@ SetDefaults( defaultBorderWidth = GetSystemMetrics(SM_CYBORDER); } - scratchDC = CreateDCA("DISPLAY", NULL, NULL, NULL); + scratchDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL); if (!firstTime) { Tcl_DStringFree(&menuFontDString); } @@ -3350,11 +3350,11 @@ SetDefaults( nc.metrics.cbSize -= sizeof(int); } - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, nc.metrics.cbSize, + SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, nc.metrics.cbSize, &nc.metrics, 0); menuFont = CreateFontIndirectW(&nc.metrics.lfMenuFont); SelectObject(scratchDC, menuFont); - GetTextMetrics(scratchDC, &tm); + GetTextMetricsW(scratchDC, &tm); GetTextFaceA(scratchDC, LF_FACESIZE, faceName); pointSize = MulDiv(tm.tmHeight - tm.tmInternalLeading, 72, GetDeviceCaps(scratchDC, LOGPIXELSY)); @@ -3411,7 +3411,7 @@ SetDefaults( */ showMenuAccelerators = TRUE; - SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &showMenuAccelerators, 0); + SystemParametersInfoW(SPI_GETKEYBOARDCUES, 0, &showMenuAccelerators, 0); } /* diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index 39aeb3b..a633dc2 100644 --- a/win/tkWinScrlbr.c +++ b/win/tkWinScrlbr.c @@ -245,7 +245,7 @@ CreateProc( } scrollPtr->lastVertical = scrollPtr->info.vertical; - scrollPtr->oldProc = (WNDPROC)SetWindowLongPtr(scrollPtr->hwnd, + scrollPtr->oldProc = (WNDPROC)SetWindowLongPtrW(scrollPtr->hwnd, GWLP_WNDPROC, (LONG_PTR) ScrollbarProc); window = Tk_AttachHWND(tkwin, scrollPtr->hwnd); @@ -291,7 +291,7 @@ TkpDisplayScrollbar( if (scrollPtr->lastVertical != scrollPtr->info.vertical) { HWND hwnd = Tk_GetHWND(Tk_WindowId(tkwin)); - SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) scrollPtr->oldProc); + SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR) scrollPtr->oldProc); DestroyWindow(hwnd); CreateProc(tkwin, Tk_WindowId(Tk_Parent(tkwin)), @@ -325,7 +325,7 @@ TkpDestroyScrollbar( HWND hwnd = winScrollPtr->hwnd; if (hwnd) { - SetWindowLongPtr(hwnd, GWLP_WNDPROC, (INT_PTR) winScrollPtr->oldProc); + SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (INT_PTR) winScrollPtr->oldProc); if (winScrollPtr->winFlags & IN_MODAL_LOOP) { ((TkWindow *)scrollPtr->tkwin)->flags |= TK_DONT_DESTROY_WINDOW; SetParent(hwnd, NULL); @@ -568,7 +568,7 @@ ScrollbarProc( return result; } } - return CallWindowProc(scrollPtr->oldProc, hwnd, message, wParam, lParam); + return CallWindowProcW(scrollPtr->oldProc, hwnd, message, wParam, lParam); } /* diff --git a/win/tkWinTest.c b/win/tkWinTest.c index 2ea535d..ddda29b 100644 --- a/win/tkWinTest.c +++ b/win/tkWinTest.c @@ -432,7 +432,7 @@ TestfindwindowObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { - const WCHAR *title = NULL, *class = NULL; + LPCWSTR title = NULL, class = NULL; Tcl_DString titleString, classString; HWND hwnd = NULL; int r = TCL_OK; @@ -534,7 +534,7 @@ TestgetwindowinfoObjCmd( Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2), Tcl_NewLongObj(GetWindowLongA(INT2PTR(hwnd), GWL_ID))); - cch = GetWindowTextW(INT2PTR(hwnd), (LPWSTR)buf, cchBuf); + cch = GetWindowTextW(INT2PTR(hwnd), buf, cchBuf); Tcl_WinTCharToUtf(buf, cch * sizeof (WCHAR), &ds); textObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 167b8ea..8b3e449 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -1013,15 +1013,15 @@ WinSetIcon( /* * Don't check return result of SetClassLong() or - * SetClassLongPtr() since they return the previously set value + * SetClassLongPtrW() since they return the previously set value * which is zero on the initial call or in an error case. The MSDN * documentation does not indicate that the result needs to be * checked. */ - SetClassLongPtr(hwnd, GCLP_HICONSM, + SetClassLongPtrW(hwnd, GCLP_HICONSM, (LPARAM) GetIcon(titlebaricon, ICON_SMALL)); - SetClassLongPtr(hwnd, GCLP_HICON, + SetClassLongPtrW(hwnd, GCLP_HICON, (LPARAM) GetIcon(titlebaricon, ICON_BIG)); tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -1066,9 +1066,9 @@ WinSetIcon( return TCL_ERROR; } } - SendMessage(hwnd, WM_SETICON, ICON_SMALL, + SendMessageW(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) GetIcon(titlebaricon, ICON_SMALL)); - SendMessage(hwnd, WM_SETICON, ICON_BIG, + SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM) GetIcon(titlebaricon, ICON_BIG)); /* @@ -1157,10 +1157,10 @@ TkWinGetIcon( * the window class. */ - icon = (HICON) SendMessage(wmPtr->wrapper, WM_GETICON, iconsize, + icon = (HICON) SendMessageW(wmPtr->wrapper, WM_GETICON, iconsize, (LPARAM) NULL); if (icon == (HICON) NULL) { - icon = (HICON) GetClassLongPtr(wmPtr->wrapper, + icon = (HICON) GetClassLongPtrW(wmPtr->wrapper, (iconsize == ICON_BIG) ? GCLP_HICON : GCLP_HICONSM); } return icon; @@ -1744,7 +1744,7 @@ GetTopLevel( if (tsdPtr->createWindow) { return tsdPtr->createWindow; } - return (TkWindow *) GetWindowLongPtr(hwnd, GWLP_USERDATA); + return (TkWindow *) GetWindowLongPtrW(hwnd, GWLP_USERDATA); } /* @@ -2130,7 +2130,7 @@ UpdateWrapper( wmPtr->style, x, y, width, height, parentHWND, NULL, Tk_GetHINSTANCE(), NULL); Tcl_DStringFree(&titleString); - SetWindowLongPtr(wmPtr->wrapper, GWLP_USERDATA, (LONG_PTR) winPtr); + SetWindowLongPtrW(wmPtr->wrapper, GWLP_USERDATA, (LONG_PTR) winPtr); tsdPtr->createWindow = NULL; if (wmPtr->exStyleConfig & WS_EX_LAYERED) { @@ -2181,24 +2181,24 @@ UpdateWrapper( * doesn't try to set the focus to the child window. */ - SetWindowLongPtr(child, GWL_STYLE, + SetWindowLongPtrW(child, GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); if (winPtr->flags & TK_EMBEDDED) { - SetWindowLongPtr(child, GWLP_WNDPROC, (LONG_PTR) TopLevelProc); + SetWindowLongPtrW(child, GWLP_WNDPROC, (LONG_PTR) TopLevelProc); } SetParent(child, wmPtr->wrapper); if (oldWrapper) { hSmallIcon = (HICON) - SendMessage(oldWrapper, WM_GETICON, ICON_SMALL, (LPARAM)NULL); + SendMessageW(oldWrapper, WM_GETICON, ICON_SMALL, (LPARAM)NULL); hBigIcon = (HICON) - SendMessage(oldWrapper, WM_GETICON, ICON_BIG, (LPARAM) NULL); + SendMessageW(oldWrapper, WM_GETICON, ICON_BIG, (LPARAM) NULL); } if (oldWrapper && (oldWrapper != wmPtr->wrapper) && (oldWrapper != GetDesktopWindow())) { - SetWindowLongPtr(oldWrapper, GWLP_USERDATA, (LONG_PTR) 0); + SetWindowLongPtrW(oldWrapper, GWLP_USERDATA, (LONG_PTR) 0); if (wmPtr->numTransients > 0) { /* @@ -2231,11 +2231,11 @@ UpdateWrapper( wmPtr->flags &= ~WM_NEVER_MAPPED; if (winPtr->flags & TK_EMBEDDED && - SendMessage(wmPtr->wrapper, TK_ATTACHWINDOW, (WPARAM) child, 0)) { - SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, + SendMessageW(wmPtr->wrapper, TK_ATTACHWINDOW, (WPARAM) child, 0)) { + SendMessageW(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth((Tk_Window) winPtr), Tk_ReqHeight((Tk_Window) winPtr)); - SendMessage(wmPtr->wrapper, TK_SETMENU, (WPARAM) wmPtr->hMenu, + SendMessageW(wmPtr->wrapper, TK_SETMENU, (WPARAM) wmPtr->hMenu, (LPARAM) Tk_GetMenuHWND((Tk_Window) winPtr)); } @@ -2255,11 +2255,11 @@ UpdateWrapper( wmPtr->hints.initial_state = state; if (hSmallIcon != NULL) { - SendMessage(wmPtr->wrapper, WM_SETICON, ICON_SMALL, + SendMessageW(wmPtr->wrapper, WM_SETICON, ICON_SMALL, (LPARAM) hSmallIcon); } if (hBigIcon != NULL) { - SendMessage(wmPtr->wrapper, WM_SETICON, ICON_BIG, (LPARAM) hBigIcon); + SendMessageW(wmPtr->wrapper, WM_SETICON, ICON_BIG, (LPARAM) hBigIcon); } /* @@ -2271,7 +2271,7 @@ UpdateWrapper( */ if (winPtr->flags & TK_EMBEDDED) { - if (state+1 != SendMessage(wmPtr->wrapper, TK_STATE, state, 0)) { + if (state+1 != SendMessageW(wmPtr->wrapper, TK_STATE, state, 0)) { TkpWmSetState(winPtr, NormalState); wmPtr->hints.initial_state = NormalState; } @@ -2701,7 +2701,7 @@ TkWmDeadWindow( } } else { if (wmPtr->wrapper != NULL) { - SendMessage(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0); + SendMessageW(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0); } } if (wmPtr->iconPtr != NULL) { @@ -3188,7 +3188,7 @@ WmAttributesCmd( */ if (!(wmPtr->exStyleConfig & WS_EX_LAYERED)) { - SetWindowLongPtr(wmPtr->wrapper, GWL_EXSTYLE, + SetWindowLongPtrW(wmPtr->wrapper, GWL_EXSTYLE, *stylePtr); } SetLayeredWindowAttributes((HWND) wmPtr->wrapper, @@ -3567,7 +3567,7 @@ WmDeiconifyCmd( return TCL_ERROR; } if (winPtr->flags & TK_EMBEDDED) { - if (!SendMessage(wmPtr->wrapper, TK_DEICONIFY, 0, 0)) { + if (!SendMessageW(wmPtr->wrapper, TK_DEICONIFY, 0, 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't deiconify %s: the container does not support the request", winPtr->pathName)); @@ -3775,7 +3775,7 @@ WmGeometryCmd( height = winPtr->changes.height; } if (winPtr->flags & TK_EMBEDDED) { - int result = SendMessage(wmPtr->wrapper, TK_MOVEWINDOW, -1, -1); + int result = SendMessageW(wmPtr->wrapper, TK_MOVEWINDOW, -1, -1); wmPtr->x = result >> 16; wmPtr->y = result & 0x0000ffff; @@ -4124,7 +4124,7 @@ WmIconifyCmd( return TCL_ERROR; } if (winPtr->flags & TK_EMBEDDED) { - if (!SendMessage(wmPtr->wrapper, TK_ICONIFY, 0, 0)) { + if (!SendMessageW(wmPtr->wrapper, TK_ICONIFY, 0, 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify %s: the container does not support the request", winPtr->pathName)); @@ -4817,7 +4817,7 @@ WmOverrideredirectCmd( return TCL_ERROR; } if (winPtr->flags & TK_EMBEDDED) { - curValue = SendMessage(wmPtr->wrapper, TK_OVERRIDEREDIRECT, -1, -1)-1; + curValue = SendMessageW(wmPtr->wrapper, TK_OVERRIDEREDIRECT, -1, -1)-1; if (curValue < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Container does not support overrideredirect", -1)); @@ -4836,7 +4836,7 @@ WmOverrideredirectCmd( } if (curValue != boolean) { if (winPtr->flags & TK_EMBEDDED) { - SendMessage(wmPtr->wrapper, TK_OVERRIDEREDIRECT, boolean, 0); + SendMessageW(wmPtr->wrapper, TK_OVERRIDEREDIRECT, boolean, 0); } else { /* * Only do this if we are really changing value, because it causes @@ -5350,7 +5350,7 @@ WmStateCmd( Tcl_Panic("unexpected index"); } - if (state+1 != SendMessage(wmPtr->wrapper, TK_STATE, state, 0)) { + if (state+1 != SendMessageW(wmPtr->wrapper, TK_STATE, state, 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't change state of %s: the container does not support the request", winPtr->pathName)); @@ -5403,7 +5403,7 @@ WmStateCmd( int state; if (winPtr->flags & TK_EMBEDDED) { - state = SendMessage(wmPtr->wrapper, TK_STATE, -1, -1) - 1; + state = SendMessageW(wmPtr->wrapper, TK_STATE, -1, -1) - 1; } else { state = wmPtr->hints.initial_state; } @@ -5455,7 +5455,7 @@ WmTitleCmd( } if (winPtr->flags & TK_EMBEDDED) { - wrapper = (HWND) SendMessage(wmPtr->wrapper, TK_GETFRAMEWID, 0, 0); + wrapper = (HWND) SendMessageW(wmPtr->wrapper, TK_GETFRAMEWID, 0, 0); } else { wrapper = wmPtr->wrapper; } @@ -5663,7 +5663,7 @@ WmWithdrawCmd( } if (winPtr->flags & TK_EMBEDDED) { - if (SendMessage(wmPtr->wrapper, TK_WITHDRAW, 0, 0) < 0) { + if (SendMessageW(wmPtr->wrapper, TK_WITHDRAW, 0, 0) < 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't withdraw %s: the container does not support the request", Tcl_GetString(objv[2]))); @@ -5968,7 +5968,7 @@ TopLevelReqProc( wmPtr = winPtr->wmInfoPtr; if (wmPtr) { if ((winPtr->flags & TK_EMBEDDED) && (wmPtr->wrapper != NULL)) { - SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth(tkwin), + SendMessageW(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth(tkwin), Tk_ReqHeight(tkwin)); } if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) { @@ -6180,8 +6180,8 @@ UpdateGeometryInfo( * be ignored. */ - SendMessage(wmPtr->wrapper, TK_MOVEWINDOW, x, y); - SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, width, height); + SendMessageW(wmPtr->wrapper, TK_MOVEWINDOW, x, y); + SendMessageW(wmPtr->wrapper, TK_GEOMETRYREQ, width, height); } else { int reqHeight, reqWidth; RECT windowRect; @@ -6876,7 +6876,7 @@ TkWmRestackToplevel( } if (winPtr->flags & TK_EMBEDDED) { - SendMessage(winPtr->wmInfoPtr->wrapper, TK_RAISEWINDOW, + SendMessageW(winPtr->wmInfoPtr->wrapper, TK_RAISEWINDOW, (WPARAM) insertAfter, aboveBelow); } else { TkWinSetWindowPos(hwnd, insertAfter, aboveBelow); @@ -7102,7 +7102,7 @@ TkWinSetMenu( wmPtr->flags |= WM_UPDATE_PENDING|WM_MOVE_PENDING; } } else { - SendMessage(wmPtr->wrapper, TK_SETMENU, (WPARAM) hMenu, + SendMessageW(wmPtr->wrapper, TK_SETMENU, (WPARAM) hMenu, (LPARAM) Tk_GetMenuHWND(tkwin)); } } @@ -7416,7 +7416,7 @@ InstallColormaps( SelectPalette(dc, oldPalette, TRUE); RealizePalette(dc); ReleaseDC(hwnd, dc); - SendMessage(hwnd, WM_PALETTECHANGED, (WPARAM) hwnd, (LPARAM) NULL); + SendMessageW(hwnd, WM_PALETTECHANGED, (WPARAM) hwnd, (LPARAM) NULL); return TRUE; } } else { @@ -7812,7 +7812,7 @@ TopLevelProc( winPtr->changes.height = pos->cy; } if (!(pos->flags & SWP_NOMOVE)) { - long result = SendMessage(winPtr->wmInfoPtr->wrapper, + long result = SendMessageW(winPtr->wmInfoPtr->wrapper, TK_MOVEWINDOW, -1, -1); winPtr->wmInfoPtr->x = winPtr->changes.x = result >> 16; winPtr->wmInfoPtr->y = winPtr->changes.y = result & 0xffff; @@ -8003,7 +8003,7 @@ WmProc( * 2272] */ - result = DefWindowProc(hwnd, message, wParam, lParam); + result = DefWindowProcW(hwnd, message, wParam, lParam); goto done; } @@ -8080,7 +8080,7 @@ WmProc( HWND hMenuHWnd = Tk_GetEmbeddedMenuHWND((Tk_Window) winPtr); if (hMenuHWnd) { - if (SendMessage(hMenuHWnd, message, wParam, lParam)) { + if (SendMessageW(hMenuHWnd, message, wParam, lParam)) { goto done; } } else if (TkWinHandleMenuEvent(&hwnd, &message, &wParam, &lParam, @@ -8099,10 +8099,10 @@ WmProc( result = 0; } else if (!Tk_TranslateWinEvent(child, message, wParam, lParam, &result)) { - result = DefWindowProc(hwnd, message, wParam, lParam); + result = DefWindowProcW(hwnd, message, wParam, lParam); } } else { - result = DefWindowProc(hwnd, message, wParam, lParam); + result = DefWindowProcW(hwnd, message, wParam, lParam); } done: @@ -8616,10 +8616,10 @@ TkpWinToplevelDetachWindow( register WmInfo *wmPtr = winPtr->wmInfoPtr; if (winPtr->flags & TK_EMBEDDED) { - int state = SendMessage(wmPtr->wrapper, TK_STATE, -1, -1) - 1; + int state = SendMessageW(wmPtr->wrapper, TK_STATE, -1, -1) - 1; - SendMessage(wmPtr->wrapper, TK_SETMENU, 0, 0); - SendMessage(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0); + SendMessageW(wmPtr->wrapper, TK_SETMENU, 0, 0); + SendMessageW(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0); winPtr->flags &= ~TK_EMBEDDED; winPtr->privatePtr = NULL; wmPtr->wrapper = NULL; diff --git a/win/tkWinX.c b/win/tkWinX.c index 5617db9..c633e03 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -780,7 +780,7 @@ TkWinChildProc( case WM_IME_COMPOSITION: result = 0; if (HandleIMEComposition(hwnd, lParam) == 0) { - result = DefWindowProc(hwnd, message, wParam, lParam); + result = DefWindowProcW(hwnd, message, wParam, lParam); } break; @@ -800,7 +800,7 @@ TkWinChildProc( case WM_PAINT: GenerateXEvent(hwnd, message, wParam, lParam); - result = DefWindowProc(hwnd, message, wParam, lParam); + result = DefWindowProcW(hwnd, message, wParam, lParam); break; case TK_CLAIMFOCUS: @@ -837,7 +837,7 @@ TkWinChildProc( default: if (!Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) { - result = DefWindowProc(hwnd, message, wParam, lParam); + result = DefWindowProcW(hwnd, message, wParam, lParam); } break; } @@ -918,7 +918,7 @@ Tk_TranslateWinEvent( ? ((NMHDR*)lParam)->hwndFrom : (HWND) lParam; if (target && target != hwnd) { - *resultPtr = SendMessage(target, message, wParam, lParam); + *resultPtr = SendMessageW(target, message, wParam, lParam); return 1; } break; @@ -1311,10 +1311,10 @@ GenerateXEvent( if (IsDBCSLeadByte((BYTE) wParam)) { MSG msg; - if ((PeekMessage(&msg, NULL, WM_CHAR, WM_CHAR, + if ((PeekMessageW(&msg, NULL, WM_CHAR, WM_CHAR, PM_NOREMOVE) != 0) && (msg.message == WM_CHAR)) { - GetMessage(&msg, NULL, WM_CHAR, WM_CHAR); + GetMessageW(&msg, NULL, WM_CHAR, WM_CHAR); event.xkey.nbytes = 2; event.xkey.trans_chars[1] = (char) msg.wParam; } @@ -1616,7 +1616,7 @@ TkWinGetUnicodeEncoding(void) * * When an Input Method Editor (IME) is ready to send input characters to * an application, it sends a WM_IME_COMPOSITION message with the - * GCS_RESULTSTR. However, The DefWindowProc() on English Windows 2000 + * GCS_RESULTSTR. However, The DefWindowProcW() on English Windows 2000 * arbitrarily converts all non-Latin-1 characters in the composition to * "?". * @@ -1655,7 +1655,7 @@ HandleIMEComposition( return 0; } - n = ImmGetCompositionString(hIMC, GCS_RESULTSTR, NULL, 0); + n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0); if (n > 0) { WCHAR *buff = (WCHAR *) ckalloc(n); @@ -1663,7 +1663,7 @@ HandleIMEComposition( XEvent event; int i; - n = ImmGetCompositionString(hIMC, GCS_RESULTSTR, buff, (unsigned) n) / 2; + n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buff, (unsigned) n) / 2; /* * Set up the fields pertinent to key event. @@ -1821,7 +1821,7 @@ TkWinResendEvent( } lparam = MAKELPARAM((short) eventPtr->xbutton.x, (short) eventPtr->xbutton.y); - return CallWindowProc(wndproc, hwnd, msg, wparam, lparam); + return CallWindowProcW(wndproc, hwnd, msg, wparam, lparam); } /* diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c index 8bcfca2..ae026b3 100644 --- a/win/ttkWinMonitor.c +++ b/win/ttkWinMonitor.c @@ -92,7 +92,7 @@ CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp) hwnd = CreateWindowW( name, title, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hinst, NULL ); - SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) interp); + SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) interp); ShowWindow(hwnd, SW_HIDE); UpdateWindow(hwnd); } @@ -109,7 +109,7 @@ DestroyThemeMonitorWindow(void *clientData) static LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) { - Tcl_Interp *interp = (Tcl_Interp *)GetWindowLongPtr(hwnd, GWLP_USERDATA); + Tcl_Interp *interp = (Tcl_Interp *)GetWindowLongPtrW(hwnd, GWLP_USERDATA); Ttk_Theme theme; switch (msg) { @@ -137,7 +137,7 @@ WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) } break; } - return DefWindowProc(hwnd, msg, wp, lp); + return DefWindowProcW(hwnd, msg, wp, lp); } /* -- cgit v0.12