diff options
-rw-r--r-- | unix/Makefile.in | 13 | ||||
-rw-r--r-- | unix/aclocal.m4 | 11 | ||||
-rw-r--r-- | unix/configure.in | 3 | ||||
-rw-r--r-- | unix/tkUnixWm.c | 138 |
4 files changed, 132 insertions, 33 deletions
diff --git a/unix/Makefile.in b/unix/Makefile.in index d0dda46..5a6dd22 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -5,7 +5,7 @@ # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.36 2000/01/06 02:22:44 hobbs Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.37 2000/01/12 11:46:05 hobbs Exp $ # Current Tk version; used in various names. @@ -437,7 +437,12 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) $(TK_BUILD_EXP_FILE) wish done; @echo "Installing $(TK_LIB_FILE)" chmod +x $(UNIX_DIR)/install-sh - chmod +x $(UNIX_DIR)/mkLinks + @if test ! -x $(UNIX_DIR)/install-sh; then \ + chmod +x $(UNIX_DIR)/install-sh; \ + fi + @if test ! -x $(UNIX_DIR)/mkLinks; then \ + chmod +x $(UNIX_DIR)/mkLinks; \ + fi @$(INSTALL_DATA) $(TK_LIB_FILE) $(LIB_INSTALL_DIR)/$(TK_LIB_FILE) @(cd $(LIB_INSTALL_DIR); $(RANLIB) $(TK_LIB_FILE)) @chmod 555 $(LIB_INSTALL_DIR)/$(TK_LIB_FILE) @@ -467,7 +472,9 @@ install-libraries: else true; \ fi; \ done; - chmod +x $(UNIX_DIR)/install-sh + @if test ! -x $(UNIX_DIR)/install-sh; then \ + chmod +x $(UNIX_DIR)/install-sh; \ + fi @for i in $(GENERIC_DIR)/tk.h $(GENERIC_DIR)/tkDecls.h ; \ do \ echo "Installing $$i"; \ diff --git a/unix/aclocal.m4 b/unix/aclocal.m4 index 1575806..9e7243d 100644 --- a/unix/aclocal.m4 +++ b/unix/aclocal.m4 @@ -1563,6 +1563,8 @@ AC_DEFUN(SC_TIME_HANDLER, [ # terminating character under some conditions. Check for this # and if the problem exists use a substitute procedure # "fixstrtod" (provided by Tcl) that corrects the error. +# Also, on Compaq's Tru64 Unix 5.0, +# strtod(" ") returns 0.0 instead of a failure to convert. # # Arguments: # none @@ -1582,12 +1584,17 @@ AC_DEFUN(SC_BUGGY_STRTOD, [ extern double strtod(); int main() { - char *string = "NaN"; + char *string = "NaN", *spaceString = " "; char *term; - strtod(string, &term); + double value; + value = strtod(string, &term); if ((term != string) && (term[-1] == 0)) { exit(1); } + value = strtod(string, &term); + if (term == (string+1)) { + exit(1); + } exit(0); }], tk_ok=1, tk_ok=0, tk_ok=0) if test "$tk_ok" = 1; then diff --git a/unix/configure.in b/unix/configure.in index da4382a..0b9e626 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tk installation dnl to configure the system for the local environment. AC_INIT(../generic/tk.h) -# RCS: @(#) $Id: configure.in,v 1.43 1999/12/21 23:56:33 hobbs Exp $ +# RCS: @(#) $Id: configure.in,v 1.44 2000/01/12 11:46:05 hobbs Exp $ TK_VERSION=8.3 TK_MAJOR_VERSION=8 @@ -379,6 +379,7 @@ else TK_BUILD_LIB_SPEC="-bI:`pwd`/${TK_BUILD_EXP_FILE}" TK_LIB_SPEC="-bI:${exec_prefix}/lib/${TK_EXP_FILE}" fi +TK_SHARED_BUILD=${SHARED_BUILD} #-------------------------------------------------------------------- # The statements below define various symbols relating to creating diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index b4ea55d..e9e1aa7 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.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: tkUnixWm.c,v 1.5 1999/12/21 23:56:34 hobbs Exp $ + * RCS: @(#) $Id: tkUnixWm.c,v 1.6 2000/01/12 11:46:05 hobbs Exp $ */ #include "tkPort.h" @@ -1538,7 +1538,7 @@ Tk_WmCmd(clientData, interp, argc, argv) goto updateGeom; } else if ((c == 'o') && (strncmp(argv[1], "overrideredirect", length) == 0)) { - int boolean; + int boolean, curValue; XSetWindowAttributes atts; if ((argc != 3) && (argc != 4)) { @@ -1547,24 +1547,27 @@ Tk_WmCmd(clientData, interp, argc, argv) (char *) NULL); return TCL_ERROR; } + curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect; if (argc == 3) { - if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) { - Tcl_SetResult(interp, "1", TCL_STATIC); - } else { - Tcl_SetResult(interp, "0", TCL_STATIC); - } + Tcl_SetBooleanObj(Tcl_GetObjResult(interp), curValue); return TCL_OK; } if (Tcl_GetBoolean(interp, argv[3], &boolean) != TCL_OK) { return TCL_ERROR; } - atts.override_redirect = (boolean) ? True : False; - Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, - &atts); - if (winPtr->wmInfoPtr->wrapperPtr != NULL) { - Tk_ChangeWindowAttributes( + if (curValue != boolean) { + /* + * Only do this if we are really changing value, because it + * causes some funky stuff to occur + */ + atts.override_redirect = (boolean) ? True : False; + Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, + &atts); + if (winPtr->wmInfoPtr->wrapperPtr != NULL) { + Tk_ChangeWindowAttributes( (Tk_Window) winPtr->wmInfoPtr->wrapperPtr, CWOverrideRedirect, &atts); + } } } else if ((c == 'p') && (strncmp(argv[1], "positionfrom", length) == 0) && (length >= 2)) { @@ -1741,21 +1744,95 @@ Tk_WmCmd(clientData, interp, argc, argv) goto updateGeom; } else if ((c == 's') && (strncmp(argv[1], "state", length) == 0) && (length >= 2)) { - if (argc != 3) { + if ((argc < 3) || (argc > 4)) { Tcl_AppendResult(interp, "wrong # arguments: must be \"", - argv[0], " state window\"", (char *) NULL); + argv[0], " state window ?state?\"", (char *) NULL); return TCL_ERROR; } - if (wmPtr->iconFor != NULL) { - Tcl_SetResult(interp, "icon", TCL_STATIC); - } else if (wmPtr->withdrawn) { - Tcl_SetResult(interp, "withdrawn", TCL_STATIC); - } else if (Tk_IsMapped((Tk_Window) winPtr) - || ((wmPtr->flags & WM_NEVER_MAPPED) - && (wmPtr->hints.initial_state == NormalState))) { - Tcl_SetResult(interp, "normal", TCL_STATIC); + if (argc == 4) { + if (wmPtr->iconFor != NULL) { + Tcl_AppendResult(interp, "can't change state of ", argv[2], + ": it is an icon for ", Tk_PathName(wmPtr->iconFor), + (char *) NULL); + return TCL_ERROR; + } + + c = argv[3][0]; + length = strlen(argv[3]); + + if ((c == 'n') && (strncmp(argv[3], "normal", length) == 0)) { + wmPtr->hints.initial_state = NormalState; + wmPtr->withdrawn = 0; + if (wmPtr->flags & WM_NEVER_MAPPED) { + return TCL_OK; + } + UpdateHints(winPtr); + Tk_MapWindow((Tk_Window) winPtr); + } else if ((c == 'i') + && (strncmp(argv[3], "iconic", length) == 0)) { + if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) { + Tcl_AppendResult(interp, "can't iconify \"", + winPtr->pathName, + "\": override-redirect flag is set", + (char *) NULL); + return TCL_ERROR; + } + if (wmPtr->master != None) { + Tcl_AppendResult(interp, "can't iconify \"", + winPtr->pathName, + "\": it is a transient", (char *) NULL); + return TCL_ERROR; + } + wmPtr->hints.initial_state = IconicState; + if (wmPtr->flags & WM_NEVER_MAPPED) { + return TCL_OK; + } + if (wmPtr->withdrawn) { + UpdateHints(winPtr); + Tk_MapWindow((Tk_Window) winPtr); + wmPtr->withdrawn = 0; + } else { + if (XIconifyWindow(winPtr->display, + wmPtr->wrapperPtr->window, + winPtr->screenNum) == 0) { + Tcl_SetResult(interp, "couldn't send iconify message to window manager", TCL_STATIC); + return TCL_ERROR; + } + WaitForMapNotify(winPtr, 0); + } + } else if ((c == 'w') + && (strncmp(argv[3], "withdrawn", length) == 0)) { + wmPtr->hints.initial_state = WithdrawnState; + wmPtr->withdrawn = 1; + if (wmPtr->flags & WM_NEVER_MAPPED) { + return TCL_OK; + } + if (XWithdrawWindow(winPtr->display, wmPtr->wrapperPtr->window, + winPtr->screenNum) == 0) { + Tcl_SetResult(interp, + "couldn't send withdraw message to window manager", + TCL_STATIC); + return TCL_ERROR; + } + WaitForMapNotify(winPtr, 0); + } else { + Tcl_AppendResult(interp, "bad argument \"", argv[3], + "\": must be normal, iconic or withdrawn", + (char *) NULL); + return TCL_ERROR; + } } else { - Tcl_SetResult(interp, "iconic", TCL_STATIC); + if (wmPtr->iconFor != NULL) { + Tcl_SetResult(interp, "icon", TCL_STATIC); + } else if (wmPtr->withdrawn) { + Tcl_SetResult(interp, "withdrawn", TCL_STATIC); + } else if (Tk_IsMapped((Tk_Window) winPtr) + || ((wmPtr->flags & WM_NEVER_MAPPED) + && (wmPtr->hints.initial_state == NormalState))) { + Tcl_SetResult(interp, "normal", TCL_STATIC); + } else { + Tcl_SetResult(interp, "iconic", TCL_STATIC); + } } } else if ((c == 't') && (strncmp(argv[1], "title", length) == 0) && (length >= 2)) { @@ -2074,6 +2151,7 @@ ConfigureEvent(wmPtr, configEventPtr) TkWindow *wrapperPtr = wmPtr->wrapperPtr; TkWindow *winPtr = wmPtr->winPtr; TkDisplay *dispPtr = wmPtr->winPtr->dispPtr; + Tk_ErrorHandler handler; /* * Update size information from the event. There are a couple of @@ -2201,12 +2279,15 @@ ConfigureEvent(wmPtr, configEventPtr) /* * Make sure that the toplevel and menubar are properly positioned within - * the wrapper. + * the wrapper. If the menuHeight happens to be zero, we'll get a + * BadValue X error that we want to ignore [Bug: 3377] */ - + handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1, + (Tk_ErrorProc *) NULL, (ClientData) NULL); XMoveResizeWindow(winPtr->display, winPtr->window, 0, wmPtr->menuHeight, (unsigned) wrapperPtr->changes.width, (unsigned) (wrapperPtr->changes.height - wmPtr->menuHeight)); + Tk_DeleteErrorHandler(handler); if ((wmPtr->menubar != NULL) && ((Tk_Width(wmPtr->menubar) != wrapperPtr->changes.width) || (Tk_Height(wmPtr->menubar) != wmPtr->menuHeight))) { @@ -3534,8 +3615,11 @@ Tk_CoordsToWindow(rootX, rootY, tkwin) while (1) { if (XTranslateCoordinates(Tk_Display(tkwin), parent, window, x, y, &childX, &childY, &child) == False) { - fprintf (stderr, "Tk_CoordsToWindow got False return from XTranslateCoordinates\n"); - fflush (stderr); + /* + * We can end up here when the window is in the middle of + * being deleted + */ + Tk_DeleteErrorHandler(handler); return NULL; } if (child == None) { |