diff options
author | hobbs <hobbs> | 2000-02-01 11:41:43 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2000-02-01 11:41:43 (GMT) |
commit | d029a3f0572fd461b639eadd8d469ff99d01c4b5 (patch) | |
tree | 5aa30a90261ad40eb818a867dfa52d7455a6f388 /win/tkWinDialog.c | |
parent | d9ef6f977a3ef1459bb388a5eb9d6ccdc1f8006b (diff) | |
download | tk-d029a3f0572fd461b639eadd8d469ff99d01c4b5.zip tk-d029a3f0572fd461b639eadd8d469ff99d01c4b5.tar.gz tk-d029a3f0572fd461b639eadd8d469ff99d01c4b5.tar.bz2 |
* win/Makefile.in (install-*): reduced verbosity of install
* win/tkWinPixmap.c (XGetGeometry): added support for windows in
XGetGeometry [Bug: 4069]
* win/tkWinFont.c (GetScreenFont): fixed possible mem overrun with
long font names [Bug: 4108]
* win/tkWinDialog.c: added EnableWindow calls to dialogs to
correct for possible loss of control in parent Tk toplevel
[Bug: 1212 et al]
Diffstat (limited to 'win/tkWinDialog.c')
-rw-r--r-- | win/tkWinDialog.c | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 20d4b58..b35c1ef 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.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: tkWinDialog.c,v 1.5 1999/04/21 21:53:32 rjohnson Exp $ + * RCS: @(#) $Id: tkWinDialog.c,v 1.6 2000/02/01 11:41:43 hobbs Exp $ * */ @@ -177,6 +177,7 @@ Tk_ChooseColorObjCmd(clientData, interp, objc, objv) Tcl_Obj *CONST objv[]; /* Argument objects. */ { Tk_Window tkwin, parent; + HWND hWnd; int i, oldMode, winCode; CHOOSECOLOR chooseColor; static inited = 0; @@ -206,11 +207,11 @@ Tk_ChooseColorObjCmd(clientData, interp, objc, objv) tkwin = (Tk_Window) clientData; parent = tkwin; - chooseColor.lStructSize = sizeof(CHOOSECOLOR) ; - chooseColor.hwndOwner = 0; - chooseColor.hInstance = 0; + chooseColor.lStructSize = sizeof(CHOOSECOLOR); + chooseColor.hwndOwner = NULL; + chooseColor.hInstance = NULL; chooseColor.rgbResult = oldColor; - chooseColor.lpCustColors = dwCustColors ; + chooseColor.lpCustColors = dwCustColors; chooseColor.Flags = CC_RGBINIT | CC_FULLOPEN | CC_ENABLEHOOK; chooseColor.lCustData = (LPARAM) NULL; chooseColor.lpfnHook = ColorDlgHookProc; @@ -263,13 +264,20 @@ Tk_ChooseColorObjCmd(clientData, interp, objc, objv) } Tk_MakeWindowExist(parent); - chooseColor.hwndOwner = Tk_GetHWND(Tk_WindowId(parent)); + chooseColor.hwndOwner = hWnd = Tk_GetHWND(Tk_WindowId(parent)); oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); winCode = ChooseColor(&chooseColor); (void) Tcl_SetServiceMode(oldMode); /* + * Ensure that hWnd is enabled, because it can happen that we + * have updated the wrapper of the parent, which causes us to + * leave this child disabled (Windows loses sync). + */ + EnableWindow(hWnd, 1); + + /* * Clear the interp result since anything may have happened during the * modal loop. */ @@ -436,6 +444,7 @@ GetFileName(clientData, interp, objc, objv, open) int result, winCode, oldMode, i; char *extension, *filter, *title; Tk_Window tkwin; + HWND hWnd; Tcl_DString utfFilterString, utfDirString; Tcl_DString extString, filterString, dirString, titleString; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) @@ -539,9 +548,10 @@ GetFileName(clientData, interp, objc, objv, open) } Tk_MakeWindowExist(tkwin); + hWnd = Tk_GetHWND(Tk_WindowId(tkwin)); ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = Tk_GetHWND(Tk_WindowId(tkwin)); + ofn.hwndOwner = hWnd; ofn.hInstance = (HINSTANCE) GetWindowLong(ofn.hwndOwner, GWL_HINSTANCE); ofn.lpstrFilter = NULL; @@ -616,6 +626,13 @@ GetFileName(clientData, interp, objc, objv, open) SetCurrentDirectory(savePath); /* + * Ensure that hWnd is enabled, because it can happen that we + * have updated the wrapper of the parent, which causes us to + * leave this child disabled (Windows loses sync). + */ + EnableWindow(hWnd, 1); + + /* * Clear the interp result since anything may have happened during the * modal loop. */ @@ -877,6 +894,7 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv) ChooseDir cd; int result, mustExist, code, mode, i; Tk_Window tkwin; + HWND hWnd; char *utfTitle; Tcl_DString utfDirString; Tcl_DString titleString, dirString; @@ -952,11 +970,12 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv) } Tk_MakeWindowExist(tkwin); + hWnd = Tk_GetHWND(Tk_WindowId(tkwin)); cd.interp = interp; ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = Tk_GetHWND(Tk_WindowId(tkwin)); + ofn.hwndOwner = hWnd; ofn.hInstance = (HINSTANCE) GetWindowLong(ofn.hwndOwner, GWL_HINSTANCE); ofn.lpstrFilter = NULL; @@ -1002,6 +1021,13 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv) Tcl_SetServiceMode(mode); SetCurrentDirectory(savePath); + /* + * Ensure that hWnd is enabled, because it can happen that we + * have updated the wrapper of the parent, which causes us to + * leave this child disabled (Windows loses sync). + */ + EnableWindow(hWnd, 1); + Tcl_ResetResult(interp); if (code != 0) { /* @@ -1398,7 +1424,7 @@ Tk_MessageBoxObjCmd(clientData, interp, objc, objv) } flags = buttonFlagMap[defaultBtnIdx]; } - + flags |= icon | type | MB_SYSTEMMODAL; Tcl_UtfToExternalDString(NULL, message, -1, &messageString); @@ -1409,6 +1435,13 @@ Tk_MessageBoxObjCmd(clientData, interp, objc, objv) Tcl_DStringValue(&titleString), flags); (void) Tcl_SetServiceMode(oldMode); + /* + * Ensure that hWnd is enabled, because it can happen that we + * have updated the wrapper of the parent, which causes us to + * leave this child disabled (Windows loses sync). + */ + EnableWindow(hWnd, 1); + Tcl_DStringFree(&messageString); Tcl_DStringFree(&titleString); |