int main( int argc, char *argv[] ) {
Display *dpy = XOpenDisplay( getenv("DISPLAY") );
Window window = 2097154;
XCompositeRedirectWindow( dpy, window, CompositeRedirectManual );
XWindowAttributes attr;
XGetWindowAttributes( dpy, window, &attr );
XRenderPictFormat *format = XRenderFindVisualFormat( dpy, attr.visual );
bool hasAlpha = ( format->type == PictTypeDirect && format->direct.alphaMask );
int x = attr.x;
int y = attr.y;
int width = attr.width;
int height = attr.height;
qDebug() << hasAlpha << x << y << width << height;
XRenderPictureAttributes pa;
pa.subwindow_mode = IncludeInferiors; // Don't clip child widgets
widget.setGeometry( 100, 100, 500, 500 );
widget.show();
Picture picture = XRenderCreatePicture( dpy, window, format, CPSubwindowMode, &pa );
XRenderComposite( dpy, PictOpSrc, picture, None,
widget.x11PictureHandle(), 0, 0, 0, 0, 0, 0, 500, 500 );
XRenderFreePicture( dpy, picture );
return app.exec();
}
int main( int argc, char *argv[] ) {
QApplication app( argc, argv );
Display *dpy = XOpenDisplay( getenv("DISPLAY") );
Window window = 2097154;
XCompositeRedirectWindow( dpy, window, CompositeRedirectManual );
XWindowAttributes attr;
XGetWindowAttributes( dpy, window, &attr );
XRenderPictFormat *format = XRenderFindVisualFormat( dpy, attr.visual );
bool hasAlpha = ( format->type == PictTypeDirect && format->direct.alphaMask );
int x = attr.x;
int y = attr.y;
int width = attr.width;
int height = attr.height;
qDebug() << hasAlpha << x << y << width << height;
XRenderPictureAttributes pa;
pa.subwindow_mode = IncludeInferiors; // Don't clip child widgets
QWidget widget;
widget.setGeometry( 100, 100, 500, 500 );
widget.show();
Picture picture = XRenderCreatePicture( dpy, window, format, CPSubwindowMode, &pa );
XRenderComposite( dpy, PictOpSrc, picture, None,
widget.x11PictureHandle(), 0, 0, 0, 0, 0, 0, 500, 500 );
XRenderFreePicture( dpy, picture );
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks