Steve Youngs <steve@xxxxxxxx> writes:
> This just gets stranger and stranger. Consider the following...
>
>
> ;:*=======================
> ;:* Vertical Bar
> ;; Sometimes it is good to have a visual indicator that your lines of
> ;; code are just way too long.
> (defvar sy-xwem-vline-win nil)
> (define-xwem-command sy-xwem-set-vline (&optional column colour)
> "Setup one-pixel wide vertical line at COLUMN.
>
> COLOUR is vline colour default \"red\".
> Default COLUMN is value of `fill-column'."
> (xwem-interactive
> (list (or (and xwem-prefix-arg (prefix-numeric-value xwem-prefix-arg))
> fill-column)))
> (unless colour
> (setq colour "red"))
>
> (let (cxwin)
> (setq cxwin
> (X-Win-find-or-make
> (xwem-dpy)
> (float
> (string-to-int (frame-property (last-nonminibuf-frame)
> 'window-id)))))
> (when (X-Win-p sy-xwem-vline-win)
> (XDestroyWindow (xwem-dpy) sy-xwem-vline-win)
> (setq sy-xwem-vline-win nil))
> (when (> column 0)
> (setq
> sy-xwem-vline-win
> (XCreateWindow
> (xwem-dpy) cxwin
> (+ (frame-property (last-nonminibuf-frame) 'internal-border-width)
> (* (font-width (face-font 'default)) column))
> 0 1
> (frame-pixel-height)
> 0 nil nil nil
> (make-X-Attr :background-pixel
> (XAllocNamedColor
> (xwem-dpy) (XDefaultColormap (xwem-dpy)) colour))))
> (XMapWindow (xwem-dpy) sy-xwem-vline-win))))
>
> (define-key xwem-global-map (xwem-kbd "H-c m V") 'sy-xwem-set-vline)
>
>
> If I do M-x sy-xwem-set-vline RET, I get...
>
> http://www.youngs.au.com/~steve/tmp/vline1.png
>
> But if I do H-c m V, I get...
>
> http://www.youngs.au.com/~steve/tmp/vline2.png
>
> Look closely at that 2nd shot... there is a red vertical line, and it
> is at the correct column. It just starts at the top of the toolbar
> and finishes at the bottom of the toolbar.
>
of course, use `(frame-pixel-height (last-nonminibuf-frame))'.
Without FRAME argument `frame-pixel-height' gets a height of currently
selected frame (which is xwem minibuffer at `H-c m V' processing
time).
--
lg
|