xwem-devel
[Top][All Lists]
Advanced

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

[XWEM]: OSD fun


From: Steve Youngs
Subject: [XWEM]: OSD fun
Date: Sat, 10 Apr 2004 23:01:35 +1000
User-agent: Gnus/5.110002 (No Gnus v0.2) XEmacs/21.4 (Security Through Obscurity, linux)

I've been playing around with xwem-osd.  Lots of fun and really cool.
I had the current date displayed, and some hardware monitors
displayed (CPU & case fan speeds, CPU, M/B, HDD temps etc).

And then I discovered some not so nice things about xwem-osd... 

Their size.  My God!  These things are *HUGE*!  Let me try to explain
what I mean.  The OSD that I had displaying the date is in a window
that is 100 pixels wide by 20 pixels high, it contains nothing but 11
characters of text.  The data in that teeny weeny OSD is over 2
million characters long!

I know this because, in a scratch buffer I did...

(eval 'sy-osd-date)C-j

Move point to the last character of the output and...

C-x =

It told me that I was looking at column 2281996 

Those 11 characters, "Sat, Apr 10", are chewing up 2 megabytes of
memory.  Don't worry, this gets better.  These OSDs grow.  That number
I quoted just before is from a little while ago, now it is 2355518.

The next bad thing about OSDs is that you can't completely kill them.
If I (xwem-osd-destroy 'sy-osd-date), the displayed text vanishes, and
`xwem-osd-p' returns `nil', but `sy-osd-date' still contains 2 meg of
data.

I would expect that after (xwem-osd-destroy 'foo), that (eval 'foo)
would return `nil'.  It doesn't.  I could probably add a `(setq foo
nil)' after the call to `xwem-osd-destroy', but shouldn't xwem-osd
take care of that?

Following is some code that I've been using as a test

(require 'xwem-osd)
(defvar sy-osd-date nil)
(copy-face 'default 'sy-osd-date-face)
(set-face-foreground 'sy-osd-date-face "cyan")

(defun sy-show-date-osd ()
  "*Display the current date using OSD."
  (interactive)
  (let* ((fromleft 820)
         (fromtop 740)
         (face `sy-osd-date-face)
         (text (format-time-string "%a, %b %e"))
         (xwem-osd-always-ontop t))
    (setq sy-osd-date (xwem-osd-create (xwem-dpy) fromleft fromtop 100 20))
    (xwem-osd-set-color sy-osd-date (face-foreground-name face))
    (xwem-osd-set-font sy-osd-date (face-font-name face))
    (xwem-osd-text sy-osd-date text)
    (xwem-osd-show sy-osd-date)))

(defun sy-delete-osd-date ()
  "*Delete the OSD date."
  (interactive)
  (when (xwem-osd-p sy-osd-date)
    (xwem-osd-destroy sy-osd-date)))

M-x sy-show-osd-date RET to create the OSD

M-: (xwem-osd-p 'sy-osd-date) RET to confirm it really exists

Then in scratch, do `(eval 'sy-osd-date)C-j'

Move point the end of the output and do `C-x =', have a look at the
column number.

M-x sy-delete-osd-date RET

M-: (xwem-osd-p 'sy-osd-date) RET to confirm that it has gone.

in scratch, `(eval 'sy-osd-date)C-j'

move point to the end of the output and `C-x =', look at the column
number.

M-x sy-show-osd-date RET
M-x sy-delete-osd-date RET
M-x sy-show-osd-date RET
M-x sy-delete-osd-date RET
M-x sy-show-osd-date RET
M-x sy-delete-osd-date RET
M-x sy-show-osd-date RET
M-x sy-delete-osd-date RET
M-x sy-show-osd-date RET
M-x sy-delete-osd-date RET
M-x sy-show-osd-date RET
M-x sy-delete-osd-date RET
M-x sy-show-osd-date RET
M-x sy-delete-osd-date RET
M-x sy-show-osd-date RET
M-x sy-delete-osd-date RET

in scratch, `(eval 'sy-osd-date)C-j'

move point to the end of the output and `C-x =', look at the column
number.

Of course you should disregard this if my test code is bogus. :-)

-- 
|---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---|
|              Ashes to ashes, dust to dust.               |
|      The proof of the pudding, is under the crust.       |
|------------------------------<address@hidden>---|

Attachment: pgpkdr60H_Oln.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]