summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkImgPhInstance.c3
-rw-r--r--generic/tkImgPhoto.c50
-rw-r--r--generic/tkText.c12
-rw-r--r--generic/tkTextDisp.c9
-rw-r--r--generic/tkTextIndex.c2
-rw-r--r--generic/tkTextTag.c5
-rw-r--r--generic/tkWindow.c3
-rw-r--r--tests/imgPhoto.test17
-rw-r--r--win/tkWinClipboard.c11
-rw-r--r--win/tkWinFont.c41
-rw-r--r--win/tkWinMenu.c46
11 files changed, 100 insertions, 99 deletions
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c
index bd152f2..98aaeab 100644
--- a/generic/tkImgPhInstance.c
+++ b/generic/tkImgPhInstance.c
@@ -721,8 +721,7 @@ TkImgPhotoFree(
PhotoInstance *instancePtr = clientData;
ColorTable *colorPtr;
- instancePtr->refCount -= 1;
- if (instancePtr->refCount > 0) {
+ if (instancePtr->refCount-- > 1) {
return;
}
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 3e03f3d..1bd0142 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -409,7 +409,8 @@ ImgPhotoCmd(
Tk_PhotoImageBlock block;
Tk_Window tkwin;
Tk_PhotoImageFormat *imageFormat;
- int imageWidth, imageHeight, matched, length, oldformat = 0;
+ size_t length;
+ int imageWidth, imageHeight, matched, oldformat = 0;
Tcl_Channel chan;
Tk_PhotoHandle srcHandle;
ThreadSpecificData *tsdPtr =
@@ -446,12 +447,13 @@ ImgPhotoCmd(
Tcl_WrongNumArgs(interp, 2, objv, "option");
return TCL_ERROR;
}
- arg = Tcl_GetStringFromObj(objv[2], &length);
- if (strncmp(arg,"-data", (unsigned) length) == 0) {
+ arg = Tcl_GetString(objv[2]);
+ length = objv[2]->length;
+ if (strncmp(arg,"-data", length) == 0) {
if (masterPtr->dataString) {
Tcl_SetObjResult(interp, masterPtr->dataString);
}
- } else if (strncmp(arg,"-format", (unsigned) length) == 0) {
+ } else if (strncmp(arg,"-format", length) == 0) {
if (masterPtr->format) {
Tcl_SetObjResult(interp, masterPtr->format);
}
@@ -495,9 +497,10 @@ ImgPhotoCmd(
return TCL_OK;
} else if (objc == 3) {
- const char *arg = Tcl_GetStringFromObj(objv[2], &length);
+ const char *arg = Tcl_GetString(objv[2]);
- if (length > 1 && !strncmp(arg, "-data", (unsigned) length)) {
+ length = objv[2]->length;
+ if (length > 1 && !strncmp(arg, "-data", length)) {
Tcl_AppendResult(interp, "-data {} {} {}", NULL);
if (masterPtr->dataString) {
/*
@@ -511,7 +514,7 @@ ImgPhotoCmd(
}
return TCL_OK;
} else if (length > 1 &&
- !strncmp(arg, "-format", (unsigned) length)) {
+ !strncmp(arg, "-format", length)) {
Tcl_AppendResult(interp, "-format {} {} {}", NULL);
if (masterPtr->format) {
/*
@@ -1489,7 +1492,8 @@ ParseSubcommandOptions(
* TK_PHOTO_COMPOSITE_* constants. */
NULL
};
- int index, c, bit, currentBit, length;
+ size_t length;
+ int index, c, bit, currentBit;
int values[4], numValues, maxValues, argIndex;
const char *option, *expandedOption, *needed;
const char *const *listPtr;
@@ -1501,7 +1505,8 @@ ParseSubcommandOptions(
* optPtr->name.
*/
- expandedOption = option = Tcl_GetStringFromObj(objv[index], &length);
+ expandedOption = option = Tcl_GetString(objv[index]);
+ length = objv[index]->length;
if (option[0] != '-') {
if (optPtr->name == NULL) {
optPtr->name = objv[index];
@@ -1519,7 +1524,7 @@ ParseSubcommandOptions(
currentBit = 1;
for (listPtr = optionNames; *listPtr != NULL; ++listPtr) {
if ((c == *listPtr[0])
- && (strncmp(option, *listPtr, (size_t) length) == 0)) {
+ && (strncmp(option, *listPtr, length) == 0)) {
expandedOption = *listPtr;
if (bit != 0) {
goto unknownOrAmbiguousOption;
@@ -1535,7 +1540,11 @@ ParseSubcommandOptions(
*/
if (!(allowedOptions & bit)) {
- goto unknownOrAmbiguousOption;
+ if (optPtr->name != NULL) {
+ goto unknownOrAmbiguousOption;
+ }
+ optPtr->name = objv[index];
+ continue;
}
/*
@@ -1765,7 +1774,8 @@ ImgPhotoConfigureMaster(
const char *oldFileString, *oldPaletteString;
Tcl_Obj *oldData, *data = NULL, *oldFormat, *format = NULL;
Tcl_Obj *tempdata, *tempformat;
- int length, i, j, result, imageWidth, imageHeight, oldformat;
+ size_t length;
+ int i, j, result, imageWidth, imageHeight, oldformat;
double oldGamma;
Tcl_Channel chan;
Tk_PhotoImageFormat *imageFormat;
@@ -1773,10 +1783,11 @@ ImgPhotoConfigureMaster(
args = ckalloc((objc + 1) * sizeof(char *));
for (i = 0, j = 0; i < objc; i++,j++) {
- args[j] = Tcl_GetStringFromObj(objv[i], &length);
+ args[j] = Tcl_GetString(objv[i]);
+ length = objv[i]->length;
if ((length > 1) && (args[j][0] == '-')) {
if ((args[j][1] == 'd') &&
- !strncmp(args[j], "-data", (size_t) length)) {
+ !strncmp(args[j], "-data", length)) {
if (++i < objc) {
data = objv[i];
j--;
@@ -1789,7 +1800,7 @@ ImgPhotoConfigureMaster(
return TCL_ERROR;
}
} else if ((args[j][1] == 'f') &&
- !strncmp(args[j], "-format", (size_t) length)) {
+ !strncmp(args[j], "-format", length)) {
if (++i < objc) {
format = objv[i];
j--;
@@ -1852,9 +1863,10 @@ ImgPhotoConfigureMaster(
* Force into ByteArray format, which most (all) image handlers will
* use anyway. Empty length means ignore the -data option.
*/
+ int bytesize;
- (void) Tcl_GetByteArrayFromObj(data, &length);
- if (length) {
+ (void) Tcl_GetByteArrayFromObj(data, &bytesize);
+ if (bytesize) {
Tcl_IncrRefCount(data);
} else {
data = NULL;
@@ -1870,8 +1882,8 @@ ImgPhotoConfigureMaster(
* object.
*/
- (void) Tcl_GetStringFromObj(format, &length);
- if (length) {
+ (void) Tcl_GetString(format);
+ if (format->length) {
Tcl_IncrRefCount(format);
} else {
format = NULL;
diff --git a/generic/tkText.c b/generic/tkText.c
index 412a7f2..6ff1db9 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -1570,8 +1570,7 @@ TextWidgetObjCmd(
}
done:
- textPtr->refCount--;
- if (textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
return result;
@@ -1964,9 +1963,7 @@ DestroyText(
* portion of the text widget.
*/
- sharedTextPtr->refCount--;
-
- if (sharedTextPtr->refCount > 0) {
+ if (sharedTextPtr->refCount-- > 1) {
TkBTreeRemoveClient(sharedTextPtr->tree, textPtr);
/*
@@ -2042,13 +2039,12 @@ DestroyText(
}
textPtr->tkwin = NULL;
- textPtr->refCount--;
Tcl_DeleteCommandFromToken(textPtr->interp, textPtr->widgetCmd);
if (textPtr->afterSyncCmd){
Tcl_DecrRefCount(textPtr->afterSyncCmd);
textPtr->afterSyncCmd = NULL;
}
- if (textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
}
@@ -5526,7 +5522,7 @@ RunAfterSyncCmd(
* The widget has been deleted. Don't do anything.
*/
- if (--textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree((char *) textPtr);
}
return;
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index c271b4b..095bb5e 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -3005,7 +3005,7 @@ AsyncUpdateLineMetrics(
* The widget has been deleted, or is not mapped. Don't do anything.
*/
- if (--textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
return;
@@ -3080,8 +3080,7 @@ AsyncUpdateLineMetrics(
GenerateWidgetViewSyncEvent(textPtr, 1);
- textPtr->refCount--;
- if (textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
return;
@@ -4163,7 +4162,7 @@ DisplayText(
textPtr->refCount++;
dInfoPtr->flags &= ~REPICK_NEEDED;
TkTextPickCurrent(textPtr, &textPtr->pickEvent);
- if (--textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
goto end;
}
@@ -6753,7 +6752,7 @@ AsyncUpdateYScrollbar(
GetYView(textPtr->interp, textPtr, 1);
}
- if (--textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
}
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index d227bd8..faa1afd 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -87,7 +87,7 @@ FreeTextIndexInternalRep(
TkTextIndex *indexPtr = GET_TEXTINDEX(indexObjPtr);
if (indexPtr->textPtr != NULL) {
- if (--indexPtr->textPtr->refCount == 0) {
+ if (indexPtr->textPtr->refCount-- <= 1) {
/*
* The text widget has been deleted and we need to free it now.
*/
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index dd3127d..d9329f5 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.c
@@ -1258,8 +1258,7 @@ TkTextFreeTag(
if (textPtr != tagPtr->textPtr) {
Tcl_Panic("Tag being deleted from wrong widget");
}
- textPtr->refCount--;
- if (textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
tagPtr->textPtr = NULL;
@@ -1522,7 +1521,7 @@ TkTextBindProc(
}
done:
- if (--textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
}
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 5855b7c..20b4f20 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -1479,8 +1479,7 @@ Tk_DestroyWindow(
winPtr->mainPtr->deletionEpoch++;
}
- winPtr->mainPtr->refCount--;
- if (winPtr->mainPtr->refCount == 0) {
+ if (winPtr->mainPtr->refCount-- <= 1) {
register const TkCmd *cmdPtr;
/*
diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test
index e85f512..e93dab4 100644
--- a/tests/imgPhoto.test
+++ b/tests/imgPhoto.test
@@ -797,6 +797,23 @@ test imgPhoto-4.73 {ImgPhotoCmd procedure: copy with -compositingrule} -setup {
} -cleanup {
image delete photo1 photo2
} -result {0,2 1,1 2,0}
+test imgPhoto-4.74 {ImgPhotoCmd procedure: put option error handling} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{white}} -to 10 10 20 20 {{white}}
+} -cleanup {
+ image delete photo1
+} -returnCodes 1 -result {wrong # args: should be "photo1 put data ?-option value ...?"}
+test imgPhoto-4.75 {<photo> read command: filename starting with '-'} -constraints {
+ hasTeapotPhoto
+} -body {
+ file copy -force $teapotPhotoFile -teapotPhotoFile
+ image create photo photo1
+ photo1 read -teapotPhotoFile
+} -cleanup {
+ image delete photo1
+ file delete ./-teapotPhotoFile
+} -result {}
test imgPhoto-5.1 {ImgPhotoGet/Free procedures, shared instances} -constraints {
hasTeapotPhoto
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);
}
/*