From 19c205379f4bd33606ed447a19d1040881f12020 Mon Sep 17 00:00:00 2001 From: mdejong Date: Sat, 10 Dec 2005 01:42:01 +0000 Subject: * win/tkWinWm.c (WinSetIcon): Don't check result of SetClassLong() or SetClassLongPtr() since it was generating an incorrect error and the MSDN docs indicate that the result need not be checked. --- ChangeLog | 8 ++++++++ win/tkWinWm.c | 49 ++++++++++++++++--------------------------------- 2 files changed, 24 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index eb0900c..2e6f6ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2005-12-09 Mo DeJong + * win/tkWinWm.c (WinSetIcon): Don't check result + of SetClassLong() or SetClassLongPtr() since + it was generating an incorrect error and + the MSDN docs indicate that the result need + not be checked. + +2005-12-09 Mo DeJong + * win/configure: Regen. * win/tcl.m4 (SC_CONFIG_CFLAGS): Define MACHINE for gcc builds. The lack of a definition of this diff --git a/win/tkWinWm.c b/win/tkWinWm.c index cb423b7..80df397 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.106 2005/12/02 13:42:29 dkf Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.107 2005/12/10 01:42:01 mdejong Exp $ */ #include "tkWinInt.h" @@ -1091,41 +1091,24 @@ WinSetIcon( } } else { ThreadSpecificData *tsdPtr; - - if ( -#ifdef _WIN64 - !SetClassLongPtr(hwnd, GCLP_HICONSM, - (LPARAM)GetIcon(titlebaricon, ICON_SMALL)) -#else - !SetClassLong(hwnd, GCL_HICONSM, - (LPARAM)GetIcon(titlebaricon, ICON_SMALL)) -#endif - ) { - /* - * For some reason this triggers, even though it seems to be - * successful. This is probably related to the WNDCLASS vs - * WNDCLASSEX difference. Anyway it seems we have to ignore - * errors returned here. - */ - - /* - Tcl_AppendResult(interp,"Unable to set new small icon",NULL); - return TCL_ERROR; - */ - } - - if ( + /* + * Don't check return result of SetClassLong() or + * SetClassLongPtr() since they return the previously + * set value which is zero on the initial call or in + * an error case. The MSDN documentation does not + * indicate that the result needs to be checked. + */ #ifdef _WIN64 - !SetClassLongPtr(hwnd, GCLP_HICON, - (LPARAM)GetIcon(titlebaricon, ICON_BIG)) + SetClassLongPtr(hwnd, GCLP_HICONSM, + (LPARAM)GetIcon(titlebaricon, ICON_SMALL)); + SetClassLongPtr(hwnd, GCLP_HICON, + (LPARAM)GetIcon(titlebaricon, ICON_BIG)); #else - !SetClassLong(hwnd, GCL_HICON, - (LPARAM)GetIcon(titlebaricon, ICON_BIG)) + SetClassLong(hwnd, GCL_HICONSM, + (LPARAM)GetIcon(titlebaricon, ICON_SMALL)); + SetClassLong(hwnd, GCL_HICON, + (LPARAM)GetIcon(titlebaricon, ICON_BIG)); #endif - ) { - Tcl_AppendResult(interp, "Unable to set new icon", NULL); - return TCL_ERROR; - } tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->iconPtr != NULL) { -- cgit v0.12