home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / x / volume13 / tvtwm / patch6 / patch.6
Text File  |  1991-07-05  |  16KB  |  588 lines

  1. tvtwm patch 6
  2.  
  3. The complete tar file includes a new utility called swmxlate.  It can
  4. be used to translate relative corrdinates into absolute coordinates.  One
  5. possible use would be:
  6.  
  7.     xterm -geom `swmxlate -geom +200+100`
  8.  
  9. This would position the xterm at location +200+100 relative to where the
  10. virtual desktop is currently positioned.
  11.  
  12.  
  13. This patch fixes the following problems:
  14.  
  15.  1.  Fixes "phantom window frame" problems.
  16.  2.  Bug fixes to window move cleanup.
  17.  3.  Added gridded movement in panner.  Try starting a pan operation and then
  18.      hold down the shift key. (Salvador Pinto Abreu spa@fct.unl.pt)
  19.  4.  Fixes the crash problem when multiple mouse buttons are pressed.
  20.  
  21.  
  22. diff -c old/events.c new/events.c
  23. *** old/events.c    Tue Apr 23 08:17:12 1991
  24. --- new/events.c    Wed Jun 12 09:06:08 1991
  25. ***************
  26. *** 33,38 ****
  27. --- 33,41 ----
  28.    * twm event handling
  29.    *
  30.    * $Log:    events.c,v $
  31. +  * Revision 10.0  91/06/12  09:05:31  toml
  32. +  * Revision bump
  33. +  * 
  34.    * Revision 9.0  91/04/23  07:40:32  toml
  35.    * Revision bump
  36.    * 
  37. diff -c old/icons.c new/icons.c
  38. *** old/icons.c    Tue Apr 23 08:17:13 1991
  39. --- new/icons.c    Wed Jun 12 09:06:09 1991
  40. ***************
  41. *** 26,31 ****
  42. --- 26,34 ----
  43.    * Icon releated routines
  44.    *
  45.    * $Log:    icons.c,v $
  46. +  * Revision 10.0  91/06/12  09:05:35  toml
  47. +  * Revision bump
  48. +  * 
  49.    * Revision 9.0  91/04/23  07:40:37  toml
  50.    * Revision bump
  51.    * 
  52. diff -c old/menus.c new/menus.c
  53. *** old/menus.c    Tue Apr 23 08:17:14 1991
  54. --- new/menus.c    Wed Jun 12 09:06:10 1991
  55. ***************
  56. *** 33,38 ****
  57. --- 33,44 ----
  58.    * twm menu code
  59.    *
  60.    * $Log:    menus.c,v $
  61. +  * Revision 10.0  91/06/12  09:05:38  toml
  62. +  * Revision bump
  63. +  * 
  64. +  * Revision 9.1  91/05/14  11:27:44  toml
  65. +  * Fixed crash problem and removed #include "malloc.h"
  66. +  * 
  67.    * Revision 9.0  91/04/23  07:40:40  toml
  68.    * Revision bump
  69.    * 
  70. ***************
  71. *** 94,100 ****
  72.   #include "vdt.h"
  73.   #include "add_window.h"
  74.   #include "patchlevel.h"
  75. - #include "malloc.h"
  76.   #include <X11/Xmu/CharSet.h>
  77.   
  78.   extern XEvent Event;
  79. --- 100,105 ----
  80. ***************
  81. *** 569,576 ****
  82.   
  83.       }
  84.   
  85. !     /* if we haven't recieved the enter notify yet, wait */
  86. !     if (ActiveMenu && !ActiveMenu->entered)
  87.           continue;
  88.   
  89.       done = FALSE;
  90. --- 574,581 ----
  91.   
  92.       }
  93.   
  94. !     /* if we haven't received the enter notify yet, wait */
  95. !     if (!ActiveMenu || !ActiveMenu->entered)
  96.           continue;
  97.   
  98.       done = FALSE;
  99. diff -c old/move.c new/move.c
  100. *** old/move.c    Tue Apr 23 08:17:15 1991
  101. --- new/move.c    Wed Jun 12 09:06:10 1991
  102. ***************
  103. *** 327,340 ****
  104.   
  105.       /* put up the initial outline if adding a window */
  106.       if (*first && adding)
  107. !     doMove(tmp_win, window, *x_root, *y_root, &xdest, &ydest);
  108.       
  109.       while (True) {
  110.       getPointer(outlineWindow, x_root, y_root, cancel, &done, first, adding, pulldown);
  111. !     if (done)
  112.           break;
  113.       if (!*cancel)
  114. !         doMove(tmp_win, window, *x_root, *y_root, &xdest, &ydest, panner);
  115.       }
  116.   
  117.       *x_root = xdest;
  118. --- 327,342 ----
  119.   
  120.       /* put up the initial outline if adding a window */
  121.       if (*first && adding)
  122. !     doMove(tmp_win, window, *x_root, *y_root, &xdest, &ydest, True);
  123.       
  124.       while (True) {
  125.       getPointer(outlineWindow, x_root, y_root, cancel, &done, first, adding, pulldown);
  126. !     if (done) {
  127. !         doMove(tmp_win, window, *x_root, *y_root, &xdest, &ydest, panner, False);
  128.           break;
  129. +     }
  130.       if (!*cancel)
  131. !         doMove(tmp_win, window, *x_root, *y_root, &xdest, &ydest, panner, True);
  132.       }
  133.   
  134.       *x_root = xdest;
  135. ***************
  136. *** 342,348 ****
  137.   }
  138.   
  139.   static void
  140. ! doMove(tmp_win, window, x_root, y_root, x_dest, y_dest, panner)
  141.   TwmWindow *tmp_win;
  142.   Window window;
  143.   int x_root;
  144. --- 344,350 ----
  145.   }
  146.   
  147.   static void
  148. ! doMove(tmp_win, window, x_root, y_root, x_dest, y_dest, panner, paint)
  149.   TwmWindow *tmp_win;
  150.   Window window;
  151.   int x_root;
  152. ***************
  153. *** 350,355 ****
  154. --- 352,358 ----
  155.   int *x_dest;
  156.   int *y_dest;
  157.   int panner;
  158. + int paint;
  159.   {
  160.       int xl, yt;
  161.       int deltax, deltay;
  162. ***************
  163. *** 385,422 ****
  164.           yt = vdty + Scr->MyDisplayHeight - dragHeight;
  165.       }
  166.   
  167. !     if (Scr->VirtualDesktop && Scr->OpaqueMove && !tmp_win->sticky) {
  168. !     if (panner == IN_PANNER) {
  169. !         if (window == tmp_win->virtualWindow) {
  170. !         actual = tmp_win->frame;
  171. !         virtual = tmp_win->virtualWindow;
  172.           }
  173. !         else {
  174. !         actual = tmp_win->icon_w;
  175. !         virtual = tmp_win->virtualIcon;
  176. !         }
  177. !     }
  178. !     else {
  179. !         if (window == tmp_win->frame) {
  180. !         actual = tmp_win->frame;
  181. !         virtual = tmp_win->virtualWindow;
  182. !         }
  183. !         else {
  184. !         actual = tmp_win->icon_w;
  185. !         virtual = tmp_win->virtualIcon;
  186. !         }
  187. !     }
  188. !     if (panner == IN_PANNER)
  189. !         XMoveWindow(dpy, actual, xl*Scr->PannerScale, yt*Scr->PannerScale);
  190. !     else
  191. !         XMoveWindow(dpy, virtual, xl/Scr->PannerScale, yt/Scr->PannerScale);
  192.       }
  193.   
  194. -     if (Scr->OpaqueMove)
  195. -     XMoveWindow(dpy, window, xl, yt);
  196. -     else
  197. -     MoveOutline(outlineWindow, xl, yt, dragWidth, dragHeight, 0, titleHeight);
  198.       *x_dest = xl;
  199.       *y_dest = yt;
  200.   }
  201. --- 388,427 ----
  202.           yt = vdty + Scr->MyDisplayHeight - dragHeight;
  203.       }
  204.   
  205. !     if (paint) {
  206. !         if (Scr->VirtualDesktop && Scr->OpaqueMove && !tmp_win->sticky) {
  207. !         if (panner == IN_PANNER) {
  208. !             if (window == tmp_win->virtualWindow) {
  209. !             actual = tmp_win->frame;
  210. !             virtual = tmp_win->virtualWindow;
  211. !             }
  212. !             else {
  213. !             actual = tmp_win->icon_w;
  214. !             virtual = tmp_win->virtualIcon;
  215. !             }
  216. !         }
  217. !         else {
  218. !             if (window == tmp_win->frame) {
  219. !             actual = tmp_win->frame;
  220. !             virtual = tmp_win->virtualWindow;
  221. !             }
  222. !             else {
  223. !             actual = tmp_win->icon_w;
  224. !             virtual = tmp_win->virtualIcon;
  225. !             }
  226. !         }
  227. !         if (panner == IN_PANNER)
  228. !             XMoveWindow(dpy, actual, xl*Scr->PannerScale, yt*Scr->PannerScale);
  229. !         else
  230. !             XMoveWindow(dpy, virtual, xl/Scr->PannerScale, yt/Scr->PannerScale);
  231.           }
  232. !         if (Scr->OpaqueMove)
  233. !         XMoveWindow(dpy, window, xl, yt);
  234. !         else
  235. !         MoveOutline(outlineWindow, xl, yt, dragWidth, dragHeight, 0, titleHeight);
  236.       }
  237.   
  238.       *x_dest = xl;
  239.       *y_dest = yt;
  240.   }
  241. ***************
  242. *** 434,439 ****
  243. --- 439,445 ----
  244.       Window junkChild;
  245.       int doingFine;
  246.       XEvent event,bakevent;
  247.       int xdest, ydest;
  248.       unsigned mask;
  249.       static int buttons;
  250. ***************
  251. *** 445,451 ****
  252.   
  253.       doingFine = True;
  254.       while (doingFine) {
  255. !     XNextEvent(dpy, &event);
  256.       switch (event.type) {
  257.           case ButtonPress:
  258.           if (pulldown) {
  259. --- 451,458 ----
  260.   
  261.       doingFine = True;
  262.       while (doingFine) {
  263. !     XMaskEvent(dpy, ButtonPressMask|ButtonReleaseMask|PointerMotionMask|
  264. !             EnterWindowMask|LeaveWindowMask|ExposureMask, &event);
  265.       switch (event.type) {
  266.           case ButtonPress:
  267.           if (pulldown) {
  268. ***************
  269. *** 534,543 ****
  270.               doingFine = False;
  271.           }
  272.           break;
  273. !           default: bakevent = Event;
  274. !                Event=event;
  275. !                DispatchEvent();
  276. !                Event=bakevent;
  277.       }
  278.       }
  279.   }
  280. --- 541,554 ----
  281.               doingFine = False;
  282.           }
  283.           break;
  284. !         /* handle other generic events here */
  285. !         case Expose:
  286. !         bakevent = Event;
  287. !         Event=event;
  288. !         DispatchEvent();
  289. !         Event=bakevent;
  290. !         break;
  291.       }
  292.       }
  293.   }
  294. diff -c old/patchlevel.h new/patchlevel.h
  295. *** old/patchlevel.h    Tue Apr 23 08:17:15 1991
  296. --- new/patchlevel.h    Wed Jun 12 09:06:10 1991
  297. ***************
  298. *** 1 ****
  299. ! #define PATCHLEVEL 5
  300. --- 1 ----
  301. ! #define PATCHLEVEL 6
  302. diff -c old/resize.c new/resize.c
  303. *** old/resize.c    Tue Apr 23 08:17:16 1991
  304. --- new/resize.c    Wed Jun 12 09:06:11 1991
  305. ***************
  306. *** 33,38 ****
  307. --- 33,41 ----
  308.    * window resizing borrowed from the "wm" window manager
  309.    *
  310.    * $Log:    resize.c,v $
  311. +  * Revision 10.0  91/06/12  09:05:43  toml
  312. +  * Revision bump
  313. +  * 
  314.    * Revision 9.0  91/04/23  07:40:45  toml
  315.    * Revision bump
  316.    * 
  317. diff -c old/tvtwm.man new/tvtwm.man
  318. *** old/tvtwm.man    Tue Apr 23 08:17:17 1991
  319. --- new/tvtwm.man    Wed Jun 12 09:06:12 1991
  320. ***************
  321. *** 717,723 ****
  322.   .IP "\fBPannerGeometry\fP \fIstring\fP" 8
  323.   This variable specifies the position of the Virtual Desktop panner.
  324.   The default geometry is "-0-0".
  325. ! .IP \"fBPannerOpaqueScroll\fP" 8
  326.   This variable causes the panner to scroll the Virtual Desktop
  327.   opaquely.  This variable only takes effect if the \fBStickyAbove\fP
  328.   variable is also set.
  329. --- 717,723 ----
  330.   .IP "\fBPannerGeometry\fP \fIstring\fP" 8
  331.   This variable specifies the position of the Virtual Desktop panner.
  332.   The default geometry is "-0-0".
  333. ! .IP "\fBPannerOpaqueScroll\fP" 8
  334.   This variable causes the panner to scroll the Virtual Desktop
  335.   opaquely.  This variable only takes effect if the \fBStickyAbove\fP
  336.   variable is also set.
  337. ***************
  338. *** 810,816 ****
  339.   is given, only those windows will be started iconic.  This is useful for
  340.   programs that do not support an \fI-iconic\fP command line option or
  341.   resource.
  342. ! .IP \"fBStayUpMenus" 8
  343.   This variable alters menu interaction.  By default, a menu item is selected
  344.   when a mouse button is released over it.  This variable causes menu itmes to
  345.   be selected on the next button press event.
  346. --- 810,816 ----
  347.   is given, only those windows will be started iconic.  This is useful for
  348.   programs that do not support an \fI-iconic\fP command line option or
  349.   resource.
  350. ! .IP "\fBStayUpMenus\fP" 8
  351.   This variable alters menu interaction.  By default, a menu item is selected
  352.   when a mouse button is released over it.  This variable causes menu itmes to
  353.   be selected on the next button press event.
  354. diff -c old/twm.c new/twm.c
  355. *** old/twm.c    Tue Apr 23 08:17:17 1991
  356. --- new/twm.c    Wed Jun 12 09:06:12 1991
  357. ***************
  358. *** 33,38 ****
  359. --- 33,41 ----
  360.    * twm - "Tom's Window Manager"
  361.    *
  362.    * $Log:    twm.c,v $
  363. +  * Revision 10.0  91/06/12  09:05:48  toml
  364. +  * Revision bump
  365. +  * 
  366.    * Revision 9.0  91/04/23  07:40:51  toml
  367.    * Revision bump
  368.    * 
  369. diff -c old/vdt.c new/vdt.c
  370. *** old/vdt.c    Tue Apr 23 08:17:17 1991
  371. --- new/vdt.c    Wed Jun 12 09:06:12 1991
  372. ***************
  373. *** 28,33 ****
  374. --- 28,39 ----
  375.    * $XConsortium: vdt.c,v 1.140 90/03/23 11:42:33 jim Exp $
  376.    *
  377.    * $Log:    vdt.c,v $
  378. +  * Revision 10.0  91/06/12  09:05:53  toml
  379. +  * Revision bump
  380. +  * 
  381. +  * Revision 9.1  91/06/12  08:39:24  toml
  382. +  * Added patch to do gridded movement in panner
  383. +  * 
  384.    * Revision 9.0  91/04/23  07:40:54  toml
  385.    * Revision bump
  386.    * 
  387. ***************
  388. *** 666,672 ****
  389. --- 672,681 ----
  390.       while (XCheckTypedWindowEvent (dpy, Scr->Panner, Expose, &dummy)) ;
  391.   }
  392.   
  393. + #define GridMask (ShiftMask | ControlMask | Mod1Mask | Mod2Mask)
  394.   static int pannerButton = 0;
  395. + static int use_grid = 0;
  396.   
  397.   void
  398.   HandlePannerButtonPress(ev)
  399. ***************
  400. *** 691,696 ****
  401. --- 700,707 ----
  402.   {
  403.       if (ev->xbutton.button == pannerButton) {
  404.       pannerButton = 0;
  405. +     use_grid = ev->xmotion.state & GridMask;
  406.       XDrawRectangle(dpy, Scr->Panner, Scr->DrawGC,
  407.           Scr->PannerOutlineX, Scr->PannerOutlineY,
  408.           Scr->PannerOutlineWidth, Scr->PannerOutlineHeight);
  409. ***************
  410. *** 699,709 ****
  411.           Scr->PannerOutlineX, Scr->PannerOutlineY,
  412.           Scr->PannerOutlineWidth, Scr->PannerOutlineHeight);
  413.   
  414. !     MoveDesktop(Scr->PannerOutlineX * Scr->PannerScale,
  415. !         Scr->PannerOutlineY * Scr->PannerScale);
  416.       }
  417.   }
  418.   
  419.   void
  420.   HandlePannerMotionNotify(ev)
  421.   XEvent *ev;
  422. --- 710,737 ----
  423.           Scr->PannerOutlineX, Scr->PannerOutlineY,
  424.           Scr->PannerOutlineWidth, Scr->PannerOutlineHeight);
  425.   
  426. !     if (use_grid) {
  427. !         int xx = Scr->PannerOutlineX * Scr->PannerScale;
  428. !         int yy = Scr->PannerOutlineY * Scr->PannerScale;
  429. !         xx = xx - xx % Scr->MyDisplayWidth;
  430. !         yy = yy - yy % Scr->MyDisplayHeight;
  431. !         MoveDesktop(xx, yy);
  432. !     }
  433. !     else {
  434. !         MoveDesktop(Scr->PannerOutlineX*Scr->PannerScale,
  435. !             Scr->PannerOutlineY*Scr->PannerScale);
  436. !     }
  437.       }
  438.   }
  439.   
  440. + static int TRUNCATE(pos, grid)
  441. +     int pos, grid;
  442. + {
  443. +     pos *= Scr->PannerScale;
  444. +     return ((pos - pos % grid) + Scr->PannerScale - 1) / Scr->PannerScale;
  445. + }
  446.   void
  447.   HandlePannerMotionNotify(ev)
  448.   XEvent *ev;
  449. ***************
  450. *** 712,751 ****
  451.       int deltaX, deltaY;
  452.       int newOutlineX, newOutlineY;
  453.   
  454. !     /* get rid of the last outline */
  455. !     XDrawRectangle(dpy, Scr->Panner, Scr->DrawGC,
  456. !     Scr->PannerOutlineX, Scr->PannerOutlineY,
  457. !     Scr->PannerOutlineWidth, Scr->PannerOutlineHeight);
  458.   
  459.       /* figure out the position of the next outline */
  460.       deltaX = ev->xmotion.x - pointerX;
  461.       deltaY = ev->xmotion.y - pointerY;
  462.   
  463. !     newOutlineX = Scr->PannerOutlineX + deltaX;
  464. !     newOutlineY = Scr->PannerOutlineY + deltaY;
  465.   
  466.       if (newOutlineX < 0)
  467.       newOutlineX = 0;
  468.       if (newOutlineY < 0)
  469.       newOutlineY = 0;
  470.       if ((newOutlineX + Scr->PannerOutlineWidth) >= Scr->PannerWidth)
  471.       newOutlineX = Scr->PannerWidth - Scr->PannerOutlineWidth - 1;
  472.       if ((newOutlineY + Scr->PannerOutlineHeight) >= Scr->PannerHeight)
  473.       newOutlineY = Scr->PannerHeight - Scr->PannerOutlineHeight - 1;
  474.   
  475. !     pointerX = ev->xmotion.x;
  476. !     pointerY = ev->xmotion.y;
  477. !     Scr->PannerOutlineX = newOutlineX;
  478. !     Scr->PannerOutlineY = newOutlineY;
  479.   
  480. !     /* draw the new outline */
  481. !     XDrawRectangle(dpy, Scr->Panner, Scr->DrawGC,
  482. !     Scr->PannerOutlineX, Scr->PannerOutlineY,
  483. !     Scr->PannerOutlineWidth, Scr->PannerOutlineHeight);
  484.       while(XCheckTypedEvent(dpy,MotionNotify,&dummyev));
  485. !     if (Scr->PannerOpaqueScroll && Scr->StickyAbove)
  486. !       MoveDesktop(Scr->PannerOutlineX*Scr->PannerScale,
  487. !           Scr->PannerOutlineY*Scr->PannerScale);
  488.   }
  489.   
  490.   
  491. --- 740,811 ----
  492.       int deltaX, deltaY;
  493.       int newOutlineX, newOutlineY;
  494.   
  495. !     use_grid = ev->xmotion.state & GridMask;
  496.   
  497.       /* figure out the position of the next outline */
  498.       deltaX = ev->xmotion.x - pointerX;
  499.       deltaY = ev->xmotion.y - pointerY;
  500.   
  501. !     if (use_grid) {
  502. !     newOutlineX = ev->xmotion.x;
  503. !     newOutlineY = ev->xmotion.y;
  504. !     }
  505. !     else {
  506. !     newOutlineX = Scr->PannerOutlineX + deltaX;
  507. !     newOutlineY = Scr->PannerOutlineY + deltaY;
  508. !     }
  509.   
  510.       if (newOutlineX < 0)
  511.       newOutlineX = 0;
  512.       if (newOutlineY < 0)
  513.       newOutlineY = 0;
  514. +     if (use_grid) {
  515. +     newOutlineX = TRUNCATE (newOutlineX, Scr->MyDisplayWidth);
  516. +     newOutlineY = TRUNCATE (newOutlineY, Scr->MyDisplayHeight);
  517. +     }
  518.       if ((newOutlineX + Scr->PannerOutlineWidth) >= Scr->PannerWidth)
  519.       newOutlineX = Scr->PannerWidth - Scr->PannerOutlineWidth - 1;
  520.       if ((newOutlineY + Scr->PannerOutlineHeight) >= Scr->PannerHeight)
  521.       newOutlineY = Scr->PannerHeight - Scr->PannerOutlineHeight - 1;
  522.   
  523. !     if (Scr->PannerOutlineX != newOutlineX ||
  524. !     Scr->PannerOutlineY != newOutlineY) {
  525. !     pointerX = ev->xmotion.x;
  526. !     pointerY = ev->xmotion.y;
  527.   
  528. !     /* get rid of the last outline */
  529. !     XDrawRectangle(dpy, Scr->Panner, Scr->DrawGC,
  530. !                Scr->PannerOutlineX, Scr->PannerOutlineY,
  531. !                Scr->PannerOutlineWidth, Scr->PannerOutlineHeight);
  532. !     Scr->PannerOutlineX = newOutlineX;
  533. !     Scr->PannerOutlineY = newOutlineY;
  534. !     /* draw the new outline */
  535. !     XDrawRectangle(dpy, Scr->Panner, Scr->DrawGC,
  536. !                Scr->PannerOutlineX, Scr->PannerOutlineY,
  537. !                Scr->PannerOutlineWidth, Scr->PannerOutlineHeight);
  538. !     }
  539.       while(XCheckTypedEvent(dpy,MotionNotify,&dummyev));
  540. !     
  541. !     if ((Scr->PannerOpaqueScroll && Scr->StickyAbove) ||
  542. !     (Scr->PannerOutlineX != newOutlineX ||
  543. !      Scr->PannerOutlineY != newOutlineY)) {
  544. !     if (use_grid) {
  545. !         int xx = Scr->PannerOutlineX * Scr->PannerScale;
  546. !         int yy = Scr->PannerOutlineY * Scr->PannerScale;
  547. !         xx = xx - xx % Scr->MyDisplayWidth;
  548. !         yy = yy - yy % Scr->MyDisplayHeight;
  549. !         MoveDesktop(xx, yy);
  550. !     }
  551. !     else {
  552. !         MoveDesktop(Scr->PannerOutlineX*Scr->PannerScale,
  553. !             Scr->PannerOutlineY*Scr->PannerScale);
  554. !     }
  555. !     }
  556.   }
  557.   
  558.   
  559. diff -c old/version.c new/version.c
  560. *** old/version.c    Tue Apr 23 08:17:18 1991
  561. --- new/version.c    Wed Jun 12 09:06:13 1991
  562. ***************
  563. *** 26,30 ****
  564.   /*****************************************************************************/
  565.   
  566.   /* char *Version = "MIT X Consortium, R4"; */
  567. ! char *Version = "$Revision: 9.0 $";
  568.   
  569. --- 26,30 ----
  570.   /*****************************************************************************/
  571.   
  572.   /* char *Version = "MIT X Consortium, R4"; */
  573. ! char *Version = "$Revision: 10.0 $";
  574.   
  575.