Commit graph

3114 commits

Author SHA1 Message Date
Bruno Lopes
ccde514bdb
libgimp: Output CLI messages to the parent console like Linux and macOS
Closes: #15192 and #7413.

Maybe helps with #3603 too.

Loosely based on https://github.com/endlessm/rufus/blob/master/src/rufus.c

The input is right now clunky, needs to use proper API to halt input and
get CTRL+C in the future, but output on terminal is a big plus that pays off.

(cherry picked from commit 9e795acba7)
2025-10-31 20:49:55 -03:00
Jehan
958d81cf5c
Issue #15179: GExiv2Metadata is not seen as GimpMetadata parent in bindings.
(cherry picked from commit dcec82a6a1)
2025-10-30 11:13:34 -03:00
Jacob Boerema
ba13c95d25
libgimp: critical when adjusted comment is NULL
When the Exif metadata comment after our adjusting was NULL, we got a
critical:
CRITICAL **: 14:09:21.853: gboolean gexiv2_metadata_set_exif_tag_string
(GExiv2Metadata *, const gchar *, const gchar *, GError **):
assertion 'value != NULL' failed

Instead of trying to set the tag with a NULL value, remove the (now
empty) tag, if there was any.

See issue #15032

(cherry picked from commit 0a0e9482c6)
2025-10-07 16:09:36 -03:00
Alx Sa
776e5e62fb
libgimp: Prevent crash on NULL comment
In gimp_image_metadata_interpret_comment (), it's
possible to set the variable comment to NULL.
We then have a later if statement that checks if index 0
of "comment" is \0 - if comment is NULL when this
check occurs, we cause a crash.
This patch adds a check to confirm comment is not NULL
before running this if statement.

(cherry picked from commit 982b572601)
2025-10-07 16:09:32 -03:00
Bruno Lopes
5edbb073e2
Declare gexiv2 dependency on many targets (due to gimpmetadata.h)
Our build files were relying 'sysroot' to find gexiv2.h but this is
not possible with Apple Clang om which sysroot points to macOS SDK.
So, exotic environments like Homebrew were failing. Let's fix this.

(cherry picked from commit f09007507f)
2025-10-03 18:42:25 -03:00
Bruno Lopes
c7c4c44f79
libgimp: Improve .gir and .vapi dependencies by using unified list
To avoid bugs like: #14902

(cherry picked from commit 0edf615333)
2025-09-30 11:50:47 -03:00
Bruno Lopes
66cc2e2173
build: Move loose scripts in meson subdir to tools
The build dir looks "prettier" without the meson subdir.
With prettier I mean: just the OSes subdirs.

(cherry picked from commit c13bf1af19)
2025-09-24 09:10:10 -03:00
Rico Tzschichholz
003a9fcbc7
libgimp: Additionally pass gio-[unix,windows]-2.0 to vapigen
Fixes https://gitlab.gnome.org/GNOME/gimp/issues/14902

(cherry picked from commit 6260590cf4)
2025-09-23 08:43:14 -03:00
Jehan
2cb2b0deda
libgimp: avoiding a build warning on Windows.
Seen in the CI:

> ../libgimp/gimpui.c:406:1: warning: 'gimp_ui_get_foreign_window' defined but not used [-Wunused-function]

(cherry picked from commit 70bf795dfb)
2025-09-21 14:42:30 -03:00
Lukas Oberhuber
4ad758e41a
macos plugins: Improves dock icon flashing from #12150
This means additional icons don't stick around. However, this is the easy workaround to turning everything into a proper plugin with .plist files.

(cherry picked from commit 06bcef3273)
2025-09-21 13:52:09 -03:00
Jehan
39e7cb593e libgimp: Modernize setting "Exif.Image.DateTime"
Again, backporting commit 1a96fb55f9 by Jacob Boerema without the
conflicts.
2025-09-17 22:13:40 +02:00
Jehan
0c82d21473 libgimp: fix XMP modification date separators.
Again, backporting commit 922e409045 by Jacob Boerema, without
conflicts.
2025-09-17 22:10:39 +02:00
Jehan
819a9944de libgimp: fix #14644 Wrong comment synchronized with metadata
Backport commit 3211ab1408 by Jacob Boerema. The original commit
conflicted because we are not going to backport commit 877d5b0c1a,
adding a new Preferences setting, to the GIMP 3.0 series.
2025-09-17 22:07:47 +02:00
Bruno Lopes
7d86007f8f libgimp: Only list gio_specific on Glib 2.86 and newer
Since GioUnix-2.0 namespaces were buggy in previous versions

(cherry picked from commit 4dceeb174a)
2025-09-17 17:56:39 +02:00
Bruno Lopes
a604a8e4a6 libgimp: List gio_specific as dependency for .typelib
This is required starting with Glib 2.86.0.

(cherry picked from commit a7d867c8bc)
2025-09-17 17:54:48 +02:00
Bruno Lopes
56c495ec4b app: Make possible to append _NT_SYMBOL_PATH
(cherry picked from commit 9026d18039)
2025-09-17 17:54:48 +02:00
Jehan
e42e46d7d9 libgimp, plug-ins: implement loading SVG breaking aspect ratio.
Previous implementation was always keeping ratio. If the width/height
argument were of a different aspect, librsvg simply fits the image with
original aspect within the box. Now we will appropriately scale
differently on both dimensions to have the image fill the whole box.

Note that this doesn't work with librsvg before 2.46.0 (not that it's
not possible, just that I haven't looked at how it should be implemented
there (which would be a different implementation anyway since there is
no cairo step).

Finally I add a build warning for when we'll prepare for GIMP 4, as the
pixel density arg needs to be split in 2 (each dimension can have its
own PPI), even though this is not really needed right now.

(cherry picked from commit 9519901150)
2025-09-17 17:17:05 +02:00
Jacob Boerema
3b72778d76 libgimp: fix handling of "charset=" in comments
The charset=[ascii|InvalidCharsetId] comment originates from broken
handling in exiv2 of Exif.Photo.UserComment. However, due to the way
we (or possibly other programs) write comments, this could have
propagated to the generic image comment and to the
Exif.Image.ImageDescription metadata tag.

By adding a check for an existing comment first, the metadata tags
were not necessarily checked anymore.

To fix this in all cases we need to unconditionally read and interpret
the comment and both metadata tags.
We move handling of charset=InvalidCharsetId to the already existing
function gimp_image_metadata_interpret_comment by adding some
parameters and call this function for all three cases.

(cherry picked from commit 8e11b1bfb4)
2025-09-17 16:40:24 +02:00
Jacob Boerema
2d8e3a2523 libgimp: favor existing image comment instead of
always loading comment from metadata

I noticed that if there was text in one of the metadata tags that we
consider equivalent to the image comment, the first one of those
always took precedence over an actual image comment that an image
may have.

Let's change that to only use metadata comments if the image didn't
have a comment set. So, if present, load the gimp-comment parasite
and set that as comment. If not present, we try to load a comment
from metadata.

(cherry picked from commit 780e848120)
2025-09-17 16:40:24 +02:00
Jehan
c838b0c869 app, libgimp, pdb: have GimpTrcType into public libgimp.
It is being used as filter arguments in 2 GIMP filters (curves and
levels) so we want to be able to send this enum type through the wire.

(cherry picked from commit 09e8e45d07)
2025-09-17 16:40:23 +02:00
Jehan
bebb00b5d9 pdb: properly handle enum types with acronyms and sort case-insensitively.
This will be used in particular for adding GimpTRCType to libgimp.
Otherwise it generates some broken gimp_TRCtype_get_type() function
name.

For this use case, we need to look-ahead a bit in the regular
expression.

(cherry picked from commit bbe5c16862)
2025-09-17 16:40:23 +02:00
Ondřej Míchal
c72644797a libgimp: Add support for GeglParamFilePath to the wire
(cherry picked from commit 4022a123e9)
2025-09-17 16:40:23 +02:00
Michael Natterer
2e4f1f1beb app, libgimp*: more g_set_str() and some other stuff in the same
spirit

(cherry picked from commit 89ea91df96)
2025-09-17 16:40:21 +02:00
Michael Natterer
2ab734cf78 libgimp, libgimpwidgets: fix (closure) annotations.
(cherry picked from commit 76caac9481)
2025-09-17 16:40:20 +02:00
Michael Natterer
685d230a09 app, pdb: a lot of vectors -> path renaming
(cherry picked from commit bee7b8713b)
2025-09-17 16:40:20 +02:00
Alx Sa
f90b934f15 libgimp: Make comment text sensitive based on...
...if Save Comment option is enabled.
Currently, it's possible to unknowingly export an image
without a comment, even if it exists, if the "Save Comment"
option is left unchecked. This patch adds a signal whenever
the "Save Comment" checkbox is clicked (and when the dialogue
is first opened) that uses its active status to set the sensitive
status of the comment text area. If unchecked, the text area will
be marked as insensitive so it can't be edited.

(cherry picked from commit 96fb97d3fa)
2025-09-17 16:40:20 +02:00
Michael Natterer
689b7ab191 pdb: remove -private suffixes
from gimp-drawable-append-filter and -merge-filters. They are not
needed any longer, and it's not an API change because they are
private.

(cherry picked from commit fd3852af31)
2025-09-17 16:40:20 +02:00
Michael Natterer
3dec3da781 app, libgimp: minor whitespace and formatting cleanup
(cherry picked from commit 6221bdb503)
2025-09-17 16:40:20 +02:00
Jehan
972206d08c libgimp: different widget default for GimpChoice in GimpProcedureDialog…
… depending on the number of choices.

Enforcing a UX decision into code from GIMP/Design/gimp-ux#323.
Note that this is not a perfect automatization, since the right default
widget may still be a combo box even for limited choices arguments, when
the dialog is crowded.
It still improves the defaults, and it is still possible to override the
widget on case by case (just as of now).

(cherry picked from commit bcb736db61)
2025-09-17 16:40:16 +02:00
Michael Natterer
26c21c534f libgimp: there was an "else" missing in the commit below
(cherry picked from commit 76e82d5572)
2025-08-09 18:11:14 +02:00
Alx Sa
66d05121af libgimp: Create widgets for unsigned integer parameters
gimp_procedure_add_uint_argument () creates an unsigned integer
parameter. It's functionally equivalent for creating dialogue widgets,
but since we only checked for G_TYPE_PARAM_INT, these parameters
did not generate widgets in GimpProcedureDialog.
This patch adds a check for G_TYPE_PARAM_UINT in relevant sections
to resolve the issue.

(cherry picked from commit 0d08a3c532)
2025-08-09 18:11:14 +02:00
Jehan
27f6d25677 libgimp: fix incompatible type for exported function address in gimp-win-x86 job.
This fixes:

> ../libgimp/gimp.c:280:27: error: assignment to 't_SetProcessDEPPolicy' {aka 'int (__attribute__((stdcall)) *)(long unsigned int)'} from incompatible pointer type 'FARPROC' {aka 'int (__attribute__((stdcall)) *)(void)'} [-Wincompatible-pointer-types]
>   280 |     p_SetProcessDEPPolicy = GetProcAddress (GetModuleHandleW (L"kernel32.dll"),
2025-05-16 16:56:35 +00:00
Idriss Fekir
8328dfb25b GimpFontFactory: Move font loading to another thread
This is to make sure than regardless of how many fonts there are, font loading
won't delay startup.

FontConfig if compiled against libxml2 might fail to parse huge xml configs.
So instead of passing it a huge xml, pass the xml every MAX_NUM_FONTS_PER_CONFIG (currently 1000) fonts.

Also made GimpFontFactory custom config strings private because there is no reason for them to be public.
2025-05-14 22:42:22 +00:00
Alx Sa
cb0f8a0282 libgimp, libgimpwidgets: Let string widgets expand horizontally
This makes GimpProcedureDialog string argument widgets expand
horizontally by default.
2025-05-11 05:50:49 +00:00
Jehan
15d2e25404 libgimp: further cleanup in GimpGradientChooser code.
- No need of local_grad_data_new(). Just set default variables in init()
  as it should be.
- Also move gimp_gradient_chooser_draw_interior() to the init()
  function, so that the new() function is only a wrapper of
  g_object_new() which is the proper way to implement new classes.
- Get rid of wrong comment.
2025-05-06 15:33:05 +02:00
lloyd konneker
2d7a1a5d6d libgimp: some code reorganization.
This commit message has been rewritten by the reviewer (Jehan) because
the original message was not right. It was originally meant to fix #13189
but it was only doing so as a side effect of getting rid of the slice
API.

We still push it as a second step (with updated message) because it's
not a bad idea to stop using the slice API where we can as it's anyway
no more than a malloc/free synonym since GLib 2.76 and might get
deprecated some day.
2025-05-06 15:33:05 +02:00
Jehan
cbd013d7b2 Issue #13189: free the slice with g_slice_free().
Even though this is mostly the same thing now, it's only true since GLib
2.76, yet our AppImage uses GLib 2.74.6. This explains why the chooser
finalization was crashing plug-ins.
2025-05-06 14:59:19 +02:00
Alx Sa
2c31c0e34d libgimp, plug-ins: Prevent GFig crash with NULL brush
The GFig plug-in assumes that there is always
a valid brush selected when creating its
dialogue. However, a NULL brush is possible,
and GFig's assumption can cause a crash
in GIMP by attempting to get a buffer from
a NULL brush.
This patch adds conditional checks for the
brush to not be NULL before using it.
2025-05-05 09:36:04 +00:00
Bruno Lopes
0fe938939c
libgimp/tests: Bump timeout to 90s (because 60 is not enough on Windows) 2025-04-21 12:30:50 -03:00
Bruno Lopes
f158cc2b6e
libgimp/tests: Port libgimp-run-python-test.sh to Python 2025-04-21 12:30:46 -03:00
Bruno Lopes
23b8867115
libgimp: Port libgimp-run-c-test.sh to Python 2025-04-18 21:53:22 -03:00
Bruno Lopes
00ab5e3a19
.gitlab: Move cp-plug-in-subfolder.py to build/meson
It is not a CI-specific file.
2025-04-18 13:36:31 -03:00
Bruno Lopes
ddcc51204b
libgimp: Port from cat to Python 2025-04-17 15:32:20 -03:00
Bruno Lopes
99bf8defe7
tools: Port in-build-gimp.sh to Python
Both .sh and .py versions take 2:15 minutes to generate all the
assets but the more cross platform the better so Python wins.
2025-04-16 13:41:16 -03:00
Bruno Lopes
63f5ea9dc5
build, meson, gitlab: Generate native .pdb CodeView symbols on Windows
Reverts dc21fb76

The CodeView format introduces some advantages to our Windows build:
- It is way smaller than DWARF, reducing the .exe installer. With
  the strip of COFF symbols too, the installation is 120MB smaller.
- Can be uploaded as .appxsym to be used on demand by MSIX (in thesis)
- Works better with DIA and DbgHelp debuggers like WinDbg and DrMingW,
  respectively. LLDB also works by using LLDB_USE_NATIVE_PDB_READER=1

Context: that was not working before because DrMingw and LLDB seems to
only search for the build-time .pdb path in '.buildid' section of bins.
See: https://github.com/jrfonseca/drmingw/issues/91 and
https://github.com/llvm/llvm-project/issues/125355. So, we will set
_NT_SYMBOL_PATH at least for $PREFIX/bin for now as workaround.
2025-04-14 07:50:43 -03:00
Jacob Boerema
5273f26ef0 app, pdb: fix #13480 inconsistent use of maximum radius...
for generated brushes.
The maximum radius we allowed for generated brushes was not used
consistently everywhere.
In the API call we clamped it to 0.0-32767.0, while the param_spec
set min and max to 0.1 and 4000.0, and the brush editor used a
maximum of 1000.0.
Using a large value (probably anything larger than 4000) would
sooner or later lead to a crash.

Instead of manual changes everywhere, let's define a maximum and
minimum in one place and use that wherever we need the min/max values.
Use the values as set in the param_spec for the defines.
The only place we can't easily do that is in brush.pdb, so we add
a comment above our defines that the values need updating there too.

Actually we should probably use more defines for other values too,
that way there is less chance of min/max values getting out of synch
throughout our code.
2025-04-11 02:02:40 +00:00
Jehan
c381390615 Issue #12636: _gimp_gp_param_def_to_param_spec throws WARNING on…
… a build of type "release".

Thanks to Lloyd Konneker for their original diagnosis of this issue!
2025-03-14 21:52:19 +01:00
Jehan
711be6db8c app, libgimp, pdb: clean up some more code redundancy. 2025-02-25 20:17:05 +01:00
Jehan
1e869b9ce0 libgimp: cleanup and adding missing doc-comment.
The comment about temporary API was added in commit 244b52bf0d for
functions long gone.
2025-02-25 20:01:29 +01:00
Jehan
ad0b02d2b7 app, libgimp, pdb, plug-ins: rename gimp_procedure_is_core() to…
… gimp_procedure_is_internal().

I realized we were already naming these "internal procedures" in the
Procedure Browser and this is in fact a better naming than "core
procedure".
2025-02-25 20:01:29 +01:00