diff options
author | hobbs <hobbs@noemail.net> | 2000-02-01 11:41:42 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 2000-02-01 11:41:42 (GMT) |
commit | 42692518238da97d086d6e862f6e5211cdbd9a91 (patch) | |
tree | 5aa30a90261ad40eb818a867dfa52d7455a6f388 /win | |
parent | 4826b8d28a8a78d636465f5de50c82173324bf88 (diff) | |
download | tk-42692518238da97d086d6e862f6e5211cdbd9a91.zip tk-42692518238da97d086d6e862f6e5211cdbd9a91.tar.gz tk-42692518238da97d086d6e862f6e5211cdbd9a91.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]
FossilOrigin-Name: 97a60a4857c1e41eedeefeffdb0f432156ccce64
Diffstat (limited to 'win')
-rw-r--r-- | win/Makefile.in | 33 | ||||
-rw-r--r-- | win/tkWinDialog.c | 51 | ||||
-rw-r--r-- | win/tkWinFont.c | 11 | ||||
-rw-r--r-- | win/tkWinPixmap.c | 48 | ||||
-rw-r--r-- | win/tkWinWm.c | 20 |
5 files changed, 104 insertions, 59 deletions
diff --git a/win/Makefile.in b/win/Makefile.in index f315df1..f0f412b 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -4,7 +4,7 @@ # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.16 1999/12/13 23:22:07 wart Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.17 2000/02/01 11:41:43 hobbs Exp $ TCLVERSION = @TCL_VERSION@ VERSION = @TK_VERSION@ @@ -381,7 +381,6 @@ install: all install-binaries install-libraries install-doc install-demos install-binaries: @for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \ do \ - echo " $$i"; \ if [ ! -d $$i ] ; then \ echo "Making directory $$i"; \ $(MKDIR) $$i; \ @@ -389,31 +388,29 @@ install-binaries: else true; \ fi; \ done; - @echo "Installing $(TK_LIB_FILE)" + @echo "Installing $(TK_LIB_FILE) to $(LIB_INSTALL_DIR)/" @$(INSTALL_DATA) $(TK_LIB_FILE) $(LIB_INSTALL_DIR)/$(TK_LIB_FILE) - @echo "Installing $(WISH)" + @echo "Installing $(WISH) as $(BIN_INSTALL_DIR)/wish$(VERSION)" @$(INSTALL_PROGRAM) $(WISH) $(BIN_INSTALL_DIR)/$(WISH) + @echo "Installing tkConfig.sh to $(LIB_INSTALL_DIR)/" + @$(INSTALL_DATA) tkConfig.sh $(LIB_INSTALL_DIR)/tkConfig.sh @if test "$(DLLSUFFIX)" != "" ; then \ - echo "Installing $(TK_DLL_FILE)" ; \ - $(INSTALL_PROGRAM) $(TK_DLL_FILE) \ - $(BIN_INSTALL_DIR)/$(TK_DLL_FILE) ; \ + echo "Installing $(TK_DLL_FILE) to $(LIB_INSTALL_DIR)/" ; \ + $(INSTALL_PROGRAM) $(TK_DLL_FILE) \ + $(BIN_INSTALL_DIR)/$(TK_DLL_FILE) ; \ fi @if test "$(TK_STUB_LIB_FILE)" != "" ; then \ if [ -f $(TK_STUB_LIB_FILE) ]; then \ - echo "Installing $(TK_STUB_LIB_FILE)"; \ + echo "Installing $(TK_STUB_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \ $(INSTALL_DATA) $(TK_STUB_LIB_FILE) \ $(LIB_INSTALL_DIR)/$(TK_STUB_LIB_FILE); \ fi; \ fi - echo "Installing tkConfig.sh" - $(INSTALL_DATA) tkConfig.sh $(LIB_INSTALL_DIR)/tkConfig.sh install-libraries: - @echo "Install Directories:" @for i in $(INSTALL_ROOT)$(prefix)/lib $(INCLUDE_INSTALL_DIR) \ $(SCRIPT_INSTALL_DIR) $(SCRIPT_INSTALL_DIR)/images; \ do \ - echo " $$i"; \ if [ ! -d $$i ] ; then \ echo "Making directory $$i"; \ $(MKDIR) $$i; \ @@ -421,32 +418,30 @@ install-libraries: else true; \ fi; \ done; + @echo "Installing header files"; @for i in $(GENERIC_DIR)/tk.h $(GENERIC_DIR)/tkDecls.h ; \ do \ - echo "Installing $$i"; \ $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR); \ done; + @echo "Installing library files to $(SCRIPT_INSTALL_DIR)"; @for i in $(ROOT_DIR)/library/*.tcl $(GENERIC_DIR)/prolog.ps \ $(ROOT_DIR)/library/tclIndex $(UNIX_DIR)/tkAppInit.c; \ do \ - echo "Installing $$i"; \ $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \ done; + @echo "Installing library images directory"; @for i in $(ROOT_DIR)/library/images/*; \ do \ if [ -f $$i ] ; then \ - echo "Installing $$i"; \ $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/images; \ fi; \ done; install-demos: - @echo "Install Directories:" @for i in $(INSTALL_ROOT)$(prefix)/lib $(SCRIPT_INSTALL_DIR) \ $(SCRIPT_INSTALL_DIR)/demos \ $(SCRIPT_INSTALL_DIR)/demos/images ; \ do \ - echo " $$i"; \ if [ ! -d $$i ] ; then \ echo "Making directory $$i"; \ $(MKDIR) $$i; \ @@ -454,10 +449,10 @@ install-demos: else true; \ fi; \ done; + @echo "Installing demos to $(SCRIPT_INSTALL_DIR)/demos/"; @for i in $(ROOT_DIR)/library/demos/*; \ do \ if [ -f $$i ] ; then \ - echo "Installing $$i"; \ sed -e '3 s|exec $(WISH)|exec $(WISH)|' \ $$i > $(SCRIPT_INSTALL_DIR)/demos/`basename $$i`; \ fi; \ @@ -466,10 +461,10 @@ install-demos: do \ chmod 755 $(SCRIPT_INSTALL_DIR)/demos/$$i; \ done; + @echo "Installing demo images"; @for i in $(ROOT_DIR)/library/demos/images/*; \ do \ if [ -f $$i ] ; then \ - echo "Installing $$i"; \ $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/demos/images; \ fi; \ done; 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); diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 74c9739..b00be43 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.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: tkWinFont.c,v 1.6 1999/12/16 21:59:35 hobbs Exp $ + * RCS: @(#) $Id: tkWinFont.c,v 1.7 2000/02/01 11:41:44 hobbs Exp $ */ #include "tkWinInt.h" @@ -1953,7 +1953,14 @@ GetScreenFont( Tcl_UtfToExternalDString(systemEncoding, faceName, -1, &ds); - if (platformId == VER_PLATFORM_WIN32_NT) { + /* + * We can only store up to LF_FACESIZE characters + */ + if (Tcl_DStringLength(&ds) >= LF_FACESIZE) { + Tcl_DStringSetLength(&ds, LF_FACESIZE); + } + + if (platformId == VER_PLATFORM_WIN32_NT) { Tcl_UniChar *src, *dst; src = (Tcl_UniChar *) Tcl_DStringValue(&ds); dst = (Tcl_UniChar *) lf.lfFaceName; diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c index ec09d89..75f820c 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.2 1998/09/14 18:24:01 stanton Exp $ + * RCS: @(#) $Id: tkWinPixmap.c,v 1.3 2000/02/01 11:41:44 hobbs Exp $ */ #include "tkWinInt.h" @@ -138,7 +138,7 @@ TkSetPixmapColormap(pixmap, colormap) * * Retrieve the geometry of the given drawable. Note that * this is a degenerate implementation that only returns the - * size of a pixmap. + * size of a pixmap or window. * * Results: * Returns 0. @@ -163,22 +163,36 @@ XGetGeometry(display, d, root_return, x_return, y_return, width_return, unsigned int* depth_return; { TkWinDrawable *twdPtr = (TkWinDrawable *)d; - HDC dc; - BITMAPINFO info; - if ((twdPtr->type != TWD_BITMAP) || (twdPtr->bitmap.handle == NULL)) { - panic("XGetGeometry: invalid pixmap"); - } - dc = GetDC(NULL); - info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - info.bmiHeader.biBitCount = 0; - if (!GetDIBits(dc, twdPtr->bitmap.handle, 0, 0, NULL, &info, - DIB_RGB_COLORS)) { - panic("XGetGeometry: unable to get bitmap size"); - } - ReleaseDC(NULL, dc); + if (twdPtr->type == TWD_BITMAP) { + HDC dc; + BITMAPINFO info; + + if (twdPtr->bitmap.handle == NULL) { + panic("XGetGeometry: invalid pixmap"); + } + dc = GetDC(NULL); + info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + info.bmiHeader.biBitCount = 0; + if (!GetDIBits(dc, twdPtr->bitmap.handle, 0, 0, NULL, &info, + DIB_RGB_COLORS)) { + panic("XGetGeometry: unable to get bitmap size"); + } + ReleaseDC(NULL, dc); - *width_return = info.bmiHeader.biWidth; - *height_return = info.bmiHeader.biHeight; + *width_return = info.bmiHeader.biWidth; + *height_return = info.bmiHeader.biHeight; + } else if (twdPtr->type == TWD_WINDOW) { + RECT rect; + + if (twdPtr->window.handle == NULL) { + panic("XGetGeometry: invalid window"); + } + GetClientRect(twdPtr->window.handle, &rect); + *width_return = rect.right - rect.left; + *height_return = rect.bottom - rect.top; + } else { + panic("XGetGeometry: invalid window"); + } return 1; } diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 4a8c547..e9a117a 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.19 2000/01/27 18:03:34 hobbs Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.20 2000/02/01 11:41:44 hobbs Exp $ */ #include "tkWinInt.h" @@ -184,7 +184,7 @@ typedef struct TkWmInfo { * pixels up from bottom of screen, rather than * down from top. * WM_UPDATE_SIZE_HINTS - non-zero means that new size hints need to be - * propagated to window manager. + * propagated to window manager. Not used on Win. * WM_SYNC_PENDING - set to non-zero while waiting for the window * manager to respond to some state change. * WM_MOVE_PENDING - non-zero means the application has requested @@ -815,6 +815,7 @@ UpdateWrapper(winPtr) SetMenu(oldWrapper, NULL); DestroyWindow(oldWrapper); } + wmPtr->flags &= ~WM_NEVER_MAPPED; SendMessage(wmPtr->wrapper, TK_ATTACHWINDOW, (WPARAM) child, 0); @@ -1054,8 +1055,8 @@ TkWmDeadWindow(winPtr) winPtr->dispPtr->firstWmPtr = wmPtr->nextPtr; } else { register WmInfo *prevPtr; - for (prevPtr = winPtr->dispPtr->firstWmPtr; ; prevPtr - = prevPtr->nextPtr) { + for (prevPtr = winPtr->dispPtr->firstWmPtr; ; + prevPtr = prevPtr->nextPtr) { if (prevPtr == NULL) { panic("couldn't unlink window in TkWmDeadWindow"); } @@ -1070,8 +1071,8 @@ TkWmDeadWindow(winPtr) * Reset all transient windows whose master is the dead window. */ - for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL; wmPtr2 - = wmPtr2->nextPtr) { + for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL; + wmPtr2 = wmPtr2->nextPtr) { if (wmPtr2->masterPtr == winPtr) { wmPtr2->masterPtr = NULL; if ((wmPtr2->wrapper != None) @@ -2268,7 +2269,7 @@ Tk_WmCmd(clientData, interp, argc, argv) } if (masterPtr == winPtr) { wmPtr->masterPtr = NULL; - } else { + } else if (masterPtr != wmPtr->masterPtr) { Tk_MakeWindowExist((Tk_Window)masterPtr); /* @@ -2639,11 +2640,6 @@ UpdateGeometryInfo(clientData) return; } - if (wmPtr->flags & WM_UPDATE_SIZE_HINTS) { - wmPtr->flags &= ~WM_UPDATE_SIZE_HINTS; - UpdateWrapper(winPtr); - } - /* * Compute the border size for the current window style. This * size will include the resize handles, the title bar and the |