Version: 0.7 (using KDE KDE 3.3.1) Installed from: RedHat RPMs OS: Linux My KMix window is about twice the width of my screen. When taking a snapshot (to submit a bug report about it), I ended up with this: http://dusk.org/~adam/bugzilla/ksnapshot.png This was using "window under cursor" mode. I was not surprised that it couldn't get the contents of the window that were not visible on screen, but it seems like it should handle this more gracefully - perhaps by clipping the final image, or just filling in the remaining space with black.
I don't see garbage (just black sections - probably a change to Qt), but it is still wrong (because we are using QPixmap::grabRegion(), and that has a warning that it isn't safe to grab off screen regions). I've got a patch that just trims to the current screen size: --- ksnapshot.cpp 11 Dec 2004 21:40:39 -0000 1.78 +++ ksnapshot.cpp 29 Jan 2005 22:23:59 -0000 @@ -498,8 +498,20 @@ void KSnapshot::performGrab() y = newy; } } + XWindowAttributes rootAttributes; + if ( XGetWindowAttributes( qt_xdisplay(), root, &rootAttributes ) ) { + if ( ( x + w ) > rootAttributes.width ) { + // then the window is partly off the screen + w = rootAttributes.width - x; + } + if ( ( y + h ) > rootAttributes.height ) { + // then the window is partly off the screen + h = rootAttributes.height - y; + } + } + snapshot = QPixmap::grabWindow( qt_xrootwin(), x, y, w, h ); #ifdef HAVE_X11_EXTENSIONS_SHAPE_H Is that OK to commit?
That is committed now.
According to https://bugs.launchpad.net/ubuntu/+source/kdegraphics/+bug/204358 this is still/again a problem in KDE 3.5 and KDE 4.0
Yes, this still is an issue in KDE 4.1.1. Please reopen the bug.
Still a problem in KDE 4.1.85, reopening.
Here's an adaptation of the patch for KDE 4.3: Index: kdegraphics-4.2.90/ksnapshot/windowgrabber.cpp =================================================================== --- kdegraphics-4.2.90.orig/ksnapshot/windowgrabber.cpp 2009-06-12 23:16:28.000000000 -0400 +++ kdegraphics-4.2.90/ksnapshot/windowgrabber.cpp 2009-06-12 23:37:00.000000000 -0400 @@ -140,6 +140,18 @@ QPixmap grabWindow( Window child, int x, int y, uint w, uint h, uint border, QString *title=0, QString *windowClass=0 ) { + XWindowAttributes rootAttributes; + if ( XGetWindowAttributes( QX11Info::display(), QX11Info::appRootWindow(), &rootAttributes ) ) { + if ( ( x + w ) > rootAttributes.width ) { + // then the window is partly off the screen + w = rootAttributes.width - x; + } + if ( ( y + h ) > rootAttributes.height ) { + // then the window is partly off the screen + h = rootAttributes.height - y; + } + } + QPixmap pm( QPixmap::grabWindow( QX11Info::appRootWindow(), x, y, w, h ) ); KWindowInfo winInfo( findRealWindow(child), NET::WMVisibleName, NET::WM2WindowClass );
Can't reproduce this anymore on KDE 4.10 RC1 (4.9.95). IIRC since KDE 4.5 the window screenshot is grabbed from kwin directly to: * also include the window decoration's shadow * create screenshots of windows which are (partially) covered by other windows * create screenshots of (partially) offscreen windows It even works when disabling compositing. I don't know what would happen when using a different WM than kwin, but I don't think that really counts here. So I'd vote for closing this bug. Any objections?
Created attachment 88044 [details] screenshot Ubuntu 14.04 (KDE 4.13.2)
Hello! Sorry to be the bearer of bad news, but this project has been unmaintained for many years and I will be closing this bug. Spectacle is the replacement for ksnapshot now. Please test again and file a new bug for Spectacle if you still have issues. Thank you!