diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-01-18 12:45:33 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-01-18 12:45:33 (GMT) |
commit | 5442c2a77a9c025b2245d42dbae20829f03be9bc (patch) | |
tree | 3347f99a0c9ea25a0496c20b7e9a54eb1c820377 /win | |
parent | c558898981a43637a64c17a40fd816ae41991961 (diff) | |
download | tk-5442c2a77a9c025b2245d42dbae20829f03be9bc.zip tk-5442c2a77a9c025b2245d42dbae20829f03be9bc.tar.gz tk-5442c2a77a9c025b2245d42dbae20829f03be9bc.tar.bz2 |
Use the win32 Wide API in some more places. And some simplifications, since we no longer support win95/98/ME
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinClipboard.c | 11 | ||||
-rw-r--r-- | win/tkWinFont.c | 41 | ||||
-rw-r--r-- | win/tkWinMenu.c | 46 |
3 files changed, 39 insertions, 59 deletions
diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c index 200883f..929070b 100644 --- a/win/tkWinClipboard.c +++ b/win/tkWinClipboard.c @@ -414,16 +414,7 @@ UpdateClipboard( OpenClipboard(hwnd); EmptyClipboard(); - /* - * CF_UNICODETEXT is only supported on NT, but it it is prefered when - * possible. - */ - - if (TkWinGetPlatformId() != VER_PLATFORM_WIN32_WINDOWS) { - SetClipboardData(CF_UNICODETEXT, NULL); - } else { - SetClipboardData(CF_TEXT, NULL); - } + SetClipboardData(CF_UNICODETEXT, NULL); CloseClipboard(); TkWinUpdatingClipboard(FALSE); } diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 860451b..ea8a7a2 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -262,16 +262,7 @@ void TkpFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ { - if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) { - /* - * If running NT, then we will be calling some Unicode functions - * explictly. So, even if the Tcl system encoding isn't Unicode, make - * sure we convert to/from the Unicode char set. - */ - - systemEncoding = TkWinGetUnicodeEncoding(); - } - + systemEncoding = TkWinGetUnicodeEncoding(); TkWinSetupSystemFonts(mainPtr); } @@ -760,14 +751,14 @@ TkpGetFontAttrsForChar( * character */ FontFamily *familyPtr = thisSubFontPtr->familyPtr; HFONT oldfont; /* Saved font from the device context */ - TEXTMETRICA tm; /* Font metrics of the selected subfont */ + TEXTMETRIC tm; /* Font metrics of the selected subfont */ /* * Get the font attributes. */ oldfont = SelectObject(hdc, thisSubFontPtr->hFont0); - GetTextMetricsA(hdc, &tm); + GetTextMetrics(hdc, &tm); SelectObject(hdc, oldfont); ReleaseDC(fontPtr->hwnd, hdc); faPtr->family = familyPtr->faceName; @@ -1118,7 +1109,7 @@ Tk_DrawChars( HBRUSH oldBrush, stipple; HBITMAP oldBitmap, bitmap; HDC dcMem; - TEXTMETRICA tm; + TEXTMETRIC tm; SIZE size; if (twdPtr->type != TWD_BITMAP) { @@ -1145,7 +1136,7 @@ Tk_DrawChars( */ GetTextExtentPointA(dcMem, source, numBytes, &size); - GetTextMetricsA(dcMem, &tm); + GetTextMetrics(dcMem, &tm); size.cx -= tm.tmOverhang; bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy); oldBitmap = SelectObject(dcMem, bitmap); @@ -1184,7 +1175,7 @@ Tk_DrawChars( } else { HBITMAP oldBitmap, bitmap; HDC dcMem; - TEXTMETRICA tm; + TEXTMETRIC tm; SIZE size; dcMem = CreateCompatibleDC(dc); @@ -1199,7 +1190,7 @@ Tk_DrawChars( */ GetTextExtentPointA(dcMem, source, numBytes, &size); - GetTextMetricsA(dcMem, &tm); + GetTextMetrics(dcMem, &tm); size.cx -= tm.tmOverhang; bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy); oldBitmap = SelectObject(dcMem, bitmap); @@ -1266,7 +1257,7 @@ TkDrawAngledChars( HBRUSH oldBrush, stipple; HBITMAP oldBitmap, bitmap; HDC dcMem; - TEXTMETRICA tm; + TEXTMETRIC tm; SIZE size; if (twdPtr->type != TWD_BITMAP) { @@ -1293,7 +1284,7 @@ TkDrawAngledChars( */ GetTextExtentPointA(dcMem, source, numBytes, &size); - GetTextMetricsA(dcMem, &tm); + GetTextMetrics(dcMem, &tm); size.cx -= tm.tmOverhang; bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy); oldBitmap = SelectObject(dcMem, bitmap); @@ -1332,7 +1323,7 @@ TkDrawAngledChars( } else { HBITMAP oldBitmap, bitmap; HDC dcMem; - TEXTMETRICA tm; + TEXTMETRIC tm; SIZE size; dcMem = CreateCompatibleDC(dc); @@ -1347,7 +1338,7 @@ TkDrawAngledChars( */ GetTextExtentPointA(dcMem, source, numBytes, &size); - GetTextMetricsA(dcMem, &tm); + GetTextMetrics(dcMem, &tm); size.cx -= tm.tmOverhang; bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy); oldBitmap = SelectObject(dcMem, bitmap); @@ -1454,11 +1445,11 @@ MultiFontTextOut( Tcl_DString runString; const char *p, *end, *next; SubFont *lastSubFontPtr, *thisSubFontPtr; - TEXTMETRICA tm; + TEXTMETRIC tm; lastSubFontPtr = &fontPtr->subFontArray[0]; oldFont = SelectFont(hdc, fontPtr, lastSubFontPtr, angle); - GetTextMetricsA(hdc, &tm); + GetTextMetrics(hdc, &tm); end = source + numBytes; for (p = source; p < end; ) { @@ -1482,7 +1473,7 @@ MultiFontTextOut( lastSubFontPtr = thisSubFontPtr; source = p; SelectFont(hdc, fontPtr, lastSubFontPtr, angle); - GetTextMetricsA(hdc, &tm); + GetTextMetrics(hdc, &tm); } p = next; } @@ -1560,7 +1551,7 @@ InitFont( HDC hdc; HWND hwnd; HFONT oldFont; - TEXTMETRICA tm; + TEXTMETRIC tm; Window window; TkFontMetrics *fmPtr; Tcl_Encoding encoding; @@ -1573,7 +1564,7 @@ InitFont( hdc = GetDC(hwnd); oldFont = SelectObject(hdc, hFont); - GetTextMetricsA(hdc, &tm); + GetTextMetrics(hdc, &tm); /* * On any version NT, there may fonts with international names. Use the diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 8e14669..3cf7c10 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -900,7 +900,7 @@ TkWinMenuProc( LRESULT lResult; if (!TkWinHandleMenuEvent(&hwnd, &message, &wParam, &lParam, &lResult)) { - lResult = DefWindowProcA(hwnd, message, wParam, lParam); + lResult = DefWindowProc(hwnd, message, wParam, lParam); } return lResult; } @@ -999,7 +999,7 @@ TkWinEmbeddedMenuProc( } default: - lResult = DefWindowProcA(hwnd, message, wParam, lParam); + lResult = DefWindowProc(hwnd, message, wParam, lParam); break; } return lResult; @@ -2036,33 +2036,33 @@ TkWinMenuKeyObjCmd( if (eventPtr->type == KeyPress) { switch (keySym) { case XK_Alt_L: - scanCode = MapVirtualKeyA(VK_LMENU, 0); - CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)), + scanCode = MapVirtualKey(VK_LMENU, 0); + CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYDOWN, VK_MENU, (int) (scanCode << 16) | (1 << 29)); break; case XK_Alt_R: - scanCode = MapVirtualKeyA(VK_RMENU, 0); - CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)), + scanCode = MapVirtualKey(VK_RMENU, 0); + CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYDOWN, VK_MENU, (int) (scanCode << 16) | (1 << 29) | (1 << 24)); break; case XK_F10: - scanCode = MapVirtualKeyA(VK_F10, 0); - CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)), + scanCode = MapVirtualKey(VK_F10, 0); + CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYDOWN, VK_F10, (int) (scanCode << 16)); break; default: virtualKey = XKeysymToKeycode(winPtr->display, keySym); - scanCode = MapVirtualKeyA(virtualKey, 0); + scanCode = MapVirtualKey(virtualKey, 0); if (0 != scanCode) { XKeyEvent xkey = eventPtr->xkey; - CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)), + CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYDOWN, virtualKey, (int) ((scanCode << 16) | (1 << 29))); if (xkey.nbytes > 0) { for (i = 0; i < xkey.nbytes; i++) { - CallWindowProcA(DefWindowProcA, + CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSCHAR, xkey.trans_chars[i], (int) ((scanCode << 16) | (1 << 29))); @@ -2073,28 +2073,28 @@ TkWinMenuKeyObjCmd( } else if (eventPtr->type == KeyRelease) { switch (keySym) { case XK_Alt_L: - scanCode = MapVirtualKeyA(VK_LMENU, 0); - CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)), + scanCode = MapVirtualKey(VK_LMENU, 0); + CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16) | (1 << 29) | (1 << 30) | (1 << 31)); break; case XK_Alt_R: - scanCode = MapVirtualKeyA(VK_RMENU, 0); - CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)), + scanCode = MapVirtualKey(VK_RMENU, 0); + CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16) | (1 << 24) | (0x111 << 29) | (1 << 30) | (1 << 31)); break; case XK_F10: - scanCode = MapVirtualKeyA(VK_F10, 0); - CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)), + scanCode = MapVirtualKey(VK_F10, 0); + CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYUP, VK_F10, (int) (scanCode << 16) | (1 << 30) | (1 << 31)); break; default: virtualKey = XKeysymToKeycode(winPtr->display, keySym); - scanCode = MapVirtualKeyA(virtualKey, 0); + scanCode = MapVirtualKey(virtualKey, 0); if (0 != scanCode) { - CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)), + CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYUP, virtualKey, (int) ((scanCode << 16) | (1 << 29) | (1 << 30) | (1 << 31))); } @@ -3199,7 +3199,7 @@ SetDefaults( HDC scratchDC; int bold = 0; int italic = 0; - TEXTMETRICA tm; + TEXTMETRIC tm; int pointSize; HFONT menuFont; /* See: [Bug #3239768] tk8.4.19 (and later) WIN32 menu font support */ @@ -3239,7 +3239,7 @@ SetDefaults( &nc.metrics, 0); menuFont = CreateFontIndirect(&nc.metrics.lfMenuFont); SelectObject(scratchDC, menuFont); - GetTextMetricsA(scratchDC, &tm); + GetTextMetrics(scratchDC, &tm); GetTextFaceA(scratchDC, LF_FACESIZE, faceName); pointSize = MulDiv(tm.tmHeight - tm.tmInternalLeading, 72, GetDeviceCaps(scratchDC, LOGPIXELSY)); @@ -3295,9 +3295,7 @@ SetDefaults( */ showMenuAccelerators = TRUE; - if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) { - SystemParametersInfoA(SPI_GETKEYBOARDCUES, 0, &showMenuAccelerators, 0); - } + SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &showMenuAccelerators, 0); } /* |