GNOME Bugzilla – Bug 155061
Screenshot of an user-defined selection.
Last modified: 2009-04-28 18:25:26 UTC
one thing that might be nice to gnome-panel-screenshot you have the possibility of drawing a box on your screen and it takes a screenshot of that area a bit like the rubberband select on the desktop when you take a screenshot you have a minute or two to draw a box
*** Bug 157719 has been marked as a duplicate of this bug. ***
*** Bug 310512 has been marked as a duplicate of this bug. ***
Created attachment 49327 [details] [review] Patch against the CVS HEAD Start gnome-screenshot, and click on the "Selection" button. 1. A small popup window is created at the right bottom indicating the cursor positon and the main dialog closes. 2. Selection has to be made using the cursor. 3. Pressing ESC, closes the dialog. 4. After making the selection, the normal screenshot dialog opens and the selection can be saved.
Can anyone help me in drawing a selection rectangle, like Rubberbanding action, as done on the desktop. I tried out, but couldn't implement that properly,. Once that is done, then, this feature will be nice.
*** Bug 313174 has been marked as a duplicate of this bug. ***
*** Bug 334063 has been marked as a duplicate of this bug. ***
i believe that the screenshot dialog box should have a checkbox to select between full screen screenshot and box sized screenshot....If checked it lets you draw a box on the screenshot preview, and save it....What you guys think? i can work on that.
*** Bug 538918 has been marked as a duplicate of this bug. ***
a simple way to do this would be modifying screenshot_get_pixbuf() inside screenshot-utils.c to take a GdkRectangle for the geometry of the area to grab. then take a screenshot of the full desktop and copy a sub-area of the resulting GdkPixbuf. it's not complicated, and in fact I had some code to select the area, but it's not finished.
Great work :) This would be a very nice feature! A keyboard binding should also be created so you can take screenshots "on-the-fly" using something like "Shift + PrintScreen + mouse-defined area" (or something more ergonomic).
*** Bug 559143 has been marked as a duplicate of this bug. ***
Marking the patch as "obsolete", as it does not apply anymore to gnome-screenshot trunk.
Created attachment 129387 [details] [review] Woohoo, new patch :-) Here's a nice patch to implement this. It works fine here. The only thing I'm not happy with is the code to draw a rectangle for the selection: I stole this from the GIMP, but it's still some X calls. I don't know if it's possible to do this any other way. (well, in the composited case, we can use cairo on a semi-transparent window, there's even a FIXME for that)
Oops. check_file_done() has some unused variables with the patch. Easy to fix :-)
Comment on attachment 129387 [details] [review] Woohoo, new patch :-) Vincent, thanks for the great patch. >+select_area_filter (GdkXEvent *gdk_xevent, >+ GdkEvent *event, >+ gpointer user_data) >+{ >+ select_area_filter_data *data = user_data; >+ XEvent *xevent = (XEvent *) gdk_xevent; >+ >+ switch (xevent->type) >+ { >+ case ButtonPress: We've done some work in the previous cycle to avoid X calls as much as possible, replacing them with GDK where possible. Can't you use the values within the GdkEvent here instead of poking at the XEvent? >+gboolean >+screenshot_select_area (int *px, >+ int *py, >+ data.x_gc = XCreateGC (gdk_display, >+ GDK_WINDOW_XID (root), >+ GCFunction | GCPlaneMask | GCForeground | GCLineWidth | >+ GCLineStyle | GCCapStyle | GCJoinStyle | >+ GCGraphicsExposures | GCBackground | GCFillStyle | >+ GCClipXOrigin | GCClipYOrigin | GCClipMask | >+ GCSubwindowMode, >+ &gc_values); Same here, I believe you can do the same with GdkGC, GdkGCValues and gdk_draw_rectangle(). The rest looks good to me. Can you please post an updated patch without direct X calls?
(In reply to comment #15) > (From update of attachment 129387 [details] [review] [edit]) > Vincent, thanks for the great patch. > > >+select_area_filter (GdkXEvent *gdk_xevent, > >+ GdkEvent *event, > >+ gpointer user_data) > >+{ > >+ select_area_filter_data *data = user_data; > >+ XEvent *xevent = (XEvent *) gdk_xevent; > >+ > >+ switch (xevent->type) > >+ { > >+ case ButtonPress: > > We've done some work in the previous cycle to avoid X calls as much as > possible, replacing them with GDK where possible. > Can't you use the values within the GdkEvent here instead of poking at the > XEvent? From the gdk_window_add_filter() doc: "When a filter is called, event is unpopulated, except for event->window." So, hrm, no, we can't :-) > >+gboolean > >+screenshot_select_area (int *px, > >+ int *py, > > >+ data.x_gc = XCreateGC (gdk_display, > >+ GDK_WINDOW_XID (root), > >+ GCFunction | GCPlaneMask | GCForeground | GCLineWidth | > >+ GCLineStyle | GCCapStyle | GCJoinStyle | > >+ GCGraphicsExposures | GCBackground | GCFillStyle | > >+ GCClipXOrigin | GCClipYOrigin | GCClipMask | > >+ GCSubwindowMode, > >+ &gc_values); > > Same here, I believe you can do the same with GdkGC, GdkGCValues and > gdk_draw_rectangle(). Oh, sure. I wanted to do this with cairo, but I can't manage to directly draw on the root window with it :/ But gdk_draw_rectangle() is possible.
Created attachment 129407 [details] [review] Updated patch Use gdk_draw_rectangle(). There's still XKeysymToKeycode(). Don't know how to get rid of this, and I suspect it's not easily possible.
I asked release-team a freeze break to get this feature in for 2.26. Otherwise, it's fine to commit it after branching.
release-team and gnome-i18n both gave their approvals, so I committed this to trunk. Thanks again for the cool patch! 2009-02-27 Cosimo Cecchi <cosimoc@gnome.org> * gnome-screenshot.c (target_toggled_cb), (create_screenshot_frame), (finish_prepare_screenshot), (async_existence_job_free), (check_file_done), (find_rectangle), (prepare_screenshot), (main): * screenshot-utils.c (select_area_button_press), (select_area_button_release), (select_area_motion_notify), (select_area_filter), (screenshot_select_area), (screenshot_get_pixbuf): * screenshot-utils.h: add support for taking a screenshot of an user-defined selection. Patch by Vincent Untz, bug #155061.
*** Bug 578349 has been marked as a duplicate of this bug. ***
Hi, I've updated to Gnome 2.26.1, but I don't see any option for a selection. Is it fixed for 2.28? Thanks.
(In reply to comment #21) > I've updated to Gnome 2.26.1, but I don't see any option for a selection. Is it > fixed for 2.28? My mistake. It's in Gnome 2.26.1, but I was opening the software by the "Print Screen" key. We can see all options with this: gnome-screenshot --interactive