summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/tkWinClipboard.c10
-rw-r--r--win/tkWinColor.c10
-rw-r--r--win/tkWinCursor.c12
-rw-r--r--win/tkWinFont.c141
-rw-r--r--win/tkWinMenu.c78
-rw-r--r--win/tkWinPixmap.c14
-rw-r--r--win/tkWinTest.c32
-rw-r--r--win/tkWinX.c65
8 files changed, 119 insertions, 243 deletions
diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c
index d9b7af3..f062ae2 100644
--- a/win/tkWinClipboard.c
+++ b/win/tkWinClipboard.c
@@ -9,15 +9,9 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinClipboard.c,v 1.12 2010/09/10 08:59:25 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinClipboard.c,v 1.13 2010/10/06 14:33:29 nijtmans Exp $
*/
-/* TODO: This file does not compile in UNICODE mode.
- * See [Freq 2965056]: Windows build with -DUNICODE
- */
-#undef UNICODE
-#undef _UNICODE
-
#include "tkWinInt.h"
#include "tkSelect.h"
@@ -112,7 +106,7 @@ TkSelGetSelection(
*/
locale = LANGIDFROMLCID(*((int*)data));
- GetLocaleInfo(locale, LOCALE_IDEFAULTANSICODEPAGE,
+ GetLocaleInfoA(locale, LOCALE_IDEFAULTANSICODEPAGE,
Tcl_DStringValue(&ds)+2, Tcl_DStringLength(&ds)-2);
GlobalUnlock(handle);
diff --git a/win/tkWinColor.c b/win/tkWinColor.c
index 2e88013..518f543 100644
--- a/win/tkWinColor.c
+++ b/win/tkWinColor.c
@@ -9,15 +9,9 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinColor.c,v 1.16 2010/09/10 08:59:26 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinColor.c,v 1.17 2010/10/06 14:33:29 nijtmans Exp $
*/
-/* TODO: This file does not compile in UNICODE mode.
- * See [Freq 2965056]: Windows build with -DUNICODE
- */
-#undef UNICODE
-#undef _UNICODE
-
#include "tkWinInt.h"
#include "tkColor.h"
@@ -363,7 +357,7 @@ XAllocColor(
color->blue = closeEntry.peBlue * 257;
entry = closeEntry;
if (index >= cmap->size) {
- OutputDebugString("XAllocColor: Colormap is bigger than we thought");
+ OutputDebugStringA("XAllocColor: Colormap is bigger than we thought");
}
} else {
cmap->size++;
diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c
index a8df6a3..2a44196 100644
--- a/win/tkWinCursor.c
+++ b/win/tkWinCursor.c
@@ -8,15 +8,9 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinCursor.c,v 1.19 2010/09/10 08:59:25 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinCursor.c,v 1.20 2010/10/06 14:33:29 nijtmans Exp $
*/
-/* TODO: This file does not compile in UNICODE mode.
- * See [Freq 2965056]: Windows build with -DUNICODE
- */
-#undef UNICODE
-#undef _UNICODE
-
#include "tkWinInt.h"
/*
@@ -145,7 +139,7 @@ TkGetCursorByName(
ckfree((char *) cursorPtr);
return NULL;
}
- cursorPtr->winCursor = LoadCursorFromFile(&(argv[0][1]));
+ cursorPtr->winCursor = LoadCursorFromFileA(&(argv[0][1]));
} else {
/*
* Check for the cursor in the system cursor set.
@@ -164,7 +158,7 @@ TkGetCursorByName(
* one of our application resources.
*/
- cursorPtr->winCursor = LoadCursor(Tk_GetHINSTANCE(), argv[0]);
+ cursorPtr->winCursor = LoadCursorA(Tk_GetHINSTANCE(), argv[0]);
} else {
cursorPtr->system = 1;
}
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 574e5e2..5646b6c 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -11,15 +11,9 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinFont.c,v 1.51 2010/09/10 08:59:26 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinFont.c,v 1.52 2010/10/06 14:33:29 nijtmans Exp $
*/
-/* TODO: This file does not compile in UNICODE mode.
- * See [Freq 2965056]: Windows build with -DUNICODE
- */
-#undef UNICODE
-#undef _UNICODE
-
#include "tkWinInt.h"
#include "tkFont.h"
@@ -221,7 +215,7 @@ static inline void InitSubFont(HDC hdc, HFONT hFont, int base,
SubFont *subFontPtr);
static int CreateNamedSystemLogFont(Tcl_Interp *interp,
Tk_Window tkwin, const char* name,
- LOGFONT* logFontPtr);
+ LOGFONTA* logFontPtr);
static int CreateNamedSystemFont(Tcl_Interp *interp,
Tk_Window tkwin, const char* name, HFONT hFont);
static int LoadFontRanges(HDC hdc, HFONT hFont,
@@ -237,14 +231,14 @@ static inline HFONT SelectFont(HDC hdc, WinFont *fontPtr,
SubFont *subFontPtr, double angle);
static inline void SwapLong(PULONG p);
static inline void SwapShort(USHORT *p);
-static int CALLBACK WinFontCanUseProc(ENUMLOGFONT *lfPtr,
- NEWTEXTMETRIC *tmPtr, int fontType,
+static int CALLBACK WinFontCanUseProc(ENUMLOGFONTA *lfPtr,
+ NEWTEXTMETRICA *tmPtr, int fontType,
LPARAM lParam);
-static int CALLBACK WinFontExistProc(ENUMLOGFONT *lfPtr,
- NEWTEXTMETRIC *tmPtr, int fontType,
+static int CALLBACK WinFontExistProc(ENUMLOGFONTA *lfPtr,
+ NEWTEXTMETRICA *tmPtr, int fontType,
LPARAM lParam);
-static int CALLBACK WinFontFamilyEnumProc(ENUMLOGFONT *lfPtr,
- NEWTEXTMETRIC *tmPtr, int fontType,
+static int CALLBACK WinFontFamilyEnumProc(ENUMLOGFONTA *lfPtr,
+ NEWTEXTMETRICA *tmPtr, int fontType,
LPARAM lParam);
/*
@@ -348,12 +342,12 @@ CreateNamedSystemLogFont(
Tcl_Interp *interp,
Tk_Window tkwin,
const char* name,
- LOGFONT* logFontPtr)
+ LOGFONTA* logFontPtr)
{
HFONT hFont;
int r;
- hFont = CreateFontIndirect(logFontPtr);
+ hFont = CreateFontIndirectA(logFontPtr);
r = CreateNamedSystemFont(interp, tkwin, name, hFont);
DeleteObject((HGDIOBJ)hFont);
return r;
@@ -409,8 +403,8 @@ TkWinSetupSystemFonts(
Tcl_Interp *interp;
Tk_Window tkwin;
const TkStateMap *mapPtr;
- NONCLIENTMETRICS ncMetrics;
- ICONMETRICS iconMetrics;
+ NONCLIENTMETRICSA ncMetrics;
+ ICONMETRICSA iconMetrics;
HFONT hFont;
interp = (Tcl_Interp *) mainPtr->interp;
@@ -430,7 +424,7 @@ TkWinSetupSystemFonts(
ZeroMemory(&ncMetrics, sizeof(ncMetrics));
ncMetrics.cbSize = sizeof(ncMetrics);
- if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
+ if (SystemParametersInfoA(SPI_GETNONCLIENTMETRICS,
sizeof(ncMetrics), &ncMetrics, 0)) {
CreateNamedSystemLogFont(interp, tkwin, "TkDefaultFont",
&ncMetrics.lfMessageFont);
@@ -449,7 +443,7 @@ TkWinSetupSystemFonts(
}
iconMetrics.cbSize = sizeof(iconMetrics);
- if (SystemParametersInfo(SPI_GETICONMETRICS, sizeof(iconMetrics),
+ if (SystemParametersInfoA(SPI_GETICONMETRICS, sizeof(iconMetrics),
&iconMetrics, 0)) {
CreateNamedSystemLogFont(interp, tkwin, "TkIconFont",
&iconMetrics.lfFont);
@@ -461,9 +455,9 @@ TkWinSetupSystemFonts(
*/
{
- LOGFONT lfFixed = {
+ LOGFONTA lfFixed = {
0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
- 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, TEXT("")
+ 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, ""
};
long pointSize, dpi;
HDC hdc = GetDC(NULL);
@@ -668,25 +662,20 @@ TkpGetFontFamilies(
* because it only exists under NT.
*/
- if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
- EnumFontFamiliesW(hdc, NULL, (FONTENUMPROCW) WinFontFamilyEnumProc,
- (LPARAM) resultObj);
- } else {
- EnumFontFamiliesA(hdc, NULL, (FONTENUMPROCA) WinFontFamilyEnumProc,
- (LPARAM) resultObj);
- }
+ EnumFontFamiliesW(hdc, NULL, (FONTENUMPROCW) WinFontFamilyEnumProc,
+ (LPARAM) resultObj);
ReleaseDC(hwnd, hdc);
Tcl_SetObjResult(interp, resultObj);
}
static int CALLBACK
WinFontFamilyEnumProc(
- ENUMLOGFONT *lfPtr, /* Logical-font data. */
- NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */
+ ENUMLOGFONTA *lfPtr, /* Logical-font data. */
+ NEWTEXTMETRICA *tmPtr, /* Physical-font data (not used). */
int fontType, /* Type of font (not used). */
LPARAM lParam) /* Result object to hold result. */
{
- TCHAR *faceName = lfPtr->elfLogFont.lfFaceName;
+ char *faceName = lfPtr->elfLogFont.lfFaceName;
Tcl_Obj *resultObj = (Tcl_Obj *) lParam;
Tcl_DString faceString;
@@ -773,14 +762,14 @@ TkpGetFontAttrsForChar(
* character */
FontFamily *familyPtr = thisSubFontPtr->familyPtr;
HFONT oldfont; /* Saved font from the device context */
- TEXTMETRIC tm; /* Font metrics of the selected subfont */
+ TEXTMETRICA tm; /* Font metrics of the selected subfont */
/*
* Get the font attributes.
*/
oldfont = SelectObject(hdc, thisSubFontPtr->hFont0);
- GetTextMetrics(hdc, &tm);
+ GetTextMetricsA(hdc, &tm);
SelectObject(hdc, oldfont);
ReleaseDC(fontPtr->hwnd, hdc);
faPtr->family = familyPtr->faceName;
@@ -880,7 +869,7 @@ Tk_MeasureChars(
(int) (p - start), &runString);
size.cx = 0;
familyPtr->getTextExtentPoint32Proc(hdc,
- Tcl_DStringValue(&runString),
+ (TCHAR *)Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
&size);
Tcl_DStringFree(&runString);
@@ -907,7 +896,7 @@ Tk_MeasureChars(
Tcl_UtfToExternalDString(familyPtr->encoding, start,
(int) (p - start), &runString);
size.cx = 0;
- familyPtr->getTextExtentPoint32Proc(hdc, Tcl_DStringValue(&runString),
+ familyPtr->getTextExtentPoint32Proc(hdc, (TCHAR *) Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
&size);
Tcl_DStringFree(&runString);
@@ -941,7 +930,7 @@ Tk_MeasureChars(
Tcl_DStringAppend(&runString,buf,dstWrote);
size.cx = 0;
familyPtr->getTextExtentPoint32Proc(hdc,
- Tcl_DStringValue(&runString),
+ (TCHAR *) Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
&size);
if ((curX+size.cx) > maxLength) {
@@ -1131,7 +1120,7 @@ Tk_DrawChars(
HBRUSH oldBrush, stipple;
HBITMAP oldBitmap, bitmap;
HDC dcMem;
- TEXTMETRIC tm;
+ TEXTMETRICA tm;
SIZE size;
if (twdPtr->type != TWD_BITMAP) {
@@ -1157,8 +1146,8 @@ Tk_DrawChars(
* Compute the bounding box and create a compatible bitmap.
*/
- GetTextExtentPoint(dcMem, source, numBytes, &size);
- GetTextMetrics(dcMem, &tm);
+ GetTextExtentPointA(dcMem, source, numBytes, &size);
+ GetTextMetricsA(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1197,7 +1186,7 @@ Tk_DrawChars(
} else {
HBITMAP oldBitmap, bitmap;
HDC dcMem;
- TEXTMETRIC tm;
+ TEXTMETRICA tm;
SIZE size;
dcMem = CreateCompatibleDC(dc);
@@ -1211,8 +1200,8 @@ Tk_DrawChars(
* Compute the bounding box and create a compatible bitmap.
*/
- GetTextExtentPoint(dcMem, source, numBytes, &size);
- GetTextMetrics(dcMem, &tm);
+ GetTextExtentPointA(dcMem, source, numBytes, &size);
+ GetTextMetricsA(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1279,7 +1268,7 @@ TkpDrawAngledChars(
HBRUSH oldBrush, stipple;
HBITMAP oldBitmap, bitmap;
HDC dcMem;
- TEXTMETRIC tm;
+ TEXTMETRICA tm;
SIZE size;
if (twdPtr->type != TWD_BITMAP) {
@@ -1305,8 +1294,8 @@ TkpDrawAngledChars(
* Compute the bounding box and create a compatible bitmap.
*/
- GetTextExtentPoint(dcMem, source, numBytes, &size);
- GetTextMetrics(dcMem, &tm);
+ GetTextExtentPointA(dcMem, source, numBytes, &size);
+ GetTextMetricsA(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1345,7 +1334,7 @@ TkpDrawAngledChars(
} else {
HBITMAP oldBitmap, bitmap;
HDC dcMem;
- TEXTMETRIC tm;
+ TEXTMETRICA tm;
SIZE size;
dcMem = CreateCompatibleDC(dc);
@@ -1359,8 +1348,8 @@ TkpDrawAngledChars(
* Compute the bounding box and create a compatible bitmap.
*/
- GetTextExtentPoint(dcMem, source, numBytes, &size);
- GetTextMetrics(dcMem, &tm);
+ GetTextExtentPointA(dcMem, source, numBytes, &size);
+ GetTextMetricsA(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1463,11 +1452,11 @@ MultiFontTextOut(
Tcl_DString runString;
const char *p, *end, *next;
SubFont *lastSubFontPtr, *thisSubFontPtr;
- TEXTMETRIC tm;
+ TEXTMETRICA tm;
lastSubFontPtr = &fontPtr->subFontArray[0];
oldFont = SelectFont(hdc, fontPtr, lastSubFontPtr, angle);
- GetTextMetrics(hdc, &tm);
+ GetTextMetricsA(hdc, &tm);
end = source + numBytes;
for (p = source; p < end; ) {
@@ -1479,10 +1468,10 @@ MultiFontTextOut(
Tcl_UtfToExternalDString(familyPtr->encoding, source,
(int) (p - source), &runString);
familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y,
- Tcl_DStringValue(&runString),
+ (TCHAR *)Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString)>>familyPtr->isWideFont);
familyPtr->getTextExtentPoint32Proc(hdc,
- Tcl_DStringValue(&runString),
+ (TCHAR *)Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
&size);
x += size.cx;
@@ -1491,7 +1480,7 @@ MultiFontTextOut(
lastSubFontPtr = thisSubFontPtr;
source = p;
SelectFont(hdc, fontPtr, lastSubFontPtr, angle);
- GetTextMetrics(hdc, &tm);
+ GetTextMetricsA(hdc, &tm);
}
p = next;
}
@@ -1500,7 +1489,7 @@ MultiFontTextOut(
Tcl_UtfToExternalDString(familyPtr->encoding, source,
(int) (p - source), &runString);
familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y,
- Tcl_DStringValue(&runString),
+ (TCHAR *)Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) >> familyPtr->isWideFont);
Tcl_DStringFree(&runString);
}
@@ -1569,7 +1558,7 @@ InitFont(
HDC hdc;
HWND hwnd;
HFONT oldFont;
- TEXTMETRIC tm;
+ TEXTMETRICA tm;
Window window;
TkFontMetrics *fmPtr;
Tcl_Encoding encoding;
@@ -1582,7 +1571,7 @@ InitFont(
hdc = GetDC(hwnd);
oldFont = SelectObject(hdc, hFont);
- GetTextMetrics(hdc, &tm);
+ GetTextMetricsA(hdc, &tm);
/*
* On any version NT, there may fonts with international names. Use the
@@ -1599,11 +1588,7 @@ InitFont(
* GetTextFace because it only exists under NT.
*/
- if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
- GetTextFaceW(hdc, LF_FACESIZE, (WCHAR *) buf);
- } else {
- GetTextFaceA(hdc, LF_FACESIZE, (char *) buf);
- }
+ GetTextFaceW(hdc, LF_FACESIZE, (WCHAR *) buf);
Tcl_ExternalToUtfDString(systemEncoding, buf, -1, &faceString);
fontPtr->font.fid = (Font) fontPtr;
@@ -1780,11 +1765,7 @@ AllocFontFamily(
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
hFont = SelectObject(hdc, hFont);
- if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
- GetTextFaceW(hdc, LF_FACESIZE, (WCHAR *) buf);
- } else {
- GetTextFaceA(hdc, LF_FACESIZE, (char *) buf);
- }
+ GetTextFaceW(hdc, LF_FACESIZE, (WCHAR *) buf);
Tcl_ExternalToUtfDString(systemEncoding, buf, -1, &faceString);
faceName = Tk_GetUid(Tcl_DStringValue(&faceString));
Tcl_DStringFree(&faceString);
@@ -2047,13 +2028,8 @@ FindSubFontForChar(
canUse.ch = ch;
canUse.subFontPtr = NULL;
canUse.subFontPtrPtr = subFontPtrPtr;
- if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
- EnumFontFamiliesW(hdc, NULL, (FONTENUMPROCW) WinFontCanUseProc,
- (LPARAM) &canUse);
- } else {
- EnumFontFamiliesA(hdc, NULL, (FONTENUMPROCA) WinFontCanUseProc,
- (LPARAM) &canUse);
- }
+ EnumFontFamiliesW(hdc, NULL, (FONTENUMPROCW) WinFontCanUseProc,
+ (LPARAM) &canUse);
subFontPtr = canUse.subFontPtr;
end:
@@ -2074,8 +2050,8 @@ FindSubFontForChar(
static int CALLBACK
WinFontCanUseProc(
- ENUMLOGFONT *lfPtr, /* Logical-font data. */
- NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */
+ ENUMLOGFONTA *lfPtr, /* Logical-font data. */
+ NEWTEXTMETRICA *tmPtr, /* Physical-font data (not used). */
int fontType, /* Type of font (not used). */
LPARAM lParam) /* Result object to hold result. */
{
@@ -2604,13 +2580,8 @@ FamilyExists(
* non-zero value.
*/
- if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
- result = EnumFontFamiliesW(hdc, (WCHAR*) Tcl_DStringValue(&faceString),
- (FONTENUMPROCW) WinFontExistProc, 0);
- } else {
- result = EnumFontFamiliesA(hdc, (char *) Tcl_DStringValue(&faceString),
- (FONTENUMPROCA) WinFontExistProc, 0);
- }
+ result = EnumFontFamiliesW(hdc, (WCHAR*) Tcl_DStringValue(&faceString),
+ (FONTENUMPROCW) WinFontExistProc, 0);
Tcl_DStringFree(&faceString);
return (result == 0);
}
@@ -2639,8 +2610,8 @@ FamilyOrAliasExists(
static int CALLBACK
WinFontExistProc(
- ENUMLOGFONT *lfPtr, /* Logical-font data. */
- NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */
+ ENUMLOGFONTA *lfPtr, /* Logical-font data. */
+ NEWTEXTMETRICA *tmPtr, /* Physical-font data (not used). */
int fontType, /* Type of font (not used). */
LPARAM lParam) /* EnumFontData to hold result. */
{
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index 6760e14..1ff3cfa 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -10,15 +10,9 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinMenu.c,v 1.75 2010/09/13 08:11:59 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinMenu.c,v 1.76 2010/10/06 14:33:29 nijtmans Exp $
*/
-/* TODO: This file does not compile in UNICODE mode.
- * See [Freq 2965056]: Windows build with -DUNICODE
- */
-#undef UNICODE
-#undef _UNICODE
-
#define OEMRESOURCE
#include "tkWinInt.h"
#include "tkMenu.h"
@@ -27,8 +21,8 @@
* The class of the window for popup menus.
*/
-#define MENU_CLASS_NAME "MenuWindowClass"
-#define EMBEDDED_MENU_CLASS_NAME "EmbeddedMenuWindowClass"
+#define MENU_CLASS_NAME TEXT("MenuWindowClass")
+#define EMBEDDED_MENU_CLASS_NAME TEXT("EmbeddedMenuWindowClass")
/*
* Used to align a windows bitmap inside a rectangle
@@ -163,7 +157,7 @@ static void DrawWindowsSystemBitmap(Display *display,
Drawable drawable, GC gc, const RECT *rectPtr,
int bitmapID, int alignFlags);
static void FreeID(WORD commandID);
-static TCHAR * GetEntryText(TkMenuEntry *mePtr);
+static char * GetEntryText(TkMenuEntry *mePtr);
static void GetMenuAccelGeometry(TkMenu *menuPtr,
TkMenuEntry *mePtr, Tk_Font tkfont,
const Tk_FontMetrics *fmPtr, int *widthPtr,
@@ -554,7 +548,7 @@ ReconfigureWindowsMenu(
TkMenu *menuPtr = (TkMenu *) clientData;
TkMenuEntry *mePtr;
HMENU winMenuHdl = (HMENU) menuPtr->platformData;
- TCHAR *itemText = NULL;
+ char *itemText = NULL;
const TCHAR *lpNewItem;
UINT flags;
UINT itemID;
@@ -592,7 +586,7 @@ ReconfigureWindowsMenu(
if ((menuPtr->menuType == MENUBAR)
|| (menuPtr->menuFlags & MENU_SYSTEM_MENU)) {
Tcl_WinUtfToTChar(itemText, -1, &translatedText);
- lpNewItem = Tcl_DStringValue(&translatedText);
+ lpNewItem = (const TCHAR *) Tcl_DStringValue(&translatedText);
flags |= MF_STRING;
} else {
lpNewItem = (LPCTSTR) mePtr;
@@ -897,7 +891,7 @@ TkWinMenuProc(
LRESULT lResult;
if (!TkWinHandleMenuEvent(&hwnd, &message, &wParam, &lParam, &lResult)) {
- lResult = DefWindowProc(hwnd, message, wParam, lParam);
+ lResult = DefWindowProcA(hwnd, message, wParam, lParam);
}
return lResult;
}
@@ -995,7 +989,7 @@ TkWinEmbeddedMenuProc(
}
default:
- lResult = DefWindowProc(hwnd, message, wParam, lParam);
+ lResult = DefWindowProcA(hwnd, message, wParam, lParam);
break;
}
return lResult;
@@ -1626,7 +1620,7 @@ DrawWindowsSystemBitmap(
SelectObject(scratchDC, bitmap);
SetMapMode(scratchDC, GetMapMode(hdc));
- GetObject(bitmap, sizeof(BITMAP), &bm);
+ GetObjectA(bitmap, sizeof(BITMAP), &bm);
ptSize.x = bm.bmWidth;
ptSize.y = bm.bmHeight;
DPtoLP(scratchDC, &ptSize, 1);
@@ -2026,33 +2020,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 = MapVirtualKeyA(VK_LMENU, 0);
+ CallWindowProcA(DefWindowProcA, 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 = MapVirtualKeyA(VK_RMENU, 0);
+ CallWindowProcA(DefWindowProcA, 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 = MapVirtualKeyA(VK_F10, 0);
+ CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYDOWN, VK_F10, (int) (scanCode << 16));
break;
default:
virtualKey = XKeysymToKeycode(winPtr->display, keySym);
- scanCode = MapVirtualKey(virtualKey, 0);
+ scanCode = MapVirtualKeyA(virtualKey, 0);
if (0 != scanCode) {
XKeyEvent xkey = eventPtr->xkey;
- CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
+ CallWindowProcA(DefWindowProcA, 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,
+ CallWindowProcA(DefWindowProcA,
Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSCHAR,
xkey.trans_chars[i],
(int) ((scanCode << 16) | (1 << 29)));
@@ -2063,28 +2057,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 = MapVirtualKeyA(VK_LMENU, 0);
+ CallWindowProcA(DefWindowProcA, 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 = MapVirtualKeyA(VK_RMENU, 0);
+ CallWindowProcA(DefWindowProcA, 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 = MapVirtualKey(VK_F10, 0);
- CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
+ scanCode = MapVirtualKeyA(VK_F10, 0);
+ CallWindowProcA(DefWindowProcA, 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 = MapVirtualKeyA(virtualKey, 0);
if (0 != scanCode) {
- CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
+ CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYUP, virtualKey, (int) ((scanCode << 16)
| (1 << 29) | (1 << 30) | (1 << 31)));
}
@@ -3193,10 +3187,10 @@ SetDefaults(
HDC scratchDC;
int bold = 0;
int italic = 0;
- TEXTMETRIC tm;
+ TEXTMETRICA tm;
int pointSize;
HFONT menuFont;
- NONCLIENTMETRICS ncMetrics;
+ NONCLIENTMETRICSA ncMetrics;
/*
* Set all of the default options. The loop will terminate when we run out
@@ -3208,19 +3202,19 @@ SetDefaults(
defaultBorderWidth = GetSystemMetrics(SM_CYBORDER);
}
- scratchDC = CreateDC("DISPLAY", NULL, NULL, NULL);
+ scratchDC = CreateDCA("DISPLAY", NULL, NULL, NULL);
if (!firstTime) {
Tcl_DStringFree(&menuFontDString);
}
Tcl_DStringInit(&menuFontDString);
ncMetrics.cbSize = sizeof(ncMetrics);
- SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncMetrics),
+ SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, sizeof(ncMetrics),
&ncMetrics, 0);
- menuFont = CreateFontIndirect(&ncMetrics.lfMenuFont);
+ menuFont = CreateFontIndirectA(&ncMetrics.lfMenuFont);
SelectObject(scratchDC, menuFont);
- GetTextMetrics(scratchDC, &tm);
- GetTextFace(scratchDC, LF_FACESIZE, faceName);
+ GetTextMetricsA(scratchDC, &tm);
+ GetTextFaceA(scratchDC, LF_FACESIZE, faceName);
pointSize = MulDiv(tm.tmHeight - tm.tmInternalLeading,
72, GetDeviceCaps(scratchDC, LOGPIXELSY));
if (tm.tmWeight >= 700) {
@@ -3282,7 +3276,7 @@ SetDefaults(
showMenuAccelerators = TRUE;
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
- SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &showMenuAccelerators, 0);
+ SystemParametersInfoA(SPI_GETKEYBOARDCUES, 0, &showMenuAccelerators, 0);
}
}
@@ -3354,7 +3348,7 @@ TkpMenuThreadInit(void)
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- tsdPtr->menuHWND = CreateWindow(MENU_CLASS_NAME, "MenuWindow", WS_POPUP,
+ tsdPtr->menuHWND = CreateWindow(MENU_CLASS_NAME, TEXT("MenuWindow"), WS_POPUP,
0, 0, 10, 10, NULL, NULL, Tk_GetHINSTANCE(), NULL);
if (!tsdPtr->menuHWND) {
@@ -3362,7 +3356,7 @@ TkpMenuThreadInit(void)
}
tsdPtr->embeddedMenuHWND =
- CreateWindow(EMBEDDED_MENU_CLASS_NAME, "EmbeddedMenuWindow",
+ CreateWindow(EMBEDDED_MENU_CLASS_NAME, TEXT("EmbeddedMenuWindow"),
WS_POPUP, 0, 0, 10, 10, NULL, NULL, Tk_GetHINSTANCE(), NULL);
if (!tsdPtr->embeddedMenuHWND) {
diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c
index a7f6723..60ce7c2 100644
--- a/win/tkWinPixmap.c
+++ b/win/tkWinPixmap.c
@@ -9,15 +9,9 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinPixmap.c,v 1.11 2010/09/10 08:59:25 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinPixmap.c,v 1.12 2010/10/06 14:33:29 nijtmans Exp $
*/
-/* TODO: This file does not compile in UNICODE mode.
- * See [Freq 2965056]: Windows build with -DUNICODE
- */
-#undef UNICODE
-#undef _UNICODE
-
#include "tkWinInt.h"
/*
@@ -108,12 +102,12 @@ Tk_GetPixmap(
LPVOID lpMsgBuf;
repeatError = 1;
- if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ if (FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &lpMsgBuf, 0, NULL)) {
- MessageBox(NULL, (LPCTSTR) lpMsgBuf,
+ (LPSTR) &lpMsgBuf, 0, NULL)) {
+ MessageBoxA(NULL, (LPCSTR) lpMsgBuf,
"Tk_GetPixmap: Error from CreateDIBSection",
MB_OK | MB_ICONINFORMATION);
LocalFree(lpMsgBuf);
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index e074283..4a6b4f0 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -11,15 +11,9 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinTest.c,v 1.33 2010/09/10 08:59:27 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinTest.c,v 1.34 2010/10/06 14:33:30 nijtmans Exp $
*/
-/* TODO: This file does not compile in UNICODE mode.
- * See [Freq 2965056]: Windows build with -DUNICODE
- */
-#undef UNICODE
-#undef _UNICODE
-
#undef USE_TCL_STUBS
#define USE_TCL_STUBS
#undef USE_TK_STUBS
@@ -310,7 +304,7 @@ TestwineventCmd(
#endif
hwnd = (HWND) strtol(argv[1], &rest, 0);
if (rest == argv[1]) {
- hwnd = FindWindow(NULL, argv[1]);
+ hwnd = FindWindowA(NULL, argv[1]);
if (hwnd == NULL) {
Tcl_SetResult(interp, "no such window", TCL_STATIC);
return TCL_ERROR;
@@ -324,7 +318,7 @@ TestwineventCmd(
child = GetWindow(hwnd, GW_CHILD);
while (child != NULL) {
- SendMessage(child, WM_GETTEXT, (WPARAM) sizeof(buf), (LPARAM) buf);
+ SendMessageA(child, WM_GETTEXT, (WPARAM) sizeof(buf), (LPARAM) buf);
if (strcasecmp(buf, argv[2]) == 0) {
id = GetDlgCtrlID(child);
break;
@@ -353,7 +347,7 @@ TestwineventCmd(
Tcl_DString ds;
char buf[256];
- GetDlgItemText(hwnd, id, buf, 256);
+ GetDlgItemTextA(hwnd, id, buf, 256);
Tcl_ExternalToUtfDString(NULL, buf, -1, &ds);
Tcl_AppendResult(interp, Tcl_DStringValue(&ds), NULL);
Tcl_DStringFree(&ds);
@@ -363,7 +357,7 @@ TestwineventCmd(
Tcl_DString ds;
Tcl_UtfToExternalDString(NULL, argv[4], -1, &ds);
- SetDlgItemText(hwnd, id, Tcl_DStringValue(&ds));
+ SetDlgItemTextA(hwnd, id, Tcl_DStringValue(&ds));
Tcl_DStringFree(&ds);
break;
}
@@ -373,7 +367,7 @@ TestwineventCmd(
wParam = MAKEWPARAM(id, 0);
lParam = (LPARAM)child;
}
- sprintf(buf, "%d", (int) SendMessage(hwnd, message, wParam, lParam));
+ sprintf(buf, "%d", (int) SendMessageA(hwnd, message, wParam, lParam));
Tcl_SetResult(interp, buf, TCL_VOLATILE);
break;
}
@@ -381,7 +375,7 @@ TestwineventCmd(
char buf[TCL_INTEGER_SPACE];
sprintf(buf, "%d",
- (int) SendDlgItemMessage(hwnd, id, message, wParam, lParam));
+ (int) SendDlgItemMessageA(hwnd, id, message, wParam, lParam));
Tcl_SetResult(interp, buf, TCL_VOLATILE);
break;
}
@@ -462,8 +456,8 @@ TestgetwindowinfoObjCmd(
long hwnd;
Tcl_Obj *dictObj = NULL, *classObj = NULL, *textObj = NULL;
Tcl_Obj *childrenObj = NULL;
- char buf[512];
- int cch, cchBuf = tkTestWinProcs->useWide ? 256 : 512;
+ TCHAR buf[512];
+ int cch, cchBuf = 256;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "hwnd");
@@ -488,14 +482,10 @@ TestgetwindowinfoObjCmd(
dictObj = Tcl_NewDictObj();
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("class", 5), classObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2),
- Tcl_NewLongObj(GetWindowLong((HWND)hwnd, GWL_ID)));
+ Tcl_NewLongObj(GetWindowLongA((HWND)hwnd, GWL_ID)));
cch = tkTestWinProcs->getWindowText((HWND)hwnd, (LPTSTR)buf, cchBuf);
- if (tkTestWinProcs->useWide) {
- textObj = Tcl_NewUnicodeObj((LPCWSTR)buf, cch);
- } else {
- textObj = Tcl_NewStringObj((LPCSTR)buf, cch);
- }
+ textObj = Tcl_NewUnicodeObj((LPCWSTR)buf, cch);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("text", 4), textObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("parent", 6),
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 00b566c..a02e442 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinX.c,v 1.72 2010/10/05 14:48:34 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinX.c,v 1.73 2010/10/06 14:33:29 nijtmans Exp $
*/
#include "tkWinInt.h"
@@ -1540,7 +1540,6 @@ HandleIMEComposition(
{
HIMC hIMC;
int n;
- BOOL isWinNT = (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT);
if ((lParam & GCS_RESULTSTR) == 0) {
/*
@@ -1555,11 +1554,7 @@ HandleIMEComposition(
return 0;
}
- if (isWinNT) {
- n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
- } else {
- n = ImmGetCompositionStringA(hIMC, GCS_RESULTSTR, NULL, 0);
- }
+ n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
if (n > 0) {
char *buff = ckalloc((unsigned) n);
@@ -1567,35 +1562,7 @@ HandleIMEComposition(
XEvent event;
int i;
- if (isWinNT) {
- n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buff,
- (unsigned) n);
- } else {
- Tcl_DString utfString, unicodeString;
- Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding();
-
- n = ImmGetCompositionStringA(hIMC, GCS_RESULTSTR, buff,
- (unsigned) n);
- Tcl_DStringInit(&utfString);
- Tcl_ExternalToUtfDString(keyInputEncoding, buff, n, &utfString);
- Tcl_UtfToExternalDString(unicodeEncoding,
- Tcl_DStringValue(&utfString), -1, &unicodeString);
- i = Tcl_DStringLength(&unicodeString);
- if (n < i) {
- /*
- * Only alloc more space if we need, otherwise just use what
- * we've created. Don't realloc as that may copy data we no
- * longer need.
- */
-
- ckfree((char *) buff);
- buff = (char *) ckalloc((unsigned) i);
- }
- n = i;
- memcpy(buff, Tcl_DStringValue(&unicodeString), (unsigned) n);
- Tcl_DStringFree(&utfString);
- Tcl_DStringFree(&unicodeString);
- }
+ n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buff, (unsigned) n);
/*
* Set up the fields pertinent to key event.
@@ -1908,32 +1875,10 @@ long
Tk_GetUserInactiveTime(
Display *dpy) /* Ignored on Windows */
{
- struct tagLASTINPUTINFO {
- UINT cbSize;
- DWORD dwTime;
- } li;
-
- /*
- * Multiple settings of either of these variables should be OK; any thread
- * hazards should just cause inefficiency...
- */
+ LASTINPUTINFO li;
- static FARPROC pfnGetLastInputInfo = NULL;
- static int initinfo = 0;
-
- if (!initinfo) {
- HMODULE hMod = GetModuleHandleA("USER32.DLL");
-
- initinfo = 1;
- if (hMod){
- pfnGetLastInputInfo = GetProcAddress(hMod, "GetLastInputInfo");
- }
- }
- if (pfnGetLastInputInfo == NULL) {
- return -1;
- }
li.cbSize = sizeof(li);
- if (!(BOOL)(pfnGetLastInputInfo)(&li)) {
+ if (!(BOOL)GetLastInputInfo(&li)) {
return -1;
}