Bug 340929

Summary: “Window Under Cursor” grabs the wrong part of the screen
Product: [Unmaintained] ksnapshot Reporter: Mark Dominus <mjd>
Component: generalAssignee: Aaron J. Seigo <aseigo>
Status: RESOLVED UNMAINTAINED    
Severity: major CC: lueck, null
Priority: NOR    
Version: 0.8.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Xorg.0.log

Description Mark Dominus 2014-11-13 15:34:35 UTC
When I take a snapshot with the “Capture mode” menu set to “Window Under Cursor”, KSnapshot captures a region that is the correct size and shape, but whose upper-left corner is about 40 pixels above and to the left of the window's actual upper-left corner.

The resulting screenshot is missing a 40-pixel strip along the right-hand edge of the window, and a 40-pixel strip  strip along the bottom edge of the window.  Instead, there is a blank gray strip along the top and left-hand sides of the screnshot.



Reproducible: Always

Steps to Reproduce:
1. Select “Window Under Cursor”
2. Click “Take a New Snapshot”
3. Click target window
4. Examine resulting screenshot

Actual Results:  
See attached screenshots at http://a.pomf.se/exjwyn.png and http://a.pomf.se/zitaez.png, which demonstrate the problem.


Expected Results:  
It should capture the entire window that I clicked, and nothing more.
Comment 1 Mark Dominus 2014-11-13 15:35:05 UTC
ksnapshot --version says:

Qt: 4.8.6
KDE Development Platform: 4.13.3
KSnapshot: 0.8.2
Comment 2 Mark Dominus 2014-11-13 15:36:38 UTC
“Include window decorations” and “include mouse pointer” are not checked.  The problem manifests regardless of the setting of “Snapshot delay”.
Comment 3 Burkhard Lück 2014-11-14 12:30:33 UTC
With
$ ksnapshot --version
xxQt: 4.8.2
KDE Development Platform: 4.14.60
xxKSnapshotxx: 0.8.2
xx
compiled from sources 
+
$ ksnapshot --version
Qt: 4.8.6
KDE: 4.14.3
KSnapshot: 0.8.2
compiled from sources 
+
$ ksnapshot --version                                                                                                                                                               
Qt: 4.8.6                                                                                                                                                                                       
KDE: 4.14.2
KSnapshot: 0.8.2
from Kubuntu 14.10 packages
this issue is not reproducable
Comment 4 Mark Dominus 2014-11-14 14:54:05 UTC
If there's any additional information I can provide here, please let me know.
Comment 5 Burkhard Lück 2014-11-14 15:00:57 UTC
(In reply to Mark Dominus from comment #4)
> If there's any additional information I can provide here, please let me know.

Distribution or compiled from sources?

Graphics system (hardware / driver)?
Comment 6 Mark Dominus 2014-11-14 16:50:16 UTC
I'm using the version distributed with Ubuntu 14.04.1 LTS ("trusty").

lspci reports:
00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)                                                                     
01:00.0 VGA compatible controller: NVIDIA Corporation GK107GLM [Quadro K1100M] (rev a1)

lshw -C video reports:
  *-display               
       description: VGA compatible controller
       product: GK107GLM [Quadro K1100M]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nouveau latency=0
       resources: irq:44 memory:b0000000-b0ffffff memory:80000000-8fffffff memory:90000000-91ffffff ioport:4000(size=128) memory:b1000000-b107ffff
  *-display
       description: VGA compatible controller
       product: 4th Gen Core Processor Integrated Graphics Controller
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 06
       width: 64 bits
       clock: 33MHz
       capabilities: msi pm vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:45 memory:b1400000-b17fffff memory:a0000000-afffffff ioport:5000(size=64)

I will shortly attach a copy of /etc/Xorg.0.log in case that has anything relevant.

Let me know if there is additional information that you need, and if so, how to obtain it.
Comment 7 Mark Dominus 2014-11-14 16:51:04 UTC
Created attachment 89581 [details]
Xorg.0.log

A copy of my most recent Xorg startup log
Comment 8 Burkhard Lück 2014-11-15 17:08:21 UTC
Could you please try another screenshot utility/command like "import /tmp/tmp.png" from Imagemagick in a console to check if this works properly?
Comment 9 Mark Dominus 2014-11-15 22:17:43 UTC
That's a good idea, thanks.  The screenshots produced by imagemagick's `import` command do not have the problem that the KSnapshot snapshots have.  An example is at http://a.pomf.se/abraqw.png .

$ import --version
Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
Comment 10 Mark Dominus 2014-11-15 22:21:06 UTC
I said that the missing strip along the top and left was gray. Actually it seems to be transparent.  What might cause KSnapshot to write an image file with a transparent area?
Comment 11 Burkhard Lück 2014-11-17 07:50:44 UTC
(In reply to Mark Dominus from comment #9)
> That's a good idea, thanks.  The screenshots produced by imagemagick's
> `import` command do not have the problem that the KSnapshot snapshots have. 
> An example is at http://a.pomf.se/abraqw.png .
> 
In your report you say you have the problem only with “Window Under Cursor”, not in the other capture modes of KSnapshot, right?

But your test with imagemagick is a full screen capture, not a capture of a window under the cursor.
Please test again imagemagick's import command but take a snapshot of a not maximized window, eg type "import /tmp/tmp.png" in a not maximized konsole window.
Comment 12 Mark Dominus 2014-11-17 17:29:20 UTC
> In your report you say you have the problem only with Window Unde Cursor
> not in the other capture modes of KSnapshot, right?

Right.

> But your test with imagemagick is a full screen capture, not a capture of a
> window under the cursor.

No, it isn't.  Imagemagick "import" changes the cursor to a plus sign;
then I click on one window, and it captures just that window.

Look again at my Imagemagick capture example:

http://a.pomf.se/abraqw.png

It is a capture of the KSnapshot window, not of the entire screen.
The KSnapshot window at that time happened to contain a thumbnail of a
large capture, but that is not relevant to the test.
Comment 13 Burkhard Lück 2014-11-18 15:58:59 UTC
Sorry I am running out of Ideas now :-(
Comment 14 Unknown 2015-03-05 23:45:57 UTC
Two users reported this on Kubuntu Forums, too: https://www.kubuntuforums.net/showthread.php?67561

Both were using the XRender compositing type. After I asked them to switch to OpenGL, KSnapshot behaved normally. Perhaps others following this bug could try that, too?

System Settings -> Desktop Effects -> Advanced tab -> Compositing type
Comment 15 Mark Dominus 2015-03-08 00:16:30 UTC
That did fix the problem for me, thanks very much.
Comment 16 Andrew Crouthamel 2018-09-04 04:20:14 UTC
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!
Comment 17 Burkhard Lück 2018-09-04 07:23:57 UTC
ksnapshot is still in extragear/graphics, it was not moved to unmaintained so far