rwhitby@austek.oz.au (Rod Whitby) (08/15/90)
Here is a patch to twm (and also vtwm) to ensure that user-positioned windows cannot be placed off the screen when DontMoveOff is set. When the user interactively positions a new window it is possible to place the window off the screen even though the DontMoveOff option is set. This patch confines the placement of new windows to the screen boundaries in the same way that f.move does. I have submitted this patch to xbugs for possible inclusion in a future version of TWM, and to Dave Edmonson <dme@doc.ic.ac.uk> for possible inclusion in a future version of VTWM. Whether the current behaviour is a bug or a feature is uncertain. IMHO, if I enable DontMoveOff, then my windows should never be allowed to cross the screen boundaries (unless I use f.forcemove). *** add_window.c~ Sun Aug 12 14:31:05 1990 --- add_window.c Mon Aug 13 19:10:25 1990 *************** *** 417,422 **** --- 417,440 ---- XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild, &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask); + if (Scr->DontMoveOff) + { + int AddingR, AddingB; + + AddingR = AddingX + AddingW; + AddingB = AddingY + AddingH; + + if (AddingX < 0) + AddingX = 0; + if (AddingR > Scr->MyDisplayWidth) + AddingX = Scr->MyDisplayWidth - AddingW; + + if (AddingY < 0) + AddingY = 0; + if (AddingB > Scr->MyDisplayHeight) + AddingY = Scr->MyDisplayHeight - AddingH; + } + MoveOutline(Scr->Root, AddingX, AddingY, AddingW, AddingH, tmp_win->frame_bw, tmp_win->title_height); *************** *** 424,429 **** --- 442,465 ---- { AddingX = event.xbutton.x_root; AddingY = event.xbutton.y_root; + + if (Scr->DontMoveOff) + { + int AddingR, AddingB; + + AddingR = AddingX + AddingW; + AddingB = AddingY + AddingH; + + if (AddingX < 0) + AddingX = 0; + if (AddingR > Scr->MyDisplayWidth) + AddingX = Scr->MyDisplayWidth - AddingW; + + if (AddingY < 0) + AddingY = 0; + if (AddingB > Scr->MyDisplayHeight) + AddingY = Scr->MyDisplayHeight - AddingH; + } break; } } -- Rod Whitby _--_|\ Austek Microsystems / \ Technology Park ACSnet: rwhitby@austek.oz \_.--*_/ Adelaide, SA 5095 ARPA: rwhitby@austek.oz.au v Australia UUCP: uunet.uu.net!munnari!austek.oz.au!rwhitby X-Face: %}1klhj1q/qgLe;Nz<&;'7TsMEx5A-`,l|;;\.s5TiG99*0QR{~hNesXoQWp|I*"@r)U1\u Dvj|b#m5uV.2QkJ.<Yu?X^pn+^W_UQyG5/iZ!AA`3<JJMe3z{*?p!yarBuJ+!RY"&knZ]eDImi,u5, 4(+M`ECv"q}58Oe11%e[g36]D_PaQY]K3@)6d5n:I8Q!&o&Y~kRth?QHJUmg%O[BQ4+w}1g"ElFFS2 *gAn)$TfYp0ji!6t[oXdfYBM+]=V[c7_\$8M|rp(2=i@