Applet positions

Ivan Čukić ivan.cukic at gmail.com
Wed Mar 12 09:29:10 CET 2008


Hi all,

I have a question to which I have no proper answer. Applets on the desktop are 
fixed to the desktop using the top-left corner. So, if somebody has an applet
that changes its size during its lifetime on the right bottom corner of the
screen, problems occur.

For example, think of system tray applet placed on the desktop. At first you
have a few icons, and you moved it in the bottom-right corner of the screen.
When you start another application that has a tray icon, the tray will expand 
to the right making the newly added icon to /appear/ beyond the right edge
of the screen.

There are two solutions that I see. One is more versatile, but IMHO unneeded:

1 - to have the option to lock the applet relative to the user-specified edge
of the screen (disadvantage: no center-aligned applets)

And the other one is much better (again, IMHO)
2 - to keep the distance-to-edge ratios equal before and after resizing.
(remember, I'm not talking about user resizing, but automatic applet self-
resizing).

What do I mean by this?

I'll just explain for horizontal coordinates. So we have an applet wide 
                                    w1 = 200px
whose left edge is at 
                                    l1 = 800px
of a 
                                    W = 1024px
wide desktop. So the distance of the right applet edge to the right screen
edge is 
                              r1 = W - w1 - l1 = 24px.

Now our applet wants to resize itself to
                                    w2 = 400px
So we position the left edge of the applet to be at 
                              l2 = (W - w2) * l1 / (W - w1)
this making the
                              r2 = (W - w2) * r1 / (W - w1)

This way applet will not go beyond screen edges due to resize, and it will
keep it's position in the eye of beholder (user). (Even when in the center of 
the screen)

NOTE: It could be even made to use logarithmic/exponential scale so that we 
give more weight to smaller distances - that way the applet would not move 
almost at all if placed near one of the edges.

Cheers!

-- 
The bleeding hearts and artists,
Make their stand.
    -- Pink Floyd

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20080312/9dcb0d7c/attachment.pgp 


More information about the Panel-devel mailing list