Summary: | snapshots of windows which extend offscreen turn to garbage | ||
---|---|---|---|
Product: | [Applications] ksnapshot | Reporter: | Adam Wiggins <hiro> |
Component: | general | Assignee: | Richard Moore <rich> |
Status: | RESOLVED UNMAINTAINED | ||
Severity: | normal | CC: | bradh, echidnaman, kdebugs, mail, yuriy.kozlov |
Priority: | NOR | ||
Version: | 0.7 | ||
Target Milestone: | --- | ||
Platform: | RedHat Enterprise Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: | screenshot |
Description
Adam Wiggins
2005-01-12 08:14:35 UTC
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! |