CLIM mail archive

[Prev][Next][Index][Thread]

Re: get frame position



Here is a proposed response to an earlier question I asked
about absolute frame position on a screen. Thanks to
Phil Chu for providing some insight.

In the following FRAME-ABSOLUTE-EDGES must return
the geometry arguments required to instantiate a frame at the
exact place where it currently is on your screen. Note that there
is some hardcoded magic to correct an observed frame offset. X window
managers seem to offset windows to make room for the title bar,
it would be nice to have a portable way to know when this occurs.

FRAME-ABSOLUTE-EDGES maybe also be used to implement a Workspace Saver
for your CLIM application...

;;; This is an experimental offset you can obtain for
;;; a given window manager by creating a frame at specified coordinates
;;; and then observing how far away from there it actually thinks it landed!
;;;
(defparameter *window-manager-offset*
    #+CLIM-OPENLOOK '(4 25)
    ;; add your own offset observations here:
    #-CLIM-OPENLOOK '(0 0))

(defmethod frame-absolute-edges ((cd ps-application-record))
  (with-bounding-rectangle* (left top right bottom)
      (frame-panes cd)
    (loop as sheet = (frame-top-level-sheet cd) then (sheet-parent sheet)
	while sheet
	do (multiple-value-setq (left top right bottom)
	     (transform-rectangle* (sheet-transformation sheet) left top right bottom)))
    (values (- left (first *window-manager-offset*))
	    (- top (second *window-manager-offset*))
	    (- right (first *window-manager-offset*))
	    (- bottom (second *window-manager-offset*)))))

Enjoy,

Olivier Clarisse


Main Index | Thread Index