Fwd: NameWindowPixmap problem
Petr Zalyautdinov
ya.betmen at gmail.com
Fri Feb 27 23:01:44 PST 2015
Dear All
I try get screenshots for all opened applications, but i have problem with
NameWindowPixmap. I shared my simple example application:
http://pastebin.com/Qw8ZZ2i8.
I make screenshots using method below
QPixmap makeScreenshot(XID xid, Display *display){
QPixmap qpxmp;
XCompositeRedirectWindow (display, xid, CompositeRedirectAutomatic);
XFlush(display);
Pixmap pixmap = XCompositeNameWindowPixmap (display, xid);
XSync(display, false);
qpxmp = QPixmap::fromX11Pixmap(pixmap).copy();
XFreePixmap (display, pixmap);
XCompositeUnredirectWindow (display, xid, CompositeRedirectAutomatic);
return qpxmp;
}
Usually it works, but sometimes I face with problems: pixmap exists, but it
wrong, it could be black, empty or corrupted image. This cases generates
same log entries:
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
Extension: 139 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x4a0006d
X Error: RenderBadPicture (invalid Picture parameter) 143
Extension: 139 (RENDER)
Minor opcode: 8 (RenderComposite)
Resource id: 0x24001b4
X Error: RenderBadPicture (invalid Picture parameter) 143
Extension: 139 (RENDER)
Minor opcode: 7 (RenderFreePicture)
Resource id: 0x24001b4
In my example I try get screenshot twice:
QPixmap p = makeScreenshot(wid, display);
p = makeScreenshot(wid, display);
And I have same errors in log, but images usually correct. Also if I remove
line "XFreePixmap (display, pixmap);" then errors disappears.
Actually, I'm nub. What did I do wrong? How I can know moment when pixmap
is ready to use?
Kind regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20150228/b2ab2420/attachment.html>
More information about the xorg-devel
mailing list