Commit Graph

44801 Commits

Author SHA1 Message Date
1ba2e11c91 plug-ins: move KDE portal for screenshot as fallback to the X…
… implementation and Freedesktop portal.

This is an alternative to commit ef9c483771 (`master` branch) for the
2.10 series. On the dev branch, we simply get rid of the KDE portal
implementation, on the basis that by the time that GIMP 3 gets released,
most KDE users will have a recent-enough KDE with featureful Freedesktop
portal.

Yet for the 2.10 series, I am wary that there might still be many KDE
installations where maybe there is not even a Freedesktop portal. So I
just switch the test order. Now we use the X implementation in priority,
if we are running in X (it's still the most featureful and robust
version anyway). Then we test the Freedesktop portal. And finally we
test the KDE portal. I am guessing that if we encounter a KDE
installation with no Freedesktop portal but a KDE one, it's an old
version so we won't have permission issues.

See issue #5785.
2021-12-17 20:24:23 +01:00
672931b39d plug-ins: fix previous commit, bumpmap should be bumpmap_id 2021-12-17 12:49:21 -05:00
468c067d65 plug-ins: fix #5305 Lighting Effects crashes when I use a channel as Bumpmap
When a channel is selected as bumpmap, the bump_format can be different
than it was before. However, we always kept the first bump_format, which
could be RGB, in which case trying to use it with a channel caused a
crash in GIMP.

To fix this we always update the bump_format if bumpmap is enabled.

(cherry picked from commit 7b7d616358)

# Conflicts:
#	plug-ins/lighting/lighting-image.c
2021-12-17 12:12:30 -05:00
dc8023b952 Fix compiler errors for XDG pickbutton impl
I forgot that we were on GTK 2 here :D
2021-12-15 08:57:56 +01:00
dcf0f9e7f4 libgimpwidgets: Use Screenshot portal for picking
Freedesktop (XDG) portals are a collection of D-Bus APIs that work
across desktop environments, display servers and work within
containerized applications, like Flatpak. The internal implementation
can then choose to implement these in such a way that takes into account
security considerations, as well as making sure the user consents to
certain actions.

One such portal is the `Screenshot` portal, which contains a
`Screenshot()` method as well as `PickColor()`. We already use the
former for taking a screenshot, and this commit makes sure our color
picker also makes use of the latter.

By doing this, color picking is now possible on the major Wayland
compositors.

(Honestly, we should remove DE-specific backends like that of KWin, to
have less variation on the possible results of a color picking
operation).

Fixes https://gitlab.gnome.org/GNOME/gimp/-/issues/1074

(cherry picked from commit e82f6d5b0f)
2021-12-15 08:34:08 +01:00
566be5e986 app: do not use PATH_MAX and realpath() on macOS.
See the comments in MR!424.
Basically realpath relies on false assumptions (probably ones which used
to be true when the API got created) on the max size of a path. Actually
nowadays paths can be much bigger than what the macro advertizes or can
even be unbounded.
The Linux version of realpath() allows the second parameter to be NULL,
in which case it would allocate the buffer, exactly for this reason
(written in the BUGS section on the man). Unfortunately this behavior is
not standardized in POSIX and the man from Apple I found does not
indicate it will do this.

So let's use g_canonicalize_filename() instead, which seems to do the
right thing. Similarly use g_strdup_printf instead of g_snprintf().

Cherry-picked from commit 6f4fac7715eb66a90727f931246c93cd8e13a819 with
some conflict resolution.
2021-12-14 23:14:04 +01:00
c375b2349a screenshot: Remove GNOME Shell implementation
GNOME Shell has started restricting access for it's Screenshot D-Bus API
to internal components only [1] for security reasons. In other words,
this will start failing, so remove it in favor of just using the
freedesktop portal, which should always work.

[1]: https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970

(cherry picked from commit 62953e6830)
2021-12-14 16:14:30 +01:00
56673462c9 Update Lithuanian translation 2021-12-13 14:35:32 +00:00
8c9f70f202 Update Lithuanian translation 2021-12-13 14:32:48 +00:00
983b9f277e Update Swedish translation 2021-12-04 14:29:19 +00:00
48fa390e3f plug-ins: Fix previous cherry picked commit.
In 2.10 we need to use id's.
2021-12-01 21:56:15 -05:00
778f811e8a plug-ins: fix #7566 Import Issues with Indexed .dds Images
This proved to be both an import and export issue.
Our import set expected format as RGB, causing garbled image output.
Our export for indexed images converted to grayscale first, although the
palette was correctly saved. This caused wrong palette indexes on import.

For indexed images, on import, we request the actual indexed format after
creating the layer with gimp_drawable_get_format, which gives us a correct
indexed Babl format.
Also added logic for indexed with alpha, although I have no sample images
to test this.
For indexed images on export we do the same: use gimp_drawable_get_format
to get an actual indexed Babl format.

(cherry picked from commit dec5ca2219)

# Conflicts:
#	plug-ins/file-dds/ddsread.c
2021-12-01 15:21:18 -05:00
c2d94121ca Update Catalan translation 2021-11-30 12:53:05 +01:00
cc2660070c devel-docs: bump official macOS support to 10.12 on stable 2.10…
… series as well (it was already so in the `master` branch).

See discussion:
https://gitlab.gnome.org/GNOME/gimp/-/issues/7515#note_1318891

Basically it's probably possible to backport some changes and still
support an older version, but we clearly lack contributors on macOS so
the current unique one's decision matters most.
2021-11-26 23:43:06 +01:00
0a0cb402f2 Update Spanish translation 2021-11-23 16:55:53 +00:00
6b825b1b0c Update Slovenian translation 2021-11-22 16:05:00 +00:00
397e1ce2d8 Update Slovenian translation 2021-11-22 16:00:22 +00:00
57f20f6fac plug-ins: fix #7109 exported gimp .jpg not processable in Windows Photo Viewer
In cases where the whole EXIF MakerNote is invalid we still load that
MakerNote data and export it too, causing partial invalid EXIF metadata.
We don't need to explicitly save Exif.Photo.MakerNote at all, because
as soon as we try to save a brand specific tag exiv2 will create that
MakerNote tag itself.
So from now we don't save the MakerNote but only the tags that go in it.
In issues like #2159 where exiv2 doesn't parse all tags inside certain
brand specific MakerNotes correctly, we will still export invalid EXIF.
That is an exiv2 issue that we can't do much about unless we remove all
MakerNote metadata including those that we can read, which doesn't seem
like a good idea at all.

(cherry picked from commit 6840bb9eba)
2021-11-21 18:42:06 -05:00
b2396ec9d8 app: fix #383 Large PBM files exported from GIMP are blank
Fix as suggested by Massimo with formatting adjustments by me.
The use of gulong and glong is not cross platform safe: on Windows it is
32-bit and on most other platforms 64-bit.

Let's use guint64 and gint64 instead.

(cherry picked from commit d2c5591088)
2021-11-14 18:27:39 -05:00
d71aec77be Update Catalan translation 2021-11-14 14:44:53 +01:00
dbd07a4f3f Update Polish translation 2021-11-14 14:28:21 +01:00
12877380b3 Update Portuguese translation 2021-11-13 17:40:19 +00:00
13f16221be Update Croatian translation 2021-11-12 14:12:32 +00:00
adb1330176 Update Croatian translation 2021-11-12 14:09:51 +00:00
84000a25a2 Update Ukrainian translation 2021-11-09 14:17:26 +00:00
6a522847d8 Update Spanish translation 2021-11-09 00:01:59 +00:00
2a31678e9c app: fix #6436 *.gih grayscale export crashes GIMP
When we try to export a grayscale image with layers with negative offsets
to a GIH brush GIMP crashes without producing any crashlog.
Running in GDB showed us that there is heap corruption caused by incorrect
computation of buffer sizes because of the negative offsets.

In file_gih_image_to_pipe there is a comment that offsets are assumed
positive, but no checking is done whether that is correct.
Let's add some checks, set offset to 0 if negative and adjust width and
height accordingly.

(cherry picked from commit e2b1cc9476)
2021-11-08 17:11:52 -05:00
d9f562a39d Update Latvian translation 2021-11-08 20:50:48 +00:00
3946710923 Update Latvian translation 2021-11-08 19:45:50 +00:00
4c2719b430 Update Spanish translation 2021-11-06 18:18:00 +00:00
dd79d2aa73 Update Latvian translation 2021-11-04 19:30:47 +00:00
fd113de4bc Update Latvian translation 2021-11-04 19:03:29 +00:00
a0c19f22d6 Update Latvian translation 2021-11-04 18:57:56 +00:00
72c5bec0ce Update Latvian translation 2021-11-04 09:57:02 +00:00
347bb5067d libgimpbase: fix #7383 GIMP loses exif data when a folder has Hebrew letters
On Windows when exporting an image saving the exif and other metadata fails
if the path or filename includes non ASCII characters.
Reason is that gexiv2 changed to using utf-8.

In the past we had to convert the filename to current locale on Windows,
but since it now also expects utf-8 there, just remove the special
handling of filename there.

(cherry picked from commit 8e1f982945)
2021-11-02 12:07:11 -04:00
1948f1f474 Update Polish translation 2021-10-31 10:55:08 +01:00
a2e520bf22 plug-ins: fix memory leak in HEIF import/export 2021-10-29 12:00:00 +00:00
6f13c5b21f plug-ins: fix incorrect loading of CMYK PSD images without layers.
PSD images using CMYK as color mode and without layers didn't load
correctly (wrong colors).
When a PSD does not have any layers, CMYK color mode was not converted to
RGB.
Note that PSD color images that do have layers (e.g. CMYK and LAB) store
the merged image as RGB!
To do all this we added a conversion for CMYK PSD with 0 layers and added
code to correctly determine whether an alpha channel exists.
This also fixes the case where loading the merged image of a 16 bit per
channel RGBA psd loads with the alpha channel opaque.

(cherry picked from commit b7518195b5)
2021-10-27 19:18:38 -04:00
cfaf761ed9 Update Portuguese translation 2021-10-27 15:19:14 +00:00
ce41642ddd plug-ins: fix incorrect CMYK transform for the variant without alpha
Probably due to a copy-paste error the case without alpha was also using
the img->cmyk_transform_alpha instead of img->cmyk_transform.

(cherry picked from commit 5115021eac)
2021-10-26 18:05:34 -04:00
7ebff6ed28 plug-ins: fix #7429 Error loading PSD file: Unsupported or invalid layer mask height
Our psd plug-in checks for valid layer mask sizes. Apparently a psd
layer mask where the rendered flag is set can have invalid dimensions
0, 0, 0, -1.
We will skip the sanity checks for rendered layers and at the same time
move the debug statements up to have relevant debug info available even
if our sanity checks stop further processing.

(cherry picked from commit b27bf5caa9)
2021-10-26 12:29:52 -04:00
caa91ac051 Update Ukrainian translation 2021-10-26 06:51:21 +00:00
5d57183b7a Update Catalan translation 2021-10-25 22:50:08 +02:00
c35f6605e6 Update Swedish translation 2021-10-25 18:35:21 +00:00
1d44b45f09 plug-ins: prefer AOM encoder for AVIF export
Name of the used encoder is printed during export,
It can be: aom, rav1e, x265
2021-10-25 15:52:30 +00:00
398dbbe01b plug-ins: fix several issues detected by coverity
Detected issues fixed here:
- Use GString and g_string_append since otherwise we need to add g_free
after every g_strconcat.
- No error checking.
- We need to g_free value_utf.

Not detected by coverity:
- Wrong quotes around utf-8.
- Remove unused includes.

(cherry picked from commit 641080c838)
2021-10-24 22:17:32 -04:00
9cfaf37c75 plug-ins: fix resource leaks detected by coverity
Several resource leaks here were detected by coverity:
- Not freeing value_utf.
- Strings returned by g_strconcat should be g_free'd. To handle the string
concatenations easier we use GString and g_string_append instead.
Also introduce function get_list_elements to reduce the number of
repetetive elements.
While we were at it, also remove unused includes.

(cherry picked from commit e90f041ca5)
2021-10-24 22:17:15 -04:00
a9867d020a plug-ins: fix #7408 metadata-editor plugin cashing when saving metadata
When writing metadata in the metadata-editor it did not check for empty
values. In combination with gexiv2 0.14.0 (which doesn't check in this
specific case for an empty list of gchar **) and trying to set a non
repeatable Iptc tag (Iptc.Application2.Headline) using
gexiv2_metadata_set_tag_multiple we get a crash.

This fix checks first for a non empty value before trying to save the
metadata tag.
Since the code is very similar also implemented this check for the Xmp
tags in addition to the Iptc and simplified some duplicate code.

(cherry picked from commit 6eba73e714)
2021-10-24 13:45:41 -04:00
3ed924d731 plug-ins: Iptc.Application2.Headline is not a repeatable tag
See issue #7408 where this is causing a crash when using gexiv 0.14.0
in combination with trying to save it as a multiple tag with an empty list.
According to https://exiv2.org/iptc.html the tag Iptc.Application2.Headline
is not repeatable so we will set mode to "single.

In addition to that I added comments to explain the differences in the
meaning of "single" and "multi" between the list of Xmp tags and Iptc tags.

(cherry picked from commit b070c6fba6)
2021-10-24 13:45:30 -04:00
6be014fc59 app: replace using the "draw" signal by "expose-event" on GTK+2.
Not sure why but adding a handler to the "expose-event" signal of
GimpDisplayShell (similarly to how we do it in master branch on "draw")
just didn't work. But it works on the already existing signal handling
on the canvas instead (which actually is not a bad deal, as we also
remove the coordinates translation so maybe we should test this on
`master` too).

Note: why we are backporting all this logics to gimp-2-10 is because
changes in macOS BigSur broke the selection's marching ants the same way
they broke on Wayland and it was confirmed this fix worked for BigSur as
well, at least on the dev builds.
It is unnecessary to backport for Wayland (because GIMP 2.10 is based on
GTK2 which anyway works only through XWayland, hence doesn't have the
issue), we do it only for macOS BigSur (and further). Well at least the
fix will hopefully work on the stable branch, because I cannot test
myself.

See issue #5952.
2021-10-22 23:22:39 +02:00