More info about this patch: http://www.cis.upenn.edu/~bjornk/ctwm/
To apply this patch: 1) cd to your CTWM source directory and 2) Run 'patch -l -p3 < path_to_this_file' 3) Run 'make install' Random placement and DontMoveOff patch: --------------------------------------- I've often been annoyed that randomly placed windows will be placed off-screen. I've specified DontMoveOff, so I think I've made my preference clear on this point. The below patch will keep the old behavior if you have not specified DontMoveOff, or if the currently active random placement would put the window entirely in the current screen. If, on the other hand, the current random placement would place the window (partially) outside of the current screen, and DontMoveOff is specified, the placement will be re-calculated to put the window inside the screen, or if it's too big, aligned with the top of the screen. ------------------- Bjorn Knutsson http://www.cis.upenn.edu/~bjornk/ Patch against CTWM 3.6: diff -rwc /tmp/ctwm-3.6-orig/add_window.c /tmp/ctwm-3.6/add_window.c *** /tmp/ctwm-3.6-orig/add_window.c 2001-12-11 10:38:52.000000000 -0500 --- /tmp/ctwm-3.6/add_window.c 2003-02-09 18:54:46.000000000 -0500 *************** *** 610,619 **** ((Scr->RandomPlacement == RP_UNMAPPED) && ((tmp_win->wmhints && (tmp_win->wmhints->initial_state == IconicState)) || (! OCCUPY (tmp_win, Scr->workSpaceMgr.activeWSPC))))) { /* just stick it somewhere */ ! if ((PlaceX + tmp_win->attr.width) > Scr->MyDisplayWidth) ! PlaceX = 50; ! if ((PlaceY + tmp_win->attr.height) > Scr->MyDisplayHeight) ! PlaceY = 50; tmp_win->attr.x = PlaceX; tmp_win->attr.y = PlaceY; --- 610,637 ---- ((Scr->RandomPlacement == RP_UNMAPPED) && ((tmp_win->wmhints && (tmp_win->wmhints->initial_state == IconicState)) || (! OCCUPY (tmp_win, Scr->workSpaceMgr.activeWSPC))))) { /* just stick it somewhere */ ! if ((PlaceX + tmp_win->attr.width) > Scr->MyDisplayWidth) { ! if (!Scr->DontMoveOff) { /* Honor the user's wishes */ ! PlaceX = 50; /* Anything goes... */ ! } else { ! int available = Scr->MyDisplayWidth - tmp_win->attr.width; /* Available room */ ! if (available <= 0) /* Larger than the screen */ ! PlaceX = 0; /* Just stick it at the top */ ! else ! PlaceX = rand() % available; /* Anywhere's good... */ ! } ! } ! if ((PlaceY + tmp_win->attr.height) > Scr->MyDisplayHeight) { ! if (!Scr->DontMoveOff) { /* Honor the user's wishes */ ! PlaceY = 50; /* Anything goes... */ ! } else { ! int available = Scr->MyDisplayHeight - tmp_win->attr.height; /* Available room */ ! if (available <= 0) /* Larger than the screen */ ! PlaceY = 0; /* Just stick it at the top */ ! else ! PlaceY = rand() % available; /* Anywhere's good... */ ! } ! } tmp_win->attr.x = PlaceX; tmp_win->attr.y = PlaceY;
