Bug 28656 - Mouse cursor not always included in snapshot
Summary: Mouse cursor not always included in snapshot
Status: RESOLVED UNMAINTAINED
Alias: None
Product: ksnapshot
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Richard Moore
URL:
Keywords:
: 100926 184287 237941 241472 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-07-10 18:18 UTC by George Yohng
Modified: 2018-09-04 04:20 UTC (History)
26 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Allows ksnapshot to take screenshots that include the mouse pointer (13.41 KB, patch)
2005-04-15 01:42 UTC, awendt
Details
Updated patch to add the cursor (28.34 KB, patch)
2010-01-11 23:11 UTC, John Tapsell
Details
Another implementation (7.68 KB, patch)
2010-01-11 23:23 UTC, Pino Toscano
Details
Updated for 64bit (28.58 KB, patch)
2010-01-12 00:34 UTC, John Tapsell
Details
Fixed implementation of mine (9.11 KB, patch)
2010-01-12 00:43 UTC, Pino Toscano
Details
to get mouse cursor (29.73 KB, patch)
2010-06-12 21:21 UTC, ThorbjørnTux
Details
Cursor, capruted on screenshot (made with ksnapshot) (363.75 KB, image/png)
2013-06-06 21:02 UTC, Kyrylo Bohdanenko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description George Yohng 2001-07-10 18:07:06 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           ksnapshot
Version:           unknown (using KDE 2.1.1 )
Severity:          wishlist
Installed from:    SuSE
Compiler:          gcc version 2.95.2 19991024 (release)
OS:                Linux 2.2.16 i686
OS/Compiler notes: 

In ksnapshot program I would like to see checkbox "Grab with mouse cursor". That means that program should get cursor shape and lay it over bitmap as most of recent videocards do cursor in hardware and will not allow to grab it directly from screen.

Feature is very useful for taking screenshots for bug reports ;)

(Submitted via bugs.kde.org)
(Called from KBugReport dialog)
Comment 1 Richard Moore 2002-08-01 21:57:52 UTC
Not possible I'm afraid.

Rich.
Comment 2 Sebastien 2004-02-20 01:28:09 UTC
And now ?
Is it possible ?

KDE now knowjow to change cursor theme.
So,get theme couldbe possible.
If not,juste get the cursor position and include a generic cursor : it can be usefull,even if wrong cursor shape.
Comment 3 Jim Taylor 2004-03-02 20:45:10 UTC
Wish to include or exclude mouse cursor when taking screen shot.
For example, include "paint bucket" cursor in graphic object for OpenOffice.org DRAW documentation.

Alternative would be some "clip art" feature somewhere in KDE so that I could copy an image of some particular mouse cursor shape (such as the paint bucket shape) and overlay the clip art onto my ksnapshot image.
Found all sorts of mouse cursor shapes, but no paint bucket. Oi. :-(
Comment 4 richlv 2004-11-04 13:02:29 UTC
this would be an extremly useful feature for bugreports. unfortunately it is not possible to vote anymore :/

and, for example, on windows foto canvas (acd software product) allows to grab with mouse pointer, so there must be some way to do this technically
Comment 5 awendt 2005-04-15 01:42:14 UTC
Created attachment 10637 [details]
Allows ksnapshot to take screenshots that include the mouse pointer

I created a patch that adds this feature to ksnapshot. It relies on the XFIXES
extension. It adds a new checkbox that allows you to turn the feature on and
off, and a couple DCOP functions to get and set the state of the checkbox.

It also adds DCOP functions to get and set the state of the "include
decorations" checkbox, since I didn't see existing ones. And it fixes a couple
of variables that could have been used before they were initialized.
Comment 6 Janet 2006-03-05 02:54:25 UTC
This patch never made it into ksnapshot, didn't it? In ksnaphot of KDE 3.5.1 there still is no checkbox option to include the mouse pointer. Maybe this bug report and Bug 100926 should go together.
Comment 7 Richard Moore 2007-01-20 23:47:02 UTC
*** Bug 100926 has been marked as a duplicate of this bug. ***
Comment 8 Tristan Miller 2007-03-10 21:22:00 UTC
Still no checkbox option to include the mouse pointer in KDE 3.5.5.  Does this bug need to be reopened?
Comment 9 Richard Moore 2007-03-11 01:02:54 UTC
I don't understand how this got closed. It wasn't through the main bugzilla, reopenning. Aaron, any thoughts on how we can integrate this into the UI without screwing it up?

Comment 10 Aaron J. Seigo 2007-03-11 02:29:10 UTC
perhaps take the "include window decorations" checkbox and do sth like:

Include: [  ] Window borders
         [  ] Mouse cursor

it shouldn't mess things up too much, i suppose. i don't understand why the patch provided disables the mouse cursor in region mode, however.

also, i wonder if the de-premultiplying is needed in qt4 (this would have to go into trunk, too late for 3.x, obviously). that would make the code a lot nicer =)

adding the ability to turn these things on/off using d-bus is a nice touch, though. =)
Comment 11 awendt 2007-03-11 04:16:00 UTC
Region mode stops and waits for you to draw a rectangle with the mouse, so at the moment that KSnapshot grabs the screen contents, the mouse cursor would always be positioned at the very corner of the rectangle you just drew. KSnapshot also changes the cursor to a crosshair while you're doing this. That's why the patch disables the mouse cursor grabbing when in region mode.

I don't know how you'd make them compatible... stop and wait for a subsequent mouse click inside the rectangle you just drew?
Comment 12 Aaron J. Seigo 2007-03-11 04:43:36 UTC
how about capturing the mouse cursor at the moment the screen capture is made and blit the cursor image onto the screen capture? then the user can select the desired region.
Comment 13 awendt 2007-03-11 07:42:28 UTC
I suppose that'd be a good way to do it. The "snapshot delay" is currently disabled in region mode also, though, so there's no chance to move the mouse to the correct spot before the screenshot is acquired.
Comment 14 Janet 2007-05-04 23:38:06 UTC
*** This bug has been confirmed by popular vote. ***
Comment 15 Richard Hartmann 2008-08-07 20:18:56 UTC
Any updates on this?

I would bump the version to 0.8.1, but that is not an option I can choose, at the moment.
Comment 16 Tristan Miller 2008-10-01 18:27:52 UTC
The screenshot plugin for GIMP 2.6, which was released today, now includes the option to capture the mouse pointer.  According to the release notes at <http://gimp.org/release-notes/gimp-2.6.html>, it uses XFixes.  This is the same extension used by awendt@putergeek.com's patch.  Any chance of getting this patch applied to the main development branch?
Comment 17 Dotan Cohen 2008-10-09 17:30:25 UTC
With KDE 4 is this possible now?
Comment 18 Richard Moore 2008-10-09 18:18:27 UTC
Yes, this is now possible thanks to improvements to the X server (specifcally the XFixes extension). It will get implemented, however I haven't had time to look into it yet.
Comment 19 Pino Toscano 2009-02-14 11:54:05 UTC
*** Bug 184287 has been marked as a duplicate of this bug. ***
Comment 20 John Tapsell 2010-01-10 16:00:28 UTC
Can we get these patches committed?
Comment 21 John Tapsell 2010-01-11 23:11:41 UTC
Created attachment 39791 [details]
Updated patch to add the cursor

This patch updates the previous one to port it to Qt4, cmake, etc.  Also adds support for window section mode.  It also fixes a bug with ksnapshot when selecting the last option in ksnapshot.
Comment 22 Pino Toscano 2010-01-11 23:23:26 UTC
Created attachment 39792 [details]
Another implementation

Sorry for the delay; this is patch it's been sitting locally for a couple of months, and forgot to send it to Richmoore earlier (done that a couple of days ago).

Different implementation, not based on the previous patches here.
Comment 23 John Tapsell 2010-01-11 23:47:44 UTC
Cool.  My patch has the advantages:

1) Disables/enables the checkbox depending on whether the mode supports it or not
2) Supports the Window Section mode
3) Loads the cursor straight into a ARGB32_Premultiplied
Comment 24 John Tapsell 2010-01-11 23:51:50 UTC
4) Saves/Loads the value
Comment 25 John Tapsell 2010-01-12 00:34:05 UTC
Created attachment 39797 [details]
Updated for 64bit

This updates the code to work (untested) on 64bit, based on pinotree's code.
Comment 26 Pino Toscano 2010-01-12 00:43:45 UTC
Created attachment 39799 [details]
Fixed implementation of mine

This works on both 32bit and 64 bit (tested), saves the option value and what not.
Comment 27 John Tapsell 2010-01-12 01:04:01 UTC
I committed the fix I mentioned before when selecting the Current Screen.
Comment 28 John Tapsell 2010-01-12 01:36:16 UTC
The two patches are becoming more and more similar now.

I think the only changes now are:

1) I enabled/disable the gui option when you change modes
2) I support the window section mode
Comment 29 John Tapsell 2010-01-12 03:50:54 UTC
For multiple cursor support we need to:

1) Use XIQueryDevice(XIAllMasterDevices)   and find all the devices that are XIMasterPointer
2) Remember the current XGetClientPointer(dpy)
2) For each one found, do XSetClientPointer(dpy, pointer, None)
3) Now when we do XFixesGetCursorImage(dpy) we will get the image of the current cursor
4) XSetClientPointer the cursor back to the original one
Comment 30 Christoph Feck 2010-06-12 20:08:55 UTC
*** Bug 241472 has been marked as a duplicate of this bug. ***
Comment 31 ThorbjørnTux 2010-06-12 21:21:59 UTC
Created attachment 47953 [details]
to get mouse cursor
Comment 32 ThorbjørnTux 2010-06-12 21:35:25 UTC
#31 is a patch

Just to state what I wrote in Bug 241472 

The code is heavily inspired by
http://msnkambule.wordpress.com/2010/04/09/capturing-a-screenshot-showing-mouse-cursor-in-kde/ 
Thanks to Mayibongwe Nkambule.

/Thorbjørn
Comment 33 ThorbjørnTux 2010-06-21 20:00:58 UTC
Could somebody please test - and probably merge my patch into trunk?
Comment 34 ThorbjørnTux 2010-06-21 20:24:04 UTC
Sorry, I am stupid enough not to read the whole thread.
Did not notice that serveral patches was made. Maybe somebody could include just one patch.

PS: My patch does not support multiply cursors.
Comment 35 Jens Pranaitis 2010-06-21 21:00:16 UTC
I have some weird rendering glitches with your patch. I applied it to ksnapshot 4.4.4. Screenshot: http://chaox.net/~jens/test1.png
Comment 36 Aaron J. Seigo 2010-06-21 21:54:34 UTC
i've merged John's patch with some modifications (in part to make it apply cleanly against trunk, in part to alter the strings and some of the logic) and also added code to remove the "Current Screen" option when there is only one screen on the system. i will commit once 4.6 is open since we are currently in string freeze and this change contains a new string.

i will credit both John and tmartsum in the commit message. cheers!

@Jens: when you say "your patch", do you mean tmartsum's or John's?
Comment 37 ThorbjørnTux 2010-06-22 07:31:44 UTC
#36
Thanks a lot for patching trunk. I will look into the code.

#35 
It is probably against my patch, but I haven't seen anything similar. Does it happen all the time? (Both from ksnapshot and PrtSc), Nevertheless you can test against trunk now, but I doubt there are that many ways to grab the cursor - and John patch probably works in a similar way.

I use:
XFixesCursorImage *xfcursorImage = XFixesGetCursorImage( QX11Info::display());
QImage mouseCursor( (uchar*)xfcursorImage->pixels,xfcursorImage->width, xfcursorImage->height, QImage::Format_ARGB32_Premultiplied );

Could it be that this only happens if you press PrtSc or does it happen from knsapshot itself? I had some problems *not* getting a waiting cursor when ksnapshot was loading (on PrtSc) - and I wonder if this could be a timing issue. (Meaning happening when PrtSc was pressed and when mouse-cursor was changing back to normal cursor pointer. Meaning that the *xfcursorImage is getting invalid.)
Comment 38 ThorbjørnTux 2010-06-22 19:10:52 UTC
Ok - misunderstood. Can you inform when the code is in trunk - then I like to test it.
Comment 39 Anselmo L. S. Melo (anselmolsm) 2010-06-29 20:39:37 UTC
*** Bug 237941 has been marked as a duplicate of this bug. ***
Comment 40 Christoph Feck 2010-09-30 02:34:48 UTC
The code is in trunk, please test.
Comment 41 ThorbjørnTux 2010-10-14 22:19:26 UTC
It DID work at some point, but currently I can *not* get it to work right.
(On start no mouse-cursor (or did I see it one time) on delayed snapshots no mouse cursor ...)
Comment 42 JanKusanagi 2010-12-11 00:54:14 UTC
It seems to work fine here, with 4.6 beta 2, under Archlinux.
Video chipset Intel 855GM with intel driver v2.13.0, in case that matters.

It works on the first snapshot and the ones after that, with and without desktop effects.
Comment 43 Janet 2010-12-19 18:57:58 UTC
I've just tested with 4.6 beta 2 and Kubuntu, does work very well. BTW: I like the new layout of ksnapshot a lot!
Comment 44 SlashDevDsp 2010-12-25 06:56:41 UTC
kubuntu 10.10 with kde 4.6 RC 1, enabling the Include mouse pointer, does not work, I have:

Capture mode: window under cursor
snapshot delay: 2 seconds

And the window I am capturing is:
dolphin->places->network->add network folder wizard->select secure shell (ssh) and click next, press 'take a snap shot' and mouse over any of the fields or the text 'save & connect' button in the network folder wizard and the resulting image does not have the mouse pointer.
Comment 45 Janet 2010-12-26 15:06:56 UTC
I can confirm that. It did work with Beta2 but doesn't work anymore with RC1. No matter which settings, first start or not, delay or not, region, window, fullscreen.
Comment 46 Kai Uwe Broulik 2010-12-26 15:13:52 UTC
It seems to work when using “Window under mouse pointer” but no longer when doing a fullscreen shot.
Comment 47 Kai Uwe Broulik 2011-03-10 22:40:28 UTC
It seems to work with fullscreen shot but NOT when using a Screenshot delay.
Comment 48 Markus Elfring 2011-03-13 14:02:36 UTC
The mouse pointer is not included in my screen shots by the tool "KSnapshot 0.8.2" (KDE 4.6.0) that is running on my openSUSE 11.4 system if I select the modes "full screen" or "area in a window".
Comment 49 Victor Varvaryuk 2011-06-23 13:58:55 UTC
The same here. Sometimes mouse pointer is included in the screenshot. Sometimes not. Cannot figure out the circumstances when it works or doesn't.
Comment 50 Kolia 2011-09-28 06:18:43 UTC
With Ksnapshot 0.8.2 and KDE 4.7.1 the behavior of the "include mouse cursor" is still chaotic. It works sometimes, and sometimes not. Today, I can get the cursor when taking the screenshot on a Firefox window, but i don't get the cursor if I'm over a Digikam window :)
Comment 51 Unknown 2012-09-19 12:09:05 UTC
This bug is still present in KDE 4.9.1.
When you choose „Full screen” and check the mouse cursor check box, KSnapshot doesn't draw the cursor to the resulting image.
Comment 52 Dotan Cohen 2012-10-15 15:13:27 UTC
Happy decade, bug!
Comment 53 Apopas 2013-01-17 14:27:48 UTC
I confirm this bug in KDE 4.9.5 and fullscreen selection.
Comment 54 JenyaYQ 2013-03-12 05:45:41 UTC
I can confirm it with Chakra Linux + KDE 4.10 with latest nvidia drivers.
Comment 55 Kyrylo Bohdanenko 2013-06-06 21:02:44 UTC
Created attachment 80358 [details]
Cursor, capruted on screenshot (made with ksnapshot)

With update to KDE 4.10.4 I can capture my cursor on snapshots, made with KSnapshot. I'm using:
* Kubuntu 13.04 x86_64
* KDE 4.10.4
* Xorg 1.13.3
Comment 56 Ian Turner 2013-06-06 22:49:03 UTC
This is fixed for me also on 10.4.2.
Comment 57 Aaron J. Seigo 2013-06-07 08:01:11 UTC
I get the feeling that this may be related to X versions and drivers. Here with Intel drivers and Xorg 7.6 tings are not as happy: I get mouse cursors in window shots, but not full screen. Will require some sleuthing in the code to see what is going wrong with the cursor grabbing.
Comment 58 Ian Turner 2013-06-07 11:54:30 UTC
FWIW I get the cursor with both window shots and full screen.

I have X.Org X Server 1.11.3 running intel_drv.so 2.17.0.
Hardware is Sandybridge Mobile (GT2). There is an nvidia Optimus chip also, but I think it is disabled.
Comment 59 Andrew Crouthamel 2018-09-04 04:20:35 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!