home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume8 / vtwm.patch / part01 next >
Internet Message Format  |  1990-08-21  |  6KB

  1. Path: uunet!decwrl!wuarchive!cs.utexas.edu!sun-barr!newstop!sun!reef.cis.ufl.edu
  2. From: thoth@reef.cis.ufl.edu (Gilligan)
  3. Newsgroups: comp.sources.x
  4. Subject: v08i093: vtwm patch to allow "snug"ging of windows, Part01/01
  5. Message-ID: <141104@sun.Eng.Sun.COM>
  6. Date: 22 Aug 90 02:00:49 GMT
  7. Sender: news@sun.Eng.Sun.COM
  8. Lines: 206
  9. Approved: argv@sun.com
  10.  
  11. Submitted-by: thoth@reef.cis.ufl.edu (Gilligan)
  12. Posting-number: Volume 8, Issue 93
  13. Archive-name: vtwm.patch/part01
  14.  
  15. [ Note: since vtwm has not been posted to comp.sources.x, this is
  16.   an unofficial patch.  --dan ]
  17.  
  18.   Now that the stink over vtwm is gone we can all rush out and get it.
  19. The original source is on expo.lcs.mit.edu as contrib/vtwm.shar.Z.  I
  20. decided it lacked a little functionality.
  21.   This patch adds two functions: f.snugdesktop and f.snugwindow.
  22. Snugdesktop tries to move the virtual view that all windows that were
  23. partly visible will be completely visible.  Snugwindow tries to shift
  24. the display just far enough to squeeze that one window onto the
  25. screen.
  26.  
  27.   Tell me how you like it.
  28.   (Don't forget the formerly undocumented NailedDown list).
  29.  
  30.  
  31. diff -cw vtwm/README.vtwm vtwmnew/README.vtwm
  32. *** vtwm/README.vtwm    Sun Aug 12 11:15:07 1990
  33. --- vtwmnew/README.vtwm    Sun Aug 12 11:26:13 1990
  34. ***************
  35. *** 8,13 ****
  36. --- 8,23 ----
  37.   Variables:
  38.   ----------
  39.   
  40. + NailedDown { list }
  41. +     (Forsman) I didn't write this and it wasn't documented, but I
  42. +     think it gives a list of windows that will be nailed down
  43. +     automatically.  I strongly suggest
  44. +     NailedDown {
  45. +       "Virtual Desktop"
  46. +       "TWM Icon Manager"
  47. +     }
  48. +     It works for me.
  49.   VirtualDesktop "geometry" scale
  50.       where to place the virtual desktop window and its size.
  51.       scale specifies the scaling of the window compared to the desktop.
  52. ***************
  53. *** 68,73 ****
  54. --- 78,91 ----
  55.   f.resetdesktop
  56.       Moves the real display to (0,0)
  57.   
  58. + (Forsman added 2)
  59. + f.snugwindow
  60. +     moves the display to try to fit the selected window completely
  61. +     on the screen
  62. + f.snugdesktop
  63. +     moves the display to try to fit all partially visible windows
  64. +     completely on the screen.
  65.   
  66.   Others:
  67.   -------
  68. diff -cw vtwm/menus.c vtwmnew/menus.c
  69. *** vtwm/menus.c    Sun Aug 12 11:15:31 1990
  70. --- vtwmnew/menus.c    Sun Aug 12 11:27:43 1990
  71. ***************
  72. *** 1954,1959 ****
  73. --- 1954,2046 ----
  74.       SetRealScreen(0, 0);
  75.       break;
  76.   
  77. +     /* Robert Forsman added these two functions
  78. +        <thoth@ufl.edu>
  79. +        */
  80. +     {
  81. +       TwmWindow    *scan;
  82. +       int        right, left, up, down;
  83. +       int        inited;
  84. +    case F_SNUGDESKTOP:
  85. +       inited = 0;
  86. +       for (scan = Scr->TwmRoot.next; scan!=NULL; scan = scan->next)
  87. +         {
  88. +           if (scan->nailed)
  89. +         continue;
  90. +           if (scan->frame_x > Scr->MyDisplayWidth ||
  91. +           scan->frame_y > Scr->MyDisplayHeight)
  92. +         continue;
  93. +           if (scan->frame_x+scan->frame_width < 0 ||
  94. +           scan->frame_y+scan->frame_height < 0)
  95. +         continue;
  96. +           if ( inited==0 || scan->frame_x<right )
  97. +         right = scan->frame_x;
  98. +           if ( inited==0 || scan->frame_y<up )
  99. +         up = scan->frame_y;
  100. +           if ( inited==0 || scan->frame_x+scan->frame_width>left )
  101. +         left = scan->frame_x+scan->frame_width;
  102. +           if ( inited==0 || scan->frame_y+scan->frame_height>down )
  103. +         down = scan->frame_y+scan->frame_height;
  104. +           inited = 1;
  105. +         }
  106. +       if (inited)
  107. +         {
  108. +           int    dx,dy;
  109. +           if (left-right < Scr->MyDisplayWidth && (right<0 || left>Scr->MyDisplayWidth) )
  110. +         dx = right - ( Scr->MyDisplayWidth - (left-right) ) /2;
  111. +           else
  112. +         dx = 0;
  113. +           if (down-up < Scr->MyDisplayHeight && (up<0 || down>Scr->MyDisplayHeight) )
  114. +         dy = up - (Scr->MyDisplayHeight - (down-up) ) /2;
  115. +           else
  116. +         dy = 0;
  117. +           if (dx!=0 || dy!=0)
  118. +         PanRealScreen(dx,dy);
  119. +           else
  120. +         XBell (dpy, 0);
  121. +         }
  122. +       else
  123. +         XBell (dpy, 0);
  124. +       break;
  125. +     case F_SNUGWINDOW:
  126. +       if (DeferExecution(context, func, Scr->SelectCursor))
  127. +         return TRUE;
  128. +       inited = 0;
  129. +       right = tmp_win->frame_x;
  130. +       left = tmp_win->frame_x + tmp_win->frame_width;
  131. +       up = tmp_win->frame_y;
  132. +       down = tmp_win->frame_y + tmp_win->frame_height;
  133. +       inited = 1;
  134. +       if (inited)
  135. +         {
  136. +           int    dx,dy;
  137. +           dx = 0;
  138. +           if (left-right < Scr->MyDisplayWidth)
  139. +         if (right<0)
  140. +           dx = right;
  141. +         else if (left>Scr->MyDisplayWidth)
  142. +           dx = left - Scr->MyDisplayWidth;
  143. +           dy = 0;
  144. +           if (down-up < Scr->MyDisplayHeight)
  145. +         if (up<0)
  146. +           dy = up;
  147. +         else if (down>Scr->MyDisplayHeight)
  148. +           dy = down - Scr->MyDisplayHeight;
  149. +           if (dx!=0 || dy!=0)
  150. +         PanRealScreen(dx,dy);
  151. +           else
  152. +         XBell (dpy, 0);
  153. +         }
  154. +       else
  155. +         XBell (dpy, 0);
  156. +     }
  157. +     break;
  158.       /* move the real screen representation around the virtual desktop display */
  159.      case F_MOVESCREEN:
  160.       /* this breaks BADLY if this is not called by the default button press
  161. ***************
  162. *** 2066,2071 ****
  163. --- 2153,2159 ----
  164.           case F_BOTTOMZOOM:
  165.       case F_AUTORAISE:
  166.       case F_NAIL:
  167. +     case F_SNUGWINDOW:
  168.           return TRUE;
  169.       }
  170.       }
  171. diff -cw vtwm/parse.c vtwmnew/parse.c
  172. *** vtwm/parse.c    Sun Aug 12 11:15:34 1990
  173. --- vtwmnew/parse.c    Sat Aug 11 23:33:47 1990
  174. ***************
  175. *** 452,457 ****
  176. --- 452,459 ----
  177.       { "f.rightzoom",        FKEYWORD, F_RIGHTZOOM },
  178.       { "f.saveyourself",        FKEYWORD, F_SAVEYOURSELF },
  179.       { "f.showiconmgr",        FKEYWORD, F_SHOWLIST },
  180. +     { "f.snugdesktop",        FKEYWORD, F_SNUGDESKTOP },
  181. +     { "f.snugwindow",        FKEYWORD, F_SNUGWINDOW },
  182.       { "f.sorticonmgr",        FKEYWORD, F_SORTICONMGR },
  183.       { "f.source",        FSKEYWORD, F_BEEP },  /* XXX - don't work */
  184.       { "f.title",        FKEYWORD, F_TITLE },
  185. diff -cw vtwm/parse.h vtwmnew/parse.h
  186. *** vtwm/parse.h    Sun Aug 12 11:15:35 1990
  187. --- vtwmnew/parse.h    Sat Aug 11 23:29:57 1990
  188. ***************
  189. *** 97,102 ****
  190. --- 97,104 ----
  191.   #define F_PANUP                 50
  192.   #define F_RESETDESKTOP          51
  193.   #define F_MOVESCREEN            52
  194. + #define F_SNUGDESKTOP        53
  195. + #define F_SNUGWINDOW        54
  196.   
  197.   #define F_MENU            101    /* string */
  198.   #define F_WARPTO        102    /* string */
  199. --
  200. /--------------------
  201. "a window is a terrible thing to paste" -me
  202. ( My name's not really Gilligan, It's Robert Forsman, without an `e' )
  203. --------------------/
  204.  
  205. dan
  206. ----------------------------------------------------
  207. O'Reilly && Associates   argv@sun.com / argv@ora.com
  208. Opinions expressed reflect those of the author only.
  209.