summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-03-12 13:02:36 (GMT)
committernijtmans <nijtmans>2010-03-12 13:02:36 (GMT)
commit36115ec36c8767cb3043dbbd1846c108ab788e8a (patch)
treebb6ddc1254faf5843d0d0c100b1065c508dd0302 /win
parent94533b37310c2295093ae8d6f8849f99fd783c92 (diff)
downloadtk-36115ec36c8767cb3043dbbd1846c108ab788e8a.zip
tk-36115ec36c8767cb3043dbbd1846c108ab788e8a.tar.gz
tk-36115ec36c8767cb3043dbbd1846c108ab788e8a.tar.bz2
[Bug 2956548] TkpButtonSetDefaults only initializes one button type
Fix various gcc warnings, all backported from Tk 8.6 VC6++ does not have SPI_SETKEYBOARDCUES
Diffstat (limited to 'win')
-rw-r--r--win/.cvsignore4
-rw-r--r--win/tkWinButton.c59
-rw-r--r--win/tkWinEmbed.c37
-rw-r--r--win/tkWinInt.h5
-rw-r--r--win/tkWinMenu.c16
-rw-r--r--win/tkWinPixmap.c6
-rw-r--r--win/tkWinSend.c24
-rw-r--r--win/tkWinTest.c40
-rw-r--r--win/tkWinWm.c43
-rw-r--r--win/tkWinX.c23
10 files changed, 85 insertions, 172 deletions
diff --git a/win/.cvsignore b/win/.cvsignore
index 9a89827..88d4aac 100644
--- a/win/.cvsignore
+++ b/win/.cvsignore
@@ -15,3 +15,7 @@ tclConfig.sh
*.dll
wish.exe.manifest
.#*
+tkConfig.sh
+*.a
+autom4te.cache
+config.status
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index 706f2cc..4ed7574 100644
--- a/win/tkWinButton.c
+++ b/win/tkWinButton.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinButton.c,v 1.34.2.2 2009/11/02 04:52:40 mistachkin Exp $
+ * RCS: @(#) $Id: tkWinButton.c,v 1.34.2.3 2010/03/12 13:02:36 nijtmans Exp $
*/
#define OEMRESOURCE
@@ -71,7 +71,6 @@ typedef struct ThreadSpecificData {
LPSTR boxesBits; /* Pointer to bitmap data. */
DWORD boxHeight; /* Height of each sub-image. */
DWORD boxWidth; /* Width of each sub-image. */
- char defWidth[TCL_INTEGER_SPACE];
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -167,40 +166,6 @@ InitBoxes(void)
/*
*----------------------------------------------------------------------
*
- * ButtonDefaultsExitHandler --
- *
- * Frees the defaults for the buttons.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-ButtonDefaultsExitHandler(
- ClientData clientData) /* Points to an array of option specs,
- * terminated by one with type
- * TK_OPTION_END. */
-{
- Tk_OptionSpec *specPtr = (Tk_OptionSpec *)clientData;
-
- for ( ; specPtr->type != TK_OPTION_END; specPtr++) {
- if (specPtr->internalOffset == Tk_Offset(TkButton, borderWidth)) {
- if (specPtr->defValue != NULL) {
- ckfree((char *) specPtr->defValue);
- specPtr->defValue = NULL;
- }
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkpButtonSetDefaults --
*
* This procedure is invoked before option tables are created for
@@ -222,26 +187,10 @@ TkpButtonSetDefaults(
* terminated by one with type
* TK_OPTION_END. */
{
- int width;
- Tk_OptionSpec *savedSpecPtr = specPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
- if (tsdPtr->defWidth[0] == 0) {
- width = GetSystemMetrics(SM_CXEDGE);
- if (width == 0) {
- width = 1;
- }
- sprintf(tsdPtr->defWidth, "%d", width);
- }
- for ( ; specPtr->type != TK_OPTION_END; specPtr++) {
- if (specPtr->internalOffset == Tk_Offset(TkButton, borderWidth)) {
- char *defValue = (char *) ckalloc(strlen(tsdPtr->defWidth) + 1);
- strcpy(defValue, tsdPtr->defWidth);
- specPtr->defValue = defValue;
- }
+ int width = GetSystemMetrics(SM_CXEDGE);
+ if (width > 0) {
+ sprintf(tkDefButtonBorderWidth, "%d", width);
}
- TkCreateExitHandler(ButtonDefaultsExitHandler, (ClientData) savedSpecPtr);
}
/*
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c
index 63e837a..ceddc91 100644
--- a/win/tkWinEmbed.c
+++ b/win/tkWinEmbed.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinEmbed.c,v 1.33 2007/12/13 15:28:55 dgp Exp $
+ * RCS: @(#) $Id: tkWinEmbed.c,v 1.33.2.1 2010/03/12 13:02:36 nijtmans Exp $
*/
#include "tkWinInt.h"
@@ -45,8 +45,6 @@ static Tcl_ThreadDataKey dataKey;
static void ContainerEventProc(ClientData clientData,
XEvent *eventPtr);
-static void EmbeddedEventProc(ClientData clientData,
- XEvent *eventPtr);
static void EmbedGeometryRequest(Container *containerPtr,
int width, int height);
static void EmbedWindowDeleted(TkWindow *winPtr);
@@ -389,39 +387,6 @@ TkpMakeContainer(
ContainerEventProc, (ClientData) containerPtr);
}
-#if 0
-/*
- *----------------------------------------------------------------------
- *
- * EmbeddedEventProc --
- *
- * This procedure is invoked by the Tk event dispatcher when various
- * useful events are received for a window that is embedded in another
- * application.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Our internal state gets cleaned up when an embedded window is
- * destroyed.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-EmbeddedEventProc(
- ClientData clientData, /* Token for container window. */
- XEvent *eventPtr) /* ResizeRequest event. */
-{
- TkWindow *winPtr = (TkWindow *) clientData;
-
- if (eventPtr->type == DestroyNotify) {
- EmbedWindowDeleted(winPtr);
- }
-}
-#endif
-
/*
*----------------------------------------------------------------------
*
diff --git a/win/tkWinInt.h b/win/tkWinInt.h
index 813c145..6d20f96 100644
--- a/win/tkWinInt.h
+++ b/win/tkWinInt.h
@@ -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: tkWinInt.h,v 1.31.2.1 2009/12/02 22:20:02 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinInt.h,v 1.31.2.2 2010/03/12 13:02:36 nijtmans Exp $
*/
#ifndef _TKWININT
@@ -39,6 +39,9 @@
#ifndef WS_EX_TOOLWINDOW
#define WS_EX_TOOLWINDOW 0x00000080L
#endif
+#ifndef SPI_SETKEYBOARDCUES
+#define SPI_SETKEYBOARDCUES 0x100B
+#endif
/*
* The TkWinDCState is used to save the state of a device context so that it
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index 44f144e..5cd4b3f 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.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: tkWinMenu.c,v 1.59.2.5 2010/01/03 20:03:55 patthoyts Exp $
+ * RCS: @(#) $Id: tkWinMenu.c,v 1.59.2.6 2010/03/12 13:02:36 nijtmans Exp $
*/
#define WINVER 0x0500 /* Requires Windows 2K definitions */
@@ -2503,9 +2503,9 @@ TkpDrawMenuEntry(
int adjustedHeight = height - 2 * padY;
TkWinDrawable memWinDraw;
TkWinDCState dcState;
- HBITMAP oldBitmap;
+ HBITMAP oldBitmap = NULL;
Drawable d;
- HDC memDc, menuDc;
+ HDC memDc = NULL, menuDc = NULL;
/*
* If the menu entry includes an image then draw the entry into a
@@ -2977,8 +2977,7 @@ MenuSelectEvent(
TkMenu *menuPtr) /* the menu we have selected. */
{
XVirtualEvent event;
- POINTS rootPoint;
- DWORD msgPos;
+ union {DWORD msgpos; POINTS point;} root;
event.type = VirtualEvent;
event.serial = menuPtr->display->request;
@@ -2990,10 +2989,9 @@ MenuSelectEvent(
event.subwindow = None;
event.time = TkpGetMS();
- msgPos = GetMessagePos();
- rootPoint = MAKEPOINTS(msgPos);
- event.x_root = rootPoint.x;
- event.y_root = rootPoint.y;
+ root.msgpos = GetMessagePos();
+ event.x_root = root.point.x;
+ event.y_root = root.point.y;
event.state = TkWinGetModifierState();
event.same_screen = 1;
event.name = Tk_GetUid("MenuSelect");
diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c
index 6e3331e..5d1f54d 100644
--- a/win/tkWinPixmap.c
+++ b/win/tkWinPixmap.c
@@ -9,7 +9,7 @@
* 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.7.4.1 2009/04/30 13:48:00 dkf Exp $
+ * RCS: @(#) $Id: tkWinPixmap.c,v 1.7.4.2 2010/03/12 13:02:36 nijtmans Exp $
*/
#include "tkWinInt.h"
@@ -75,7 +75,7 @@ Tk_GetPixmap(
if (newTwdPtr->bitmap.handle == NULL) {
static int repeatError = 0;
- unsigned char *bits = NULL;
+ void *bits = NULL;
BITMAPINFO bitmapInfo;
HDC dc;
@@ -89,7 +89,7 @@ Tk_GetPixmap(
bitmapInfo.bmiHeader.biSizeImage = 0;
dc = GetDC(NULL);
newTwdPtr->bitmap.handle = CreateDIBSection(dc, &bitmapInfo,
- DIB_RGB_COLORS, (void **) &bits, 0, 0);
+ DIB_RGB_COLORS, &bits, 0, 0);
ReleaseDC(NULL, dc);
/*
diff --git a/win/tkWinSend.c b/win/tkWinSend.c
index 086d55e..c1f9193 100644
--- a/win/tkWinSend.c
+++ b/win/tkWinSend.c
@@ -10,12 +10,16 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinSend.c,v 1.15 2007/12/13 15:28:56 dgp Exp $
+ * RCS: @(#) $Id: tkWinSend.c,v 1.15.2.1 2010/03/12 13:02:36 nijtmans Exp $
*/
#include "tkInt.h"
#include "tkWinSendCom.h"
+#ifdef _MSC_VER
+#define vsnprintf _vsnprintf
+#endif
+
/*
* Should be defined in WTypes.h but mingw 1.0 is missing them.
*/
@@ -63,13 +67,17 @@ static Tcl_ThreadDataKey dataKey;
* Functions internal to this file.
*/
+#ifdef TK_SEND_ENABLED_ON_WINDOWS
static void CmdDeleteProc(ClientData clientData);
static void InterpDeleteProc(ClientData clientData,
Tcl_Interp *interp);
static void RevokeObjectRegistration(RegisteredInterp *riPtr);
+#endif
static HRESULT BuildMoniker(const char *name, LPMONIKER *pmk);
+#ifdef TK_SEND_ENABLED_ON_WINDOWS
static HRESULT RegisterInterp(const char *name,
RegisteredInterp *riPtr);
+#endif
static int FindInterpreterObject(Tcl_Interp *interp,
const char *name, LPDISPATCH *ppdisp);
static int Send(LPDISPATCH pdispInterp, Tcl_Interp *interp,
@@ -471,6 +479,7 @@ FindInterpreterObject(
*--------------------------------------------------------------
*/
+#ifdef TK_SEND_ENABLED_ON_WINDOWS
static void
CmdDeleteProc(
ClientData clientData)
@@ -550,6 +559,7 @@ RevokeObjectRegistration(
riPtr->name = NULL;
}
}
+#endif
/*
* ----------------------------------------------------------------------
@@ -568,6 +578,7 @@ RevokeObjectRegistration(
* ----------------------------------------------------------------------
*/
+#ifdef TK_SEND_ENABLED_ON_WINDOWS
static void
InterpDeleteProc(
ClientData clientData,
@@ -575,6 +586,7 @@ InterpDeleteProc(
{
CoUninitialize();
}
+#endif
/*
* ----------------------------------------------------------------------
@@ -638,6 +650,7 @@ BuildMoniker(
* ----------------------------------------------------------------------
*/
+#ifdef TK_SEND_ENABLED_ON_WINDOWS
static HRESULT
RegisterInterp(
const char *name,
@@ -694,6 +707,7 @@ RegisterInterp(
Tcl_DStringFree(&dString);
return hr;
}
+#endif
/*
* ----------------------------------------------------------------------
@@ -833,11 +847,11 @@ Win32ErrorObj(
if (lpBuffer == NULL) {
lpBuffer = sBuffer;
- wsprintf(sBuffer, _T("Error Code: %08lX"), hrError);
+ wsprintf(sBuffer, TEXT("Error Code: %08lX"), hrError);
}
- if ((p = _tcsrchr(lpBuffer, _T('\r'))) != NULL) {
- *p = _T('\0');
+ if ((p = _tcsrchr(lpBuffer, TEXT('\r'))) != NULL) {
+ *p = TEXT('\0');
}
#ifdef _UNICODE
@@ -1024,7 +1038,7 @@ SendTrace(
static char buffer[1024];
va_start(args, format);
- _vsnprintf(buffer, 1023, format, args);
+ vsnprintf(buffer, 1023, format, args);
OutputDebugString(buffer);
va_end(args);
}
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index 1131f8d..69d5a11 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -11,7 +11,7 @@
* 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.14.2.2 2009/11/13 23:32:05 patthoyts Exp $
+ * RCS: @(#) $Id: tkWinTest.c,v 1.14.2.3 2010/03/12 13:02:36 nijtmans Exp $
*/
#include "tkWinInt.h"
@@ -100,7 +100,7 @@ AppendSystemError(
DWORD error) /* Result code from error. */
{
int length;
- WCHAR *wMsgPtr;
+ WCHAR *wMsgPtr, **wMsgPtrPtr = &wMsgPtr;
char *msg;
char id[TCL_INTEGER_SPACE], msgBuf[24 + TCL_INTEGER_SPACE];
Tcl_DString ds;
@@ -108,7 +108,7 @@ AppendSystemError(
length = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, error,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *) &wMsgPtr,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *) wMsgPtrPtr,
0, NULL);
if (length == 0) {
char *msgPtr;
@@ -186,7 +186,6 @@ TestclipboardObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *CONST objv[]) /* Argument values. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
HGLOBAL handle;
char *data;
int code = TCL_OK;
@@ -276,16 +275,6 @@ TestwineventCmd(
return TCL_ERROR;
}
-#if 0
- TkpScanWindowId(interp, argv[1], &id);
- if (
-#ifdef _WIN64
- (sscanf(string, "0x%p", &number) != 1) &&
-#endif /* _WIN64 */
- Tcl_GetInt(interp, string, (int *)&number) != TCL_OK) {
- return TCL_ERROR;
- }
-#endif
hwnd = (HWND) strtol(argv[1], &rest, 0);
if (rest == argv[1]) {
hwnd = FindWindow(NULL, argv[1]);
@@ -354,7 +343,7 @@ TestwineventCmd(
wParam = MAKEWPARAM(id, 0);
lParam = (LPARAM)child;
}
- sprintf(buf, "%d", SendMessage(hwnd, message, wParam, lParam));
+ sprintf(buf, "%d", (int) SendMessage(hwnd, message, wParam, lParam));
Tcl_SetResult(interp, buf, TCL_VOLATILE);
break;
}
@@ -362,7 +351,7 @@ TestwineventCmd(
char buf[TCL_INTEGER_SPACE];
sprintf(buf, "%d",
- SendDlgItemMessage(hwnd, id, message, wParam, lParam));
+ (int) SendDlgItemMessage(hwnd, id, message, wParam, lParam));
Tcl_SetResult(interp, buf, TCL_VOLATILE);
break;
}
@@ -388,7 +377,6 @@ TestfindwindowObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *CONST objv[]) /* Argument values. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
const char *title = NULL, *class = NULL;
HWND hwnd = NULL;
int r = TCL_OK;
@@ -428,7 +416,7 @@ TestgetwindowinfoObjCmd(
int objc,
Tcl_Obj *CONST objv[])
{
- HWND hwnd = NULL;
+ long hwnd;
Tcl_Obj *resObj = NULL, *classObj = NULL, *textObj = NULL;
Tcl_Obj *childrenObj = NULL;
char buf[512];
@@ -439,14 +427,14 @@ TestgetwindowinfoObjCmd(
return TCL_ERROR;
}
- if (Tcl_GetLongFromObj(interp, objv[1], (long *)&hwnd) != TCL_OK)
+ if (Tcl_GetLongFromObj(interp, objv[1], &hwnd) != TCL_OK)
return TCL_ERROR;
if (tkWinProcs->useWide) {
- cch = GetClassNameW(hwnd, (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR));
+ cch = GetClassNameW((HWND)hwnd, (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR));
classObj = Tcl_NewUnicodeObj((LPWSTR)buf, cch);
} else {
- cch = GetClassNameA(hwnd, (LPSTR)buf, sizeof(buf));
+ cch = GetClassNameA((HWND)hwnd, (LPSTR)buf, sizeof(buf));
classObj = Tcl_NewStringObj((LPSTR)buf, cch);
}
if (cch == 0) {
@@ -461,9 +449,9 @@ TestgetwindowinfoObjCmd(
Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("id", -1));
Tcl_ListObjAppendElement(interp, resObj,
- Tcl_NewLongObj(GetWindowLong(hwnd, GWL_ID)));
+ Tcl_NewLongObj(GetWindowLong((HWND)hwnd, GWL_ID)));
- cch = tkWinProcs->getWindowText(hwnd, (LPTSTR)buf, cchBuf);
+ cch = tkWinProcs->getWindowText((HWND)hwnd, (LPTSTR)buf, cchBuf);
if (tkWinProcs->useWide) {
textObj = Tcl_NewUnicodeObj((LPCWSTR)buf, cch);
} else {
@@ -474,10 +462,10 @@ TestgetwindowinfoObjCmd(
Tcl_ListObjAppendElement(interp, resObj, textObj);
Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("parent", -1));
Tcl_ListObjAppendElement(interp, resObj,
- Tcl_NewLongObj((long)GetParent(hwnd)));
+ Tcl_NewLongObj((long)GetParent((HWND)hwnd)));
childrenObj = Tcl_NewListObj(0, NULL);
- EnumChildWindows(hwnd, EnumChildrenProc, (LPARAM)childrenObj);
+ EnumChildWindows((HWND)hwnd, EnumChildrenProc, (LPARAM)childrenObj);
Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("children", -1));
Tcl_ListObjAppendElement(interp, resObj, childrenObj);
@@ -492,8 +480,6 @@ TestwinlocaleObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
{
- Tk_Window tkwin = (Tk_Window) clientData;
-
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 8896b1a..5685ac0 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinWm.c,v 1.124.2.8 2009/11/22 23:28:36 patthoyts Exp $
+ * RCS: @(#) $Id: tkWinWm.c,v 1.124.2.9 2010/03/12 13:02:36 nijtmans Exp $
*/
#include "tkWinInt.h"
@@ -837,18 +837,19 @@ static int
ReadICOHeader(
Tcl_Channel channel)
{
- WORD Input;
- DWORD dwBytesRead;
+ union {
+ WORD word;
+ char bytes[sizeof(WORD)];
+ } input;
/*
* Read the 'reserved' WORD, which should be a zero word.
*/
- dwBytesRead = Tcl_Read(channel, (char*) &Input, sizeof(WORD));
- if (dwBytesRead != sizeof(WORD)) {
+ if (Tcl_Read(channel, input.bytes, sizeof(WORD)) != sizeof(WORD)) {
return -1;
}
- if (Input != 0) {
+ if (input.word != 0) {
return -1;
}
@@ -856,28 +857,21 @@ ReadICOHeader(
* Read the type WORD, which should be of type 1.
*/
- dwBytesRead = Tcl_Read(channel, (char*)&Input, sizeof(WORD));
- if (dwBytesRead != sizeof(WORD)) {
+ if (Tcl_Read(channel, input.bytes, sizeof(WORD)) != sizeof(WORD)) {
return -1;
}
- if (Input != 1) {
+ if (input.word != 1) {
return -1;
}
/*
- * Get the count of images
+ * Get and return the count of images.
*/
- dwBytesRead = Tcl_Read( channel, (char*)&Input, sizeof( WORD ));
- if (dwBytesRead != sizeof(WORD)) {
+ if (Tcl_Read(channel, input.bytes, sizeof(WORD)) != sizeof(WORD)) {
return -1;
}
-
- /*
- * Return the count
- */
-
- return (int)Input;
+ return (int) input.word;
}
/*
@@ -4320,7 +4314,8 @@ WmIconphotoCmd(
Tk_PhotoHandle photo;
Tk_PhotoImageBlock block;
int i, width, height, idx, bufferSize, startObj = 3;
- unsigned char *bgraPixelPtr, *bgraMaskPtr;
+ union {unsigned char *ptr; void *voidPtr;} bgraPixel;
+ void *bgraMaskPtr;
BlockOfIconImagesPtr lpIR;
WinIconPtr titlebaricon = NULL;
HICON hIcon;
@@ -4397,7 +4392,7 @@ WmIconphotoCmd(
bmInfo.bmiHeader.biCompression = BI_RGB;
iconInfo.hbmColor = CreateDIBSection( NULL, &bmInfo,
- DIB_RGB_COLORS, &bgraPixelPtr, NULL, 0 );
+ DIB_RGB_COLORS, &bgraPixel.voidPtr, NULL, 0 );
if ( !iconInfo.hbmColor ) {
ckfree((char *) lpIR);
Tcl_AppendResult(interp, "failed to create color bitmap for \"",
@@ -4410,10 +4405,10 @@ WmIconphotoCmd(
*/
bufferSize = height * width * 4;
for (idx = 0 ; idx < bufferSize ; idx += 4) {
- bgraPixelPtr[idx] = block.pixelPtr[idx+2];
- bgraPixelPtr[idx+1] = block.pixelPtr[idx+1];
- bgraPixelPtr[idx+2] = block.pixelPtr[idx+0];
- bgraPixelPtr[idx+3] = block.pixelPtr[idx+3];
+ bgraPixel.ptr[idx] = block.pixelPtr[idx+2];
+ bgraPixel.ptr[idx+1] = block.pixelPtr[idx+1];
+ bgraPixel.ptr[idx+2] = block.pixelPtr[idx+0];
+ bgraPixel.ptr[idx+3] = block.pixelPtr[idx+3];
}
/*
diff --git a/win/tkWinX.c b/win/tkWinX.c
index e603e4a..ff453d3 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.57.2.1 2010/01/02 10:43:26 dkf Exp $
+ * RCS: @(#) $Id: tkWinX.c,v 1.57.2.2 2010/03/12 13:02:36 nijtmans Exp $
*/
/*
@@ -298,7 +298,7 @@ TkWinXInit(
* Initialize input language info
*/
- if (GetLocaleInfo(LANGIDFROMLCID(GetKeyboardLayout(0)),
+ if (GetLocaleInfo(LANGIDFROMLCID((DWORD)GetKeyboardLayout(0)),
LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
(LPTSTR) &lpCP, sizeof(lpCP)/sizeof(TCHAR))
&& TranslateCharsetInfo((DWORD *)lpCP, &lpCs, TCI_SRCCODEPAGE)) {
@@ -405,7 +405,7 @@ TkWinGetPlatformId(void)
KEY_READ, &hKey) != ERROR_SUCCESS) {
tkWinTheme = TK_THEME_WIN_XP;
} else {
- RegQueryValueEx(hKey, szCurrent, NULL, NULL, pBuffer, &dwSize);
+ RegQueryValueEx(hKey, szCurrent, NULL, NULL, (LPBYTE) pBuffer, &dwSize);
RegCloseKey(hKey);
if (strcmp(pBuffer, "Windows Standard") == 0) {
tkWinTheme = TK_THEME_WIN_CLASSIC;
@@ -1002,10 +1002,11 @@ GenerateXEvent(
LPARAM lParam)
{
XEvent event;
- TkWindow *winPtr = (TkWindow *)Tk_HWNDToWindow(hwnd);
+ TkWindow *winPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ winPtr = (TkWindow *)Tk_HWNDToWindow(hwnd);
if (!winPtr || winPtr->window == None) {
return;
}
@@ -1118,17 +1119,15 @@ GenerateXEvent(
unsigned int state = GetState(message, wParam, lParam);
Time time = TkpGetMS();
POINT clientPoint;
- POINTS rootPoint; /* Note: POINT and POINTS are different */
- DWORD msgPos;
+ union {DWORD msgpos; POINTS point;} root; /* Note: POINT and POINTS are different */
/*
* Compute the screen and window coordinates of the event.
*/
- msgPos = GetMessagePos();
- rootPoint = MAKEPOINTS(msgPos);
- clientPoint.x = rootPoint.x;
- clientPoint.y = rootPoint.y;
+ root.msgpos = GetMessagePos();
+ clientPoint.x = root.point.x;
+ clientPoint.y = root.point.y;
ScreenToClient(hwnd, &clientPoint);
/*
@@ -1139,8 +1138,8 @@ GenerateXEvent(
event.xbutton.subwindow = None;
event.xbutton.x = clientPoint.x;
event.xbutton.y = clientPoint.y;
- event.xbutton.x_root = rootPoint.x;
- event.xbutton.y_root = rootPoint.y;
+ event.xbutton.x_root = root.point.x;
+ event.xbutton.y_root = root.point.y;
event.xbutton.state = state;
event.xbutton.time = time;
event.xbutton.same_screen = True;