
;;File: placements.gwm -- functions to automatically place windows on screen
;;Author: colas@mirsa.inria.fr (Colas NAHABOO) -- Bull Research FRANCE
;;Author: Frederic CHARTON
;;Revision: 1.0 -- Sep 12 1989
;;State: Exp
;;GWM Version: 1.4

; PLACEMENTS
; ==========

(de user-positioning (flag)
  (if flag
   (if (and (not window-was-on-screen) 
	    (not (and (not interactivePlacement)
	              (= window-status 'window))))
		(progn (: l (current-mouse-position))
		       (if (member 'placement showFeedback)
			(progn
			(meter-open 0 0 "  ")
			(meter-update	(+ "( " (itoa window-x) " , " (itoa window-y) ")    "
					    (itoa window-width) " x " (itoa window-height) ))
			)
		       )
		       (: x (# 0 l))
		       (: y (# 1 l))
		       (with (move-meter 1) (move-window x y))
		       (process-exposes)
		       (: new-window window)
		       (with (cursor place-cursor) (move-window))
		       (if (member 'placement showFeedback) (meter-close))
		)
	(if (< window-y 0)(move-window window-x 0))
		)))
))))


; Icon Placement :
; --------------
(defun placement (flag)
 (if iconAutoPlace
    (if flag				; open new window
	(with (thePlace (auto-get-place)
	       X (# 0 thePlace)
  	       Y (# 1 thePlace)
	      )
	 (## 'X window X)
	 (## 'Y window Y)
	 (eval (+ '(move-window) (XY-to-xy X Y)))
	 (set-icon-of-array X Y window)
	)
	; close managed window
	(with (X (# 'X window-property) 
	       Y (# 'Y window-property)
	      )
	 (set-icon-of-array X Y ())
	)
    )
  (with (window window-window)
   (move-window window-icon (+ window-x window-client-x) (+ window-y window-client-y))
  )
 )
)




	
