Commit graph

25874 commits

Author SHA1 Message Date
Jehan
dababa26d6 app, pdb: (gimp-quit) PDB procedure is also deprecated.
Even the fact we have a libgimp gimp_quit() function which was not
calling the PDB proc of the same name (and indeed doing something
differently) was weird and confusing.

Anyway we should not allow random plug-ins to basically kill GIMP
without any way to do anything about it, and probably lose all your
unsaved work. This is just wrong IMO.
We'll see if anyone wants to disagree, since anyway this won't be
removed until GIMP 4.
2026-04-07 20:13:31 +02:00
Jehan
b9277e094a app: allow pango_context not existing.
This fixes a CRITICAL on exit when calling GIMP with --no-fonts:

> g_object_unref: assertion 'G_IS_OBJECT (object)' failed
2026-04-07 18:22:43 +02:00
Jehan
a85e5286fd Issue #14681: Permission denied opening image - /tmp/gimp/3.0/ cannot be shared.
Let's create the folder returned by gimp_temp_directory() ourselves, the
first time this function is called, using a randomized name. This will
ensure that we won't conflict with another user running GIMP on the same
machine if using the base /tmp/ (which is usually the case on Linux).

Furthermore, since we create the temp folder at this level, we will also
delete it when quitting (but only if it's empty, as it should). Also I
use a single-level folder above the generic temporary directory, this
way, it's easier to track and we don't have to delete 2 levels of
directories anymore.

When the environment variable GIMP3_TEMPDIR is set though, we do not
create the folder, nor do we try and delete it.
2026-04-06 16:29:40 +02:00
Jehan
7dc8fefbfd app, libgimp, pdb, plug-ins: new gimp_resources_loaded() function.
And use the function in script-fu. While we want wrong resource names to
trigger WARNINGs in Script-Fu scripts and plug-ins (because these can be
considered as a bug), we don't want it to happen when the resource is
not loaded on purpose (mostly it means that we run GIMP with --no-data
or --no-fonts). This was happening in our own builds when running GIMP
through the in-build-gimp.py script and that was always very annoying.

Now in such a case, we will only output an INFO message on stderr (it's
still a good idea to warn about this, because if we imagined someone was
running a script non-interactively, which called one of these
procedures, they may have relied on the default value of some arguments.
Therefore they'd want to know about such a behavior change).
2026-04-06 16:29:40 +02:00
Jehan
f00bf531ae app: do not warn for stray images from command lines.
The INFO message "a stray image seems to have been left around by a
plug-in" was annoying when GIMP is run non-interactively, and when it
was about images open from command lines. Typically this message would
be visible on our CI when the various gimp-data scripts would fail. This
could only confuse script developers.

The fact is that while a plug-in (or batch script) should definitely
clean after itself by deleting images it created (unless it gave it a
display, in which case ownership is moved to the GUI), it is absolutely
expected that images opened through the command line would still exist
at exit.
2026-04-06 16:29:40 +02:00
Jehan
1107d0f7af app, pdb, plug-ins: improve error feedback for gimp_temp_file().
It is not a fix yet for #14681 but would provide nicer and earlier error
when a call to gimp_temp_file() fails, which may happen in some cases.
E.g. if the temp directory doesn't exist and we fail to create it.

As a test, if I delete /tmp/gimp/3.2/ and give root ownership to
/tmp/gimp/, now the error when opening our gimp-splash.xcf.xz is:

GIMP-Error: Opening '/path/to/gimp/gimp-data/images/gimp-splash.xcf.xz' failed: Error creating directory /tmp/gimp/3.2: Permission denied
2026-04-04 23:05:26 +02:00
Jehan
864abd6be0 app: print error message when failing to open from command line…
… even when we have no display.

gimp_message() supports a NULL handler object and we get proper
GIMP-Error message printed on stderr, e.g. when GIMP is run from the
build system.
We want as much info as possible when debugging our build scripts.
This is part of fixes to improve situations such as seen in #16160.
2026-04-04 17:21:45 +02:00
v4vansh
620850715e Core: Fix stale thumbnails after mode conversion 2026-04-03 16:17:47 +00:00
Alx Sa
13e2823a03 pdb: Allow pixels as unit in PDB calls
In GIMP 2.10, the PDB call
gimp-context-set-line-width-unit allowed
for Pixels to be set as a unit. In 3.0, we
changed GimpUnit to be a proper object
and gave it options to allow pixels or not.
The default setting is 'no pixels allowed',
which caused the unchanged
gimp-context-set-line-width-unit parameter
to no longer accept pixels as a unit.
This patch adds `allow_pixel => 1` to the
PDB set-up for setting units to fix this
oversight.
2026-04-03 10:58:10 +00:00
Alx Sa
65e06ab42b actions: Better protect layers from Fill menu
Resolves #16019
The Edit -> Fill with... options did not respect if
layers could not be filled (such as linked layers or
multiple selected layers with some layers being
pixel locked). This patch adds checks instead of
unconditionally filling those layers.
It also adds the text & vector specific fills from 916cf84e
to keep this action consistent.
2026-04-03 03:38:58 +00:00
Jehan
4f69cd039c app: get rid of some unused internal API.
I noticed this yesterday, especially through gimp_image_get_active_array()
and gimp_image_get_visible_array() which are looping through
MAX_CHANNELS, hence assuming the passed components arrays are of
sufficient size. I could have just added some comment to document that
we must be careful when calling this, but this is currently completely
unused code. So I prefer to just clean it out.

If we need something like this in the future, we can just do it better.
2026-04-02 11:45:25 +02:00
Gabriele Barbero
8af15d525a tools: fix font size jump when using shortcuts
Previously, when using shortcuts to increase or decrease the font size of
the selected text, the size would jump to 0. This behavior occurred because,
if the text did not yet have a font tag, the initial font size was evaluated as 0.

This commit ensures that the text tool's default font size is used when
no font tag is present. This prevents the font size from jumping to 0 the
first time the shortcuts are used.
2026-04-02 00:24:26 +02:00
Jehan
2c8d91c3cc app: further remove a variable length array.
Fixes when compiling:

> error: variable length array ‘mask_row_buf’ is used

With this and previous commit, we can now compile with C++ flags
-Werror=vla and get no build failures.
2026-04-01 18:52:45 +02:00
Jehan
9257af7570 app: do not use variable length arrays.
Fixing in the gimp-macos-inhouse: [arm64] job:

> ../app/core/gimpbrush-transform.cc:869:17: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]

Also adding some asserts in some places where we rely on the
MAX_CHANNELS constant so that we will quickly detect if this variable
needs to be further bumped in the future (especially as we will add
CMYK+ support as backend format).
2026-04-01 18:52:45 +02:00
Bruno Lopes
3807b2f311 app, plug-ins: More sscanf_s on Windows 2026-03-31 21:44:51 -03:00
Bruno Lopes
8aeb5d6f53 app, libgimpwidgets: More strcpy_s on Windows 2026-03-31 21:44:51 -03:00
Alx Sa
a749329ab6 tools: Turn off floating selection outline when moving
When moving a floating layer or selection, we draw a solid
border around the object. However, we also let the "marching
ants" selection continue (if the user has it enabled). This slows
down performance when moving, especially on large selections.

This patch incorporates logic from the Selection tools into the
Edit Selection tool (which the Move Tool uses for translation).
It stores the user's "Show Selection" setting, sets it to FALSE
while moving the layer or selection, then restores it to its
prior value when the cursor is released.

This logic also extends to using Ctrl + Alt to drag a floating
selection out of a layer that already has a selection.
2026-03-31 23:46:05 +00:00
Alx Sa
127510cd81 core: Use MAX_CHANNELS for Histogram limit
gimphistogram.c used its own custom MAX_N_COMPONENTS
define for the max value of its "n-components" property.
Since this value is the same as MAX_CHANNELS, it would be
good to use the global constant so the histogram limit automatically
updates when we added a new format with a larger number of components
such as CMYKA.
2026-03-31 19:28:05 +00:00
Bruno Lopes
657dceb3ed app: Use g_strerror 2026-03-31 16:27:25 -03:00
Bruno Lopes
d254c5684c app, libgimp*, plug-ins: Use strtok_s on Windows to fix CRT_INSECURE_DEPRECATE 2026-03-31 16:27:25 -03:00
Bruno Lopes
b5ca37f192 app: Properly fix unused eek_handled
Proper fix after 189598c3
2026-03-31 16:27:25 -03:00
Bruno Lopes
7ce3ed457e app, libgimp*, modules: More type <> casting fixes 2026-03-31 16:27:25 -03:00
Bruno Lopes
ed3611efa6 app, libgimp*, plug-ins: Use strncpy_s on Windows to fix CRT_INSECURE_DEPRECATE 2026-03-31 13:31:33 -03:00
Bruno Lopes
3c71c42c31 app, app-tools, libgimp: Use freopen_s on Windows to fix CRT_INSECURE_DEPRECATE 2026-03-31 13:31:33 -03:00
Gabriele Barbero
2d83568bb9 tools: prioritize proxy bindings over IM context in text tool
Try proxy bindings before the IM context. On macOS and Windows,
the IM context consumes Alt+key events (Option produces special
characters on macOS; Alt triggers alt-codes on Windows), so
bindings such as Alt+Plus/Minus (size) and Alt+arrows
(baseline/kerning) would never be reached otherwise.
2026-03-31 15:31:25 +02:00
Bruno Lopes
189598c330 Revert "app: Add macro to fix unused eek_handled variable"
This reverts commit 499e18f84e.
2026-03-31 07:34:49 -03:00
Bruno Lopes
499e18f84e app: Add macro to fix unused eek_handled variable 2026-03-30 22:52:45 -03:00
Bruno Lopes
77682518b9 app, plug-ins: Use strcpy_s on Windows to fix CRT_INSECURE_DEPRECATE warnings 2026-03-30 22:32:01 -03:00
Bruno Lopes
2066844166 app, lib*, plug-ins: Use sscanf_s on Windows to fix CRT_INSECURE_DEPRECATE warns 2026-03-30 22:31:57 -03:00
Bruno Lopes
8b9ee6d2a8 app, tools: Use cross-platform g_getenv, not getenv
It uses the safe URCT function under the hood.
2026-03-30 21:36:54 -03:00
Bruno Lopes
2a341b815c app: Change some booleans on propgui-types to unsigned integers
This fixes an Apple Clang warning about implicit truncation
from 'int' to a one-bit wide bit-field
2026-03-30 16:09:13 -03:00
Bruno Lopes
811c0c8546 app: Use posix_spawn on macOS
Fixes a Apple Clang warning.
vfork is considered deprecated and unsafe on such platform
2026-03-30 16:09:13 -03:00
Bruno Lopes
74efec2b76 app: Fix mixed declaration and code of infoCount 2026-03-29 21:07:00 -03:00
Bruno Lopes
e6eeaba58e app: Explicity cast third argument of gimp_enum_radio_box_add to gint
To fix a Apple Clang warning.

gint is what the function on app/widgets/gimpwidgets-utils.h expects.
2026-03-29 21:07:00 -03:00
Bruno Lopes
6300b7377f app: Fix mix of declaration and code on *request and *session 2026-03-29 21:07:00 -03:00
Bruno Lopes
9e664f140d app: Do not set max_n_props array length with const as per Apple Clang warning 2026-03-29 21:07:00 -03:00
Bruno Lopes
a71ecd0dda app: Import all Foundation headers needed for NSLocale
The previous NSLocale.h include was limited and not enough,
causing warnings from Apple Clang. Let's fix that.
2026-03-29 18:56:51 -03:00
Bruno Lopes
c69549aff5 app, libgimpwidgets: Fix some declarations mixed with code 2026-03-29 17:19:42 -03:00
Bruno Lopes
af1dac3c51 app, plug-ins: Comment unused stuff on macOS
This fixes Apple Clang warnings about:

- idx
- count_large
- count_nan
- n
- iteration
- original_id
- real_pos
2026-03-29 17:19:42 -03:00
Bruno Lopes
f4f1baf5ef app, libgimp, libgimpbase, libgimpwidgets, plug-ins: Add macro to unused code
This fixes Apple Clang warnings about:

- xdiff
- ydiff
- gimp_ui_get_foreign_window
- locale_parser_parse
- use_app_menu
- gimp_unique_dbus*
- transient_set
- gimp_get_foreign_window
- support
2026-03-29 17:19:42 -03:00
Alx Sa
8eae22306a widgets: Block signals when changing visible filters
eec9d512 did not block calls to
gimp_drawable_filters_editor_visible_all_toggled () when
updating the "All Visible" toggle button in
gimp_drawable_filters_editor_set_sensitive (). This resulted
in unexpected visibility changes in some combinations of
filters being turned on and off.
This patch adds the blocking calls around the call to
gtk_toggle_button_set_active () to keep this consistent.
2026-03-29 12:36:39 +00:00
Anders Jonsson
69c32c89eb app, etc: fix presets typo in blurb 2026-03-29 01:03:59 +01:00
Bruno Lopes
e64058d23b app: Silence variable is not needed and will not be emitted warnings 2026-03-28 19:51:25 -03:00
Bruno Lopes
2381ec5c7c app: Convert history_duration to gdouble for unambiguous division 2026-03-28 19:51:25 -03:00
Bruno Lopes
3835167be6 app: Convert some vars to guint so make bitwise operation unambiguous
Silences a GNU Clang warning.
2026-03-28 19:51:25 -03:00
Bruno Lopes
0530069052 app: Convert color_type to signed int so make the check meaningful
This fixes a GNU Clang warning:

warning: result of comparison of unsigned enum expression >= 0 is always true
2026-03-28 19:51:25 -03:00
Bruno Lopes
0834c7c954 app, plug-ins: Use GINT_TO_POINTER / GPOINTER_TO_INT for portability
Doing traditional explicit conversion (casting) causes warnings.
See: https://docs.gtk.org/glib/conversion-macros.html
2026-03-28 19:51:25 -03:00
Bruno Lopes
c8c420aa18 app, plug-ins: Comment pixel, total, flags and count unused variables 2026-03-28 19:51:25 -03:00
Alx Sa
6369574261 dialogs: Make Metadata Rotation images clickable
This patch makes it so that you can click the preview for
Original and Rotated images in the Metadata Rotation Import Dialog,
and have it open the image rotated as shown in the preview.
This supplements the existing button options, and matches how other
software works.
When hovering over the images, the cursor turns into a pointer to
further suggest it is clickable.
2026-03-27 21:21:39 +00:00
Aditya Tiwari
48e194532e app: show "Tab" accelerator label for windows-hide-docks
Tab was intentionally removed from the action entry to avoid overriding
its standard accessibility usage across the software, leaving the menu
item and shortcut editor showing no shortcut. This adds a cosmetic hint
in gimp_action_get_display_accels() to show 'Tab' without registering a
real accelerator.
2026-03-27 18:06:17 +01:00