Re: problems with gnome_lamp widget

On Wed, Jun 10, 1998 at 02:58:50PM -0400, Justin Maurer wrote:
> > GdkColor values (as well as XColor's) range from 0x0000 to 0xffff (this
> > confuses me too some times :). Try ` = 65535;' and it should work.
> thanks for the help - it works now! =)
> now, what else can i do with it? are there pre-made functions to do stuff
> with it, like blink and stuff? or do i have to write them my self.

There are basically 3 ways to change the color of the lamp. You just used the
direct way to tell the lamp to have the color { 0xffff, 0, 0 }.

The next step would be to tell it to use a certain color sequence.
gnome_lamp_set_sequence allows you to say for example "YYYRRR" and the lamp
will blink in yellow and red. The sequences are limited to 32 characters at
the moment and understand C, R, Y, G, A, B and P for clear (gray), red,
yellow, green, aqua, blue and purple.

The last step in abstraction would be to set a lamp by type. You should look
at gnome-lamp.h for what is defined. Setting a type of a lamp widget actually
results in a color sequence right now. The code is easy extendable to allow
different pixmaps for different window states, but that isn't implemented yet.

Okay, now for the main usage of lamps. The function gnome_lamp_set_window_type
(not in GNOME 0.20) sets the window properties as Raster's E would understand
(but even E does nothing more with it then to store it somewhere in the
memory). As soon as window managers start to actually show that state an app
could set it's state to lets say PROC60 when it's finished 60% of a download
or something. When the user minimizes the download window, the icon should
still show the current window state in some way (the color of some portion of
the icon or in a window list or whatever). Thus the download window doesn't
consume desktop space, but you always now about it's progress. This could be
used for any time consuming process. Even when you cannot express the progress
in percent you could set the windows lamp to busy and back to idle when the
process finished.

But since no window manager implements this right now, it doesn't show up
(except if you call xprop) :-(

For some sample code look at testgnome.c in gnome-libs.

> also, how can i make it bigger - or can i?

I could add a function to create a lamp from two given pixmaps. One is the
normal pixmap and one defines some kind of mask for the color. You could have
a look at the xpms in gnome-lamp.c to see what each pixmap does. That way you
can define your own lamp at any size. Oops, just looked at the code. The lamp
mask is actually just rgb data (like the data Imlib uses internally to store
pixmaps). Maybe I'll implement a conversion from a GnomePixmap back to rgb

Oh, and if you make some nice lamp pixmaps, please give 'em to me so I can
replace the current pixmaps. I am no artist, that's why they're so ugly. :-)

Eckehard Berns

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