GNOME Bugzilla – Bug 171151
showing the cursor in the screenshot
Last modified: 2008-04-07 14:45:52 UTC
For some kinds of screenshots, you really want the cursor to be visible, to make it clear what's going on. (Screenshots of drag-and-drop are probably the biggest example). This patch adds support to gnome-panel-screenshot for that. Mostly. It: - uses Xfixes to get the cursor image - adjusts the location according to whether it's a fullscreen or window snapshot, and whether or not there's a border - adds a checkbox to the dialog allowing you to decide whether or not to include the cursor (or rather "pointer", as the doc guidelines say to call it) in the screenshot - updates the preview to reflect the checkbox But it doesn't actually support saving the screenshot with the cursor in it, because the save code is kinda weird and I had no idea what the right way to do that would be.
Created attachment 39038 [details] [review] the code
So, implementing this in the save code is a little funny. The way it does saving is by forking and calling gdk_pixbuf_save() in the child so that we have a copy on disk (as gdk_pixbuf_save() can take a noticeable amount of time on fullscreen shots. ) We then call gnome_vfs_xfer() to get the image to the right location once chosen. It also makes DnD nicer, as we have the file saved when you start a target. People have requested other saving extentions, though (pdf, gif..) so this old approach might be wrong. Or we could just save over the old one when you change formats/or show the cursor.
Created attachment 48806 [details] [review] completed patch Finished patch, with saving code. I just added a screenshot_save_again() function that cancels the currently-pending save and starts a new one (using the same callback as before), and then tweaked things to make sure you can't accidentally save the old screenshot while it's busy writing the new one.
works here. I'm using to update the cursor images for the UG in 2.14. although it doesn't apply against head (I checked out a copy of gnome-utils from July 8th) and I had to run it from the checkout directory, otherwise it couldn't find the glade file. See http://bugzilla.gnome.org/show_bug.cgi?id=330123
poke! http://davyd.livejournal.com/208614.html What's the status here? (besides "the patch doesn't apply to trunk") Is the idea bad? Is the UI bad? Is the code bad?
too late for the 2.18 release: it changes the UI. also, I'll have to move the checkbox into the new interactive dialog (and not in the save dialog) and add a command line switch for it. definitely pinned down for 2.19.
Patch doesn't look quite correct to me; XFixesGetCursorImage gives you premultiplied alpha, gdk-pixbuf uses non-premultiplied alpha. Before finding this bug, I've independently written a similar patch. I'll attach it below. Maybe that helps with closing this bug...
Created attachment 107425 [details] [review] alternative patch Note, my patch misses some of the configury bits from Dans.
By removing the pointer grab, my patch also fixes the screenshootability of tooltips and menus...
patch looks fine. Matthias, can you apply it with the configure fixes as well? otherwise I'll try to do it later today.
2008-04-07 Matthias Clasen <mclasen@redhat.com> Bug 171151 – showing the cursor in the screenshot * screenshot-utils.h: * screenshot-utils.c (screenshot_get_pixbuf): Optionally include the cursor in the image. (screenshot_grab_lock): Don't grab the pointer while taking the screenshot. * gnome-screenshot.schemas.in: * gnome-screenshot.c: Add an 'include pointer' option.