[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Capturing the contents of a minimized window
From:       Lubos Lunak <l.lunak () suse ! cz>
Date:       2003-03-03 12:21:10
[Download RAW message or body]

On Sunday 02 of March 2003 16:18, Dimitris Stasinopoulos wrote:
> Hello_all()
>
> I have a small KDE app that replaces kicker, and one of the things it does
> is when a window is minimized, it puts an icon in an iconbox, so that you
> can click the icon, and the window will be restored. However, I would
> prefer to grab the window's contents (=snapshot), and have the resulting
> QPixmap as an icon. I tried this using QPixpmap::grabWIndow(). I have
> connected the signal windowChanged() from KWinModule, to a function that
> calls grabWindow() with the proper window ID, to no result; the
> grabWindow() function just returns the default icon (the "exec" icon).
> What am I doing wrong here? The windowId is perfectly valid. Isn't this
> code valid for what I want to do? Or is it that the window is minimized?

 You cannot take a snapshot of a minimized window, just like you cannot e.g. 
take a (complete) snapshot of a partially obsured window. The only 
application being able to capture the snapshot before the window becomes 
minimalized is the window manager, but even the window manager can't help 
with partially obscured windows.

> QPixmap appIcon=QPixmap::grabWindow(windowId);
> QImage minAppImage=appIcon.convertToImage();
> minAppImage=minAppImage.smoothScale(48, 48, QImage::ScaleMin);
> appIcon.convertFromImage(minAppImage);

 Have you measures how long this takes with a maximalized window? Doing large 
image<->pixmap conversions is pretty slow.

-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak@suse.cz , l.lunak@kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic