|
|
|
@ -69,7 +69,7 @@ KSnapshot::KSnapshot(TQWidget *parent, const char *name)
|
|
|
|
|
#ifdef HAVE_X11_EXTENSIONS_SHAPE_H
|
|
|
|
|
int tmp1, tmp2;
|
|
|
|
|
//Check whether the extension is available
|
|
|
|
|
haveXShape = XShapeQueryExtension( qt_xdisplay(), &tmp1, &tmp2 );
|
|
|
|
|
haveXShape = XShapeQueryExtension( tqt_xdisplay(), &tmp1, &tmp2 );
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
TQVBox *vbox = makeVBoxMainWidget();
|
|
|
|
@ -86,7 +86,7 @@ KSnapshot::KSnapshot(TQWidget *parent, const char *name)
|
|
|
|
|
grabber->show();
|
|
|
|
|
grabber->grabMouse( waitCursor );
|
|
|
|
|
|
|
|
|
|
snapshot = TQPixmap::grabWindow( qt_xrootwin() );
|
|
|
|
|
snapshot = TQPixmap::grabWindow( tqt_xrootwin() );
|
|
|
|
|
updatePreview();
|
|
|
|
|
grabber->releaseMouse();
|
|
|
|
|
grabber->hide();
|
|
|
|
@ -307,12 +307,12 @@ Window findRealWindow( Window w, int depth = 0 )
|
|
|
|
|
{
|
|
|
|
|
if( depth > 5 )
|
|
|
|
|
return None;
|
|
|
|
|
static Atom wm_state = XInternAtom( qt_xdisplay(), "WM_STATE", False );
|
|
|
|
|
static Atom wm_state = XInternAtom( tqt_xdisplay(), "WM_STATE", False );
|
|
|
|
|
Atom type;
|
|
|
|
|
int format;
|
|
|
|
|
unsigned long nitems, after;
|
|
|
|
|
unsigned char* prop;
|
|
|
|
|
if( XGetWindowProperty( qt_xdisplay(), w, wm_state, 0, 0, False, AnyPropertyType,
|
|
|
|
|
if( XGetWindowProperty( tqt_xdisplay(), w, wm_state, 0, 0, False, AnyPropertyType,
|
|
|
|
|
&type, &format, &nitems, &after, &prop ) == Success ) {
|
|
|
|
|
if( prop != NULL )
|
|
|
|
|
XFree( prop );
|
|
|
|
@ -323,7 +323,7 @@ Window findRealWindow( Window w, int depth = 0 )
|
|
|
|
|
Window* children;
|
|
|
|
|
unsigned int nchildren;
|
|
|
|
|
Window ret = None;
|
|
|
|
|
if( XQueryTree( qt_xdisplay(), w, &root, &parent, &children, &nchildren ) != 0 ) {
|
|
|
|
|
if( XQueryTree( tqt_xdisplay(), w, &root, &parent, &children, &nchildren ) != 0 ) {
|
|
|
|
|
for( unsigned int i = 0;
|
|
|
|
|
i < nchildren && ret == None;
|
|
|
|
|
++i )
|
|
|
|
@ -339,17 +339,17 @@ void KSnapshot::performGrab()
|
|
|
|
|
grabber->releaseMouse();
|
|
|
|
|
grabber->hide();
|
|
|
|
|
grabTimer.stop();
|
|
|
|
|
XGrabServer( qt_xdisplay());
|
|
|
|
|
XGrabServer( tqt_xdisplay());
|
|
|
|
|
if ( mainWidget->mode() == WindowUnderCursor ) {
|
|
|
|
|
Window root;
|
|
|
|
|
Window child;
|
|
|
|
|
uint mask;
|
|
|
|
|
int rootX, rootY, winX, winY;
|
|
|
|
|
XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child,
|
|
|
|
|
XQueryPointer( tqt_xdisplay(), tqt_xrootwin(), &root, &child,
|
|
|
|
|
&rootX, &rootY, &winX, &winY,
|
|
|
|
|
&mask);
|
|
|
|
|
if( child == None )
|
|
|
|
|
child = qt_xrootwin();
|
|
|
|
|
child = tqt_xrootwin();
|
|
|
|
|
if( !mainWidget->includeDecorations()) {
|
|
|
|
|
Window real_child = findRealWindow( child );
|
|
|
|
|
if( real_child != None ) // test just in case
|
|
|
|
@ -359,7 +359,7 @@ void KSnapshot::performGrab()
|
|
|
|
|
unsigned int w, h;
|
|
|
|
|
unsigned int border;
|
|
|
|
|
unsigned int depth;
|
|
|
|
|
XGetGeometry( qt_xdisplay(), child, &root, &x, &y,
|
|
|
|
|
XGetGeometry( tqt_xdisplay(), child, &root, &x, &y,
|
|
|
|
|
&w, &h, &border, &depth );
|
|
|
|
|
w += 2 * border;
|
|
|
|
|
h += 2 * border;
|
|
|
|
@ -367,20 +367,20 @@ void KSnapshot::performGrab()
|
|
|
|
|
Window parent;
|
|
|
|
|
Window* children;
|
|
|
|
|
unsigned int nchildren;
|
|
|
|
|
if( XQueryTree( qt_xdisplay(), child, &root, &parent,
|
|
|
|
|
if( XQueryTree( tqt_xdisplay(), child, &root, &parent,
|
|
|
|
|
&children, &nchildren ) != 0 ) {
|
|
|
|
|
if( children != NULL )
|
|
|
|
|
XFree( children );
|
|
|
|
|
int newx, newy;
|
|
|
|
|
Window dummy;
|
|
|
|
|
if( XTranslateCoordinates( qt_xdisplay(), parent, qt_xrootwin(),
|
|
|
|
|
if( XTranslateCoordinates( tqt_xdisplay(), parent, tqt_xrootwin(),
|
|
|
|
|
x, y, &newx, &newy, &dummy )) {
|
|
|
|
|
x = newx;
|
|
|
|
|
y = newy;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
snapshot = TQPixmap::grabWindow( qt_xrootwin(), x, y, w, h );
|
|
|
|
|
snapshot = TQPixmap::grabWindow( tqt_xrootwin(), x, y, w, h );
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_X11_EXTENSIONS_SHAPE_H
|
|
|
|
|
//No XShape - no work.
|
|
|
|
@ -388,7 +388,7 @@ void KSnapshot::performGrab()
|
|
|
|
|
TQBitmap mask(w, h);
|
|
|
|
|
//As the first step, get the mask from XShape.
|
|
|
|
|
int count, order;
|
|
|
|
|
XRectangle* rects = XShapeGetRectangles( qt_xdisplay(), child,
|
|
|
|
|
XRectangle* rects = XShapeGetRectangles( tqt_xdisplay(), child,
|
|
|
|
|
ShapeBounding, &count, &order);
|
|
|
|
|
//The ShapeBounding region is the outermost shape of the window;
|
|
|
|
|
//ShapeBounding - ShapeClipping is defined to be the border.
|
|
|
|
@ -430,9 +430,9 @@ void KSnapshot::performGrab()
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
snapshot = TQPixmap::grabWindow( qt_xrootwin() );
|
|
|
|
|
snapshot = TQPixmap::grabWindow( tqt_xrootwin() );
|
|
|
|
|
}
|
|
|
|
|
XUngrabServer( qt_xdisplay());
|
|
|
|
|
XUngrabServer( tqt_xdisplay());
|
|
|
|
|
updatePreview();
|
|
|
|
|
TQApplication::restoreOverrideCursor();
|
|
|
|
|
modified = true;
|
|
|
|
|