Window thumbnail and Javascript

Aaron J. Seigo aseigo at kde.org
Fri Dec 31 23:21:51 CET 2010


On Friday, December 31, 2010, J Janz wrote:
> Also, if I got it right from your answer, I still couldn't make it right
> now even with a DataEngine/Service, because I wouldn't have a widget,
> right?

there are probably a number of ways to do it; right now with the tooltip 
widgets the window manager paints the thumbnail there directly within the 
coordinates given since it already has the pixmap available and knows when to 
update it.

with a plasmoid, it is possible to find every view (which is a QWidget) that 
displaying that plasmoid and map the coordinates of the plasmoid to the 
coordinates of that widget (and then to global screen coordinates). that's not 
very hard at all. in fact, the plasmoid itself can knows it geometry in scene 
coordinates with QGraphicsItem::mapToScene(..). this returns a QPolygonF, 
since the item may be transformed on the screen.

with that region, it is then easy enough to find out what the screen 
coordinates are based on the view's offset onto the scene (mapFromScene(..)) 
and where the view is on screen (getting the bounding rect of the region and 
using QWidget::mapToGlobal(..))

to support rotation, kwin would also need to know what the rotation in 
QGraphicsItem::transorm() is so it knows which way the polygon is oriented. 
with that info, kwin should be able to paint thumbails pretty much anywhere 
requested.

right now, without touching kwin, only non-rotated thumbnails are possible. 
that would be a useful start, though, and once that is working we can add 
rotation to kwin's thumbnail painting perhaps.

kwin's thumbnail painting is triggered using 
Plasma::WindowEffects::showWindowThumbnails. what isn't good in there right 
now is that it sets an X atom on the window, meaning that only one set of 
window thubnails per view would currently be painted. so two copies of your 
plasmoid on the same containment wouldn't work right now; that would need some 
work, but that is, again, another improvement that could be made once the 
basics are working.

so to start with, a Service in the Tasks DataEngine which uses 
Plasma::WindowEffects to get thumbnails for a window onto a given screen coord 
should be enough to get this started.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Development Frameworks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20101231/7f0990f6/attachment.sig 


More information about the Plasma-devel mailing list