summaryrefslogtreecommitdiffstats
path: root/win/tkWinMenu.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-09-23 18:50:49 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-09-23 18:50:49 (GMT)
commit797299a238c72e1add2fd56d9706346a46861e0a (patch)
tree9a780e02f8f65645a03c60dc8cfe266e73e001f8 /win/tkWinMenu.c
parentcd10234e38f770e0ccb89282180716b4cbd04fea (diff)
downloadtk-797299a238c72e1add2fd56d9706346a46861e0a.zip
tk-797299a238c72e1add2fd56d9706346a46861e0a.tar.gz
tk-797299a238c72e1add2fd56d9706346a46861e0a.tar.bz2
Use more explicit *W()-forms of the Win32 API, instead of relying on -DUNICODE
Diffstat (limited to 'win/tkWinMenu.c')
-rw-r--r--win/tkWinMenu.c56
1 files changed, 28 insertions, 28 deletions
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);
}
/*