sometimes the windows are placed ... outside the boundaries of my screen...



Ok, connected external display, my "desktop got bigger" (to account for
the new display--left side) then decided to use mirroring... my
workspace remains huge,so now sawfish places windows outside.

This function will help you "bring" windows inside. I used it regularly
when I rotate the screen:

ANy trick to resize the sawfish screen (is that what is called a
viewport?) after it is created and no longer needed?

--dmg


----------------------------------------------------------------------
(defun dmg-move-window-inside (w)
   "move the window within the boundaries of the display"
   (interactive "%W")
   (let* (
          (head-x-offset (nth 0 (calculate-workarea w)))
          (head-y-offset (nth 1 (calculate-workarea w)))
          (head-x-size (dmg-workarea-x-size w))
          (head-y-size (dmg-workarea-y-size w))
          (head-x-right (nth 2 (calculate-workarea w)))
          (head-y-down (nth 3 (calculate-workarea w)))
         (coords (window-position w))
         (xleft (car coords))
         (yup (cdr coords))
         (fdims (window-frame-dimensions w))
         (dims (window-dimensions w))
         (xsize (car fdims))
         (ysize (cdr fdims))
	 (framex (- xsize (car dims)))
	 (framey (- ysize (cdr dims)))
         (xright 0)
         (ydown 0)
         (outsidex 0)
         (outsidey 0)
         )
     ; is the left hand size inside
     (if (< xleft head-x-offset)
         (setq xleft head-x-offset))
     (if (< yup head-y-offset)
         (setq yup head-y-offset))
     ; is the size of the window bigger than the display
     ; resize
     (if (> xsize head-x-size) 
         (setq xsize head-x-size))
     (if (> ysize head-y-size) 
         (setq ysize head-y-size))
     ; compute end position
     (setq xright (+ xleft xsize))
     (setq ydown (+ yup ysize))
     ; how much are we outside?
     (setq outsidex (+ (- xright head-x-right) 1))
     (setq outsidey (+ (- ydown head-y-down) 1))
     ; if we our too the window is outside the right/down
     ; move it in
     (if (> outsidex 0) 
         (setq xleft (- xleft outsidex)))
     (if (> outsidey 0) 
         (setq yup (- yup outsidey)))
     ; the new size of the window has to take into account the size of
     ; the frame
     (move-resize-window-to w 
                            xleft  yup
                            (- xsize framex) (- ysize framey))
     ); end of le

   )
----------------------------------------------------------------------



-- 
--
Daniel M. German                  
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]