home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / tcl / 2148 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  7.1 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!sprite.Berkeley.EDU!ouster
  2. From: ouster@sprite.Berkeley.EDU (John Ousterhout)
  3. Newsgroups: comp.lang.tcl
  4. Subject: Re: New releases:  Tk 3.0 and Tcl 6.5
  5. Date: 18 Dec 1992 17:27:52 GMT
  6. Organization: U.C. Berkeley Sprite Project
  7. Lines: 203
  8. Distribution: world
  9. Message-ID: <1gt1moINN3lu@agate.berkeley.edu>
  10. References: <eillihca.92121806254921182@drizzle.Stanford.EDU>
  11. NNTP-Posting-Host: tyranny.berkeley.edu
  12.  
  13. In article <eillihca.92121806254921182@drizzle.Stanford.EDU>, eillihca@drizzle.StanFord.EDU ( Achille Hui, the Day Dreamer ) writes:
  14. |> ouster@sprite.Berkeley.EDU (John Ousterhout) writes: 
  15. |> 
  16. |> >
  17. |> >I have just released new versions of Tk and Tcl.  Tk 3.0 is a major
  18. |> >new release with several incompatibilities (hence the change in
  19. |> >major version number).  It doesn't have a lot of fancy new features
  20. |> >but includes many bug fixes and major structural improvements, such as
  21. |> 
  22. |> The following patch fixes two more bugs (a. never setting up the WM_CLASS
  23. |> property on a toplevel window. b. wish cores dump when you call wm without
  24. |> any argument) of Tk3.0 in tkWm.c. Also, the new restriction that a
  25. |> menubutton cannot "post" arbitary menus is a little bit annoying
  26. |> 
  27. |>                 -achille (eillihca@drizzle.stanford.edu)
  28. |> %%%%%%%%%%%%%% cut here %%%%%%%%%%%%%%%%%% cut here %%%%%%%%%%%%%%%%%%%%
  29. |> *** tkWm.c,dist Wed Dec 16 11:59:15 1992
  30. |> --- tkWm.c      Fri Dec 18 06:17:33 1992
  31. |> ***************
  32. |> *** 386,391 ****
  33. |> --- 386,392 ----
  34. |>         return;
  35. |>       }
  36. |>       if (wmPtr->flags & WM_NEVER_MAPPED) {
  37. |> +       wmPtr->flags &= ~WM_NEVER_MAPPED;
  38. |>         /*
  39. |>          * This is the first time this window has ever been mapped.
  40. |>          * Store all the window-manager-related information for the
  41. |> ***************
  42. |> *** 585,609 ****
  43. |>       char c;
  44. |>       int length;
  45. |>   
  46. |> !     c = argv[1][0];
  47. |> !     length = strlen(argv[1]);
  48. |> !     if ((c == 't') && (strncmp(argv[1], "tracing", length) == 0)
  49. |> !           && (length >= 3)) {
  50. |> !       if ((argc != 2) && (argc != 3)) {
  51. |> !           Tcl_AppendResult(interp, "wrong # arguments: must be \"",
  52. |> !                   argv[0], " tracing ?boolean?\"", (char *) NULL);
  53. |> !           return TCL_ERROR;
  54. |> !       }
  55. |>         if (argc == 2) {
  56. |>             interp->result = (wmTracing) ? "on" : "off";
  57. |>             return TCL_OK;
  58. |>         }
  59. |> !       return Tcl_GetBoolean(interp, argv[2], &wmTracing);
  60. |> !     }
  61. |> ! 
  62. |> !     if (argc < 3) {
  63. |>         Tcl_AppendResult(interp, "wrong # args: should be \"",
  64. |> !               argv[0], " option window ?arg ...?\"", (char *) NULL);
  65. |>         return TCL_ERROR;
  66. |>       }
  67. |>       winPtr = (TkWindow *) Tk_NameToWindow(interp, argv[2], tkwin);
  68. |> --- 586,611 ----
  69. |>       char c;
  70. |>       int length;
  71. |>   
  72. |> !     if(argc < 2){
  73. |> !       Tcl_AppendResult(interp, "wrong # args: should be \"",
  74. |> !               argv[0], " option window ?arg ...?\"", (char *) NULL);
  75. |> !       return TCL_ERROR;
  76. |> !     } else if(((c = argv[1][0]) == 't') &&
  77. |> !             (strncmp(argv[1],"tracing",length = strlen(argv[1])) == 0) &&
  78. |> !             (length >= 3)){
  79. |>         if (argc == 2) {
  80. |>             interp->result = (wmTracing) ? "on" : "off";
  81. |>             return TCL_OK;
  82. |> +       } else if(argc == 3){
  83. |> +           return Tcl_GetBoolean(interp, argv[2], &wmTracing);
  84. |> +       } else {
  85. |> +           Tcl_AppendResult(interp, "wrong # arguments: must be \"",
  86. |> +                   argv[0], " tracing ?boolean?\"", (char *) NULL);
  87. |> +           return TCL_ERROR;
  88. |>         }
  89. |> !     } else if (argc < 3) {
  90. |>         Tcl_AppendResult(interp, "wrong # args: should be \"",
  91. |> !           argv[0], " option window ?arg ...?\"", (char *) NULL);
  92. |>         return TCL_ERROR;
  93. |>       }
  94. |>       winPtr = (TkWindow *) Tk_NameToWindow(interp, argv[2], tkwin);
  95. |> 
  96.  
  97. This message is correct about the problems, but doesn't quite solve the
  98. WM_CLASS problem correctly (it introduces problems with other things).
  99. Here's my patch, which I believe fixes both problems correctly.
  100.  
  101. *** /tmp/,RCSt1281395    Fri Dec 18 09:27:05 1992
  102. --- tkWm.c    Fri Dec 18 09:22:56 1992
  103. ***************
  104. *** 206,211 ****
  105. --- 206,214 ----
  106.    * WM_VROOT_OFFSET_STALE -    non-zero means that (x,y) offset information
  107.    *                about the virtual root window is stale and
  108.    *                needs to be fetched fresh from the X server.
  109. +  * WM_ABOUT_TO_MAP -        non-zero means that the window is about to
  110. +  *                be mapped by TkWmMapWindow.  This is used
  111. +  *                by UpdateGeometryInfo to modify its behavior.
  112.    */
  113.   
  114.   #define WM_NEVER_MAPPED        1
  115. ***************
  116. *** 215,220 ****
  117. --- 218,224 ----
  118.   #define WM_UPDATE_SIZE_HINTS    0x10
  119.   #define WM_SYNC_PENDING        0x20
  120.   #define WM_VROOT_OFFSET_STALE    0x40
  121. + #define WM_ABOUT_TO_MAP        0x100
  122.   
  123.   /*
  124.    * This module keeps a list of all top-level windows, primarily to
  125. ***************
  126. *** 386,391 ****
  127. --- 390,397 ----
  128.       return;
  129.       }
  130.       if (wmPtr->flags & WM_NEVER_MAPPED) {
  131. +     wmPtr->flags &= ~WM_NEVER_MAPPED;
  132.       /*
  133.        * This is the first time this window has ever been mapped.
  134.        * Store all the window-manager-related information for the
  135. ***************
  136. *** 427,433 ****
  137. --- 433,441 ----
  138.           }
  139.       }
  140.       }
  141. +     wmPtr->flags |= WM_ABOUT_TO_MAP;
  142.       UpdateGeometryInfo((ClientData) winPtr);
  143. +     wmPtr->flags &= ~WM_ABOUT_TO_MAP;
  144.   
  145.       /*
  146.        * Map the window, wait to be sure that the window manager has
  147. ***************
  148. *** 435,441 ****
  149.        * if there were explicit positions asked for.
  150.        */
  151.   
  152. -     wmPtr->flags &= ~WM_NEVER_MAPPED;
  153.       XMapWindow(winPtr->display, winPtr->window);
  154.       savedX = wmPtr->x;
  155.       savedY = wmPtr->y;
  156. --- 443,448 ----
  157. ***************
  158. *** 585,590 ****
  159. --- 592,603 ----
  160.       char c;
  161.       int length;
  162.   
  163. +     if (argc < 2) {
  164. +     wrongNumArgs:
  165. +     Tcl_AppendResult(interp, "wrong # args: should be \"",
  166. +         argv[0], " option window ?arg ...?\"", (char *) NULL);
  167. +     return TCL_ERROR;
  168. +     }
  169.       c = argv[1][0];
  170.       length = strlen(argv[1]);
  171.       if ((c == 't') && (strncmp(argv[1], "tracing", length) == 0)
  172. ***************
  173. *** 602,610 ****
  174.       }
  175.   
  176.       if (argc < 3) {
  177. !     Tcl_AppendResult(interp, "wrong # args: should be \"",
  178. !         argv[0], " option window ?arg ...?\"", (char *) NULL);
  179. !     return TCL_ERROR;
  180.       }
  181.       winPtr = (TkWindow *) Tk_NameToWindow(interp, argv[2], tkwin);
  182.       if (winPtr == NULL) {
  183. --- 615,621 ----
  184.       }
  185.   
  186.       if (argc < 3) {
  187. !     goto wrongNumArgs;
  188.       }
  189.       winPtr = (TkWindow *) Tk_NameToWindow(interp, argv[2], tkwin);
  190.       if (winPtr == NULL) {
  191. ***************
  192. *** 1970,1976 ****
  193.       return;
  194.       }
  195.   
  196. !     if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
  197.       int savedX, savedY, savedFlags;
  198.   
  199.       savedX = wmPtr->x;
  200. --- 1981,1994 ----
  201.       return;
  202.       }
  203.   
  204. !     /*
  205. !      * Wait for the configure operation to complete, then verify that the
  206. !      * window was positioned where it was supposed to be and adjust it if
  207. !      * it wasn't.  Don't need to do this, however, if the window is about
  208. !      * to be mapped:  it will be taken care of elsewhere.
  209. !      */
  210. !     if (!(wmPtr->flags & WM_ABOUT_TO_MAP)) {
  211.       int savedX, savedY, savedFlags;
  212.   
  213.       savedX = wmPtr->x;
  214.