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