Re: new command 'display-window-position'?



Hi,
zanghar freenet de (2009-12-29 at 2148.27 +0100):
> > show-window-props seems to show that info, but only sometimes.
> Which function are you refering to? there's no
> show-window-prop{s,erties} in sawfish.

Duh... the one from window-info.jl; which you are right, is not in
main sawfish. Maybe you can look at it and see what parts are useful.
Quick searchs do not return it, so I attach it.

GSR
 
;; window-info.jl -- popup a list of all non nil window properties

;; Jonas Linde <jonas init se> 2000/03/14
;; two-tier solution by Dave Pearson <davep davep org> 2000/03/15
;; identify-window by Isaac Feitler <ikeisaac netscape net> 2000/03/16

;; This file is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

(defun describe-window (window)
  "Describe WINDOW.

Details about the X, sawmill and meta properties of WINDOW are written to
`standard-output'."
  (interactive "%W")
  (let ((seq2str (lambda (seq &optional ofs)
                   (let* ((i (1- (length seq)))
                          (res (prin1-to-string (elt seq i))))
                     (while (> i 0)
                       (setq i (1- i))
                       (setq res (concat (prin1-to-string (elt seq i)) 
                                         (if (null ofs) " " ofs) res)))
                     res)))
        (position (window-absolute-position window))
        (viewport (window-viewport window))
        (dimensions (window-dimensions window)))
    (format standard-output "Window Properties %s\n\nX\n" (prin1-to-string window))
    (mapc (lambda (prop)
            (let ((value (get-x-property window prop)))
              (unless (null value)
                (format standard-output "   %s: %s\n"
                        prop
                        (if (= (elt value 0) 'STRING)
                            (translate-string (elt value 2) " ")
                          (seq2str (elt value 2)))))))
          (reverse (list-x-properties window)))
    (format standard-output "\nsawmill\n")
    (mapc (lambda (prop)
            (let ((value (window-get window prop)))
              (unless (null value)
                (format standard-output "   %s: %s\n" prop value))))
          '(ignored avoid workspaces viewport sticky sticky-viewport focus-click-through
            ignore-window-input-hint never-focus focus-when-mapped
            ignore-program-position place-mode placement-weight type frame-style
            current-frame-style removed-classes shaded hide-client depth placed
            iconified gravity))
    (format standard-output "\nmeta\n   position: %s\n   viewport: %s\n   dimensions: %s\n"
            position viewport dimensions)))

(defun show-window-props ()
  (interactive)
  (call-command-with-output-to-screen describe-window))

(defmacro with-output-to-file (file &rest body)
  "Writes the output produced by BODY to FILE."
  `(let ((standard-output (open-file ,file 'write)))
    (unwind-protect
         (progn
           ,@body)
      (close-file standard-output))))

(defun dump-window-details (file)
  "Write the description of all managed windows in FILE."
  (with-output-to-file file
    (mapc (lambda (w)
            (format standard-output "%s\n" (make-string 76 ?-))
            (describe-window w)
            (princ "\n"))
          (managed-windows))))

;;useful for calling from a popup menu
(defun identify-window ()
  (call-command-with-output-to-screen '(describe-window (select-window))))

(provide 'window-info)


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