Commit Graph

14 Commits

Author SHA1 Message Date
Florian Müllner
c68ccbf263 screenshot: Check for NULL window in screenshot_window()
screenshot_window() currently assumes a focus window, which will
result in a crash if that's not the case.

https://bugzilla.gnome.org/show_bug.cgi?id=700625
2013-05-19 15:32:06 +02:00
Giovanni Campagna
9b9f33bc8b Use the right conversion from cairo to GdkPixbuf
GdkPixbuf is stored in memory as individual bytes, in strict red-green-blue-alpha
order, while cairo image surfaces are stored as 32bits units whose
order depends on the endianess.
It is probably possible to do something better, taking advantage
of cogl and the GL using the actual component order, but for now
it is easier to use the GDK utility to convert the cairo surface.

https://bugzilla.gnome.org/show_bug.cgi?id=693931
2013-02-16 04:09:21 +01:00
Adel Gadllah
eb5a836822 screenshot: Write metadata to png file
Use GdkPixbuf rather then cairo_surface_write_to_png_stream when saving
screenshots because this allows us to embedded metadata into the file which
is used by the background control panel to filter out screenshots.

https://bugzilla.gnome.org/show_bug.cgi?id=693737
2013-02-14 19:21:15 +01:00
Adel Gadllah
cdc4f85e47 shell-screenshot: Fix cursor fetching for non single window screenshots
We have to mark the cairo_surface dirty after modifying the data behind
cairo's back.

Also use CAIRO_FORMAT_ARGB32 rather then CAIRO_FORMAT_RGB24 for the
surface to be consistent with the rest of the code.

https://bugzilla.gnome.org/show_bug.cgi?id=691715
2013-02-11 19:53:54 +01:00
Cosimo Cecchi
e4860acb58 screenshot: use g_file_replace() when using an absolute path
Instead of g_file_create(), which always fails if the file exists
already.
2013-01-03 15:02:00 +01:00
Cosimo Cecchi
3a4e595d32 screenshot: save to an unique path when using a basename
When a basename is passed, avoid filename conflicts. The unique path is
returned by the API.

https://bugzilla.gnome.org/show_bug.cgi?id=688004
2013-01-03 12:56:45 +01:00
Cosimo Cecchi
dcad22bfa8 screenshot: change API to return the filename used for saving
Since we also support passing a basename now, clients might be
interested in knowing the path used to save the file.
Add an out argument to the interface for that.

https://bugzilla.gnome.org/show_bug.cgi?id=688004
2013-01-03 12:56:45 +01:00
Cosimo Cecchi
acba0e47d8 screenshot: support non-absolute paths when saving screenshots
If a non-absolute path is passed to the screenshot methods, treat it as
a basename for the output image, and automatically try to save it in
$XDG_PICTURES_DIR, falling back to $HOME if it doesn't exist.

https://bugzilla.gnome.org/show_bug.cgi?id=688004
2013-01-03 12:56:45 +01:00
Neil Roberts
7f8bfcc939 Remove shell-screen-grabber
The screen grabber was a workaround for an extremely slow path in Mesa
when reading back pixel data from the frame buffer. It was using pixel
buffer objects by directly calling into GL to hit a fast blit path in
Intel's driver. This should no longer be necessary with the latest
Mesa because the normal read pixels path now has a fast path to just
memcpy the data. Using PBOs in that case just adds an extra
indirection because the data is read into an intermediate buffer and
then copied back out again.

We want to be able to remove the dependency on linking against libGL
directly from Gnome Shell because that will not work if Cogl is
actually using GLES. Also libGL includes GLX which means gnome-shell
ends up with a hard dependency on Xlib which hinders the goal of
getting Gnome Shell to be a Wayland compositor.

https://bugs.freedesktop.org/show_bug.cgi?id=46631

https://bugzilla.gnome.org/show_bug.cgi?id=685915
2012-11-12 19:07:57 +01:00
Giovanni Campagna
55a4517cd1 Fix documentation warnings
gobject-introspection now emits many more warnings for malformed
comments, and they fail the build.

https://bugzilla.gnome.org/show_bug.cgi?id=673656
2012-04-09 19:57:51 +02:00
Jasper St. Pierre
2b87bb015c screenshot: Ensure that ShellScreenshot stays alive until the callback
We've been dangling on the edge of unsafety, unnoticed, for a little while
about the reference count safety of ShellScreenshot. GJS owns the entire
reference count, so as soon as it goes out of scope it could die, causing
GJS to try and fetch the corresponding wrapper object for a stale pointer.
We haven't seen any crashes because of luck -- SpiderMonkey tries to group
together deallocations to limit GC pauses, and there isn't really a lot
of GC pressure in the duration that a screenshot happens, so we tend to
be mostly stable. But in the case that you create a lot of objects while
a screenshot is going on, by hammering the "Print Screen" button, for
example, you can destroy the GObject before the callback finishes.

https://bugzilla.gnome.org/show_bug.cgi?id=672775
2012-03-26 12:54:07 -03:00
Jasper St. Pierre
07e10fa03e screenshot: Remove harmful empty finalizer
We really should be chaining up in the finalizer, but instead of leaving
an empty finalize, remove it entirely.

https://bugzilla.gnome.org/show_bug.cgi?id=672775
2012-03-26 12:54:07 -03:00
Cosimo Cecchi
c20503028a screenshot: add missing shell_screenshot_new()
And fix its declaration.
2012-02-14 15:57:34 -05:00
Adel Gadllah
4516e4cc3b screenshot: Split into separate file / class
Split the screenshot functionality from ShellGlobal into its own class.

https://bugzilla.gnome.org/show_bug.cgi?id=670086
2012-02-14 21:10:08 +01:00