Commit graph

25176 commits

Author SHA1 Message Date
Alx Sa
aa66ec06b3 actions: Select next palette entry after deletion
Unlike other dockables such as brush and patterns,
deleting a palette color does not automatically select
the next one. This makes it difficult to delete multiple
colors in a row. This patch gets the current index before
deleting the color, and then uses it to select the next entry
afterwards.

(cherry picked from commit a39355ca4d)
2025-09-17 16:40:17 +02:00
Ondřej Míchal
1b1d905e65 app: Unref GtkFileFilter only when a file loader has extensions set
gimp_file_proc_view_process_procedure() can return NULL in case a file
loading procedure does not have any extensions set.

(cherry picked from commit 073a7a208f)
2025-09-17 16:40:17 +02:00
Alx Sa
20ce3f87fd tools: Don't alter merge filter status unexpectedly
Currently, some GEGL filters must always be merged because
we don't yet have a way to store GimpDrawables with filters.
When creating these filters as part of the Filter Tool, we were
changing the "merge-filter" property directly. This mean that
if you had previously set the Filter Tool to be non-destructive,
it would be destructive the next time you added a filter (even if
the filter supported NDE).

This patch creates a separate boolean variable (initialized to the
current state of "merge-filter") and uses that instead in the
gimp_filter_tool_create_filter () function. This allows us to still
force filters with aux pads to always merge, while not affecting
the user's preferences for other NDE filters.

(cherry picked from commit 58a0c1d31e)
2025-09-17 16:40:17 +02:00
Jehan
4c17447abd app: move the follow-theme toggle to GimpDataFactoryView.
By being in GimpContainerIconView, the toggle was only being shown in
grid view, even though it also affected the list view. So we move it up
to the container, next to the query tag entry.

Also I am adding a function to make this toggle visible only when
requested. And so far, we only request it for the Brushes dockable,
because it doesn't do anything on other data dockables (we added some
code to follow theme, for instance in Palettes dockable, but it doesn't
depend on this setting, because it doesn't touch data render, only GUI
render where it's normal to follow theme).

The latter function fixes issue #14260.

(cherry picked from commit 1b9c78dc12)
2025-09-17 16:40:17 +02:00
Jehan
0133a0b811 app: make sure we invalidate brush renderers when "viewables-follow-theme" changes.
(cherry picked from commit 8628ad77c1)
2025-09-17 16:40:17 +02:00
Jacob Boerema
f36640f22e app: use GIMP_BRUSH_MAX_SIZE instead of a fixed number...
to check for the maximum allowed size of a Photoshop brush.

(cherry picked from commit a2bd03a471)
2025-09-17 16:40:16 +02:00
Jacob Boerema
08d81f2176 app: refactor Photoshop stream loading functions
Since these functions used in gimpbrush-load will also be used in
Photoshop pattern loading, move them to gimp-utils.

At the same time, change the signature to return a boolean which
indicates TRUE on success and make the returned value a parameter.
This makes it easier to check multiple read calls for success.

(cherry picked from commit 934c4a90cd)
2025-09-17 16:40:16 +02:00
Alx Sa
d4acc18911 core: Add alpha on merge if filter requires it
Some filters such as Color to Alpha require
an alpha channel. Now that we have NDE,
filters can exist separately from layers
until they're merged down. This means
the layer itself may not have an alpha
channel, causing distortions on merge.
This patch adds a method to check if
the filter requires an alpha channel, and
adds it to the layer on merge or export if
it has such a filter.

(cherry picked from commit c2b9c21b5b)
2025-09-17 16:40:16 +02:00
Alx Sa
b02d4f8619 app/tools: Use NDE filter's drawable for on-canvas widgets
Resolves #14240
This patch extends a9056419 to use the existing filter's
drawable (if it exists) on all other on-canvas widgets instead
of always using the selected layer.

(cherry picked from commit 9a349e812b)
2025-09-17 16:40:16 +02:00
Jehan
9e13a3e4ad Issue #14205: gimp-image-find-next-sample-point returns error when…
… passed "0" as argument.

Adding support of none_ok for arguments of type sample_point, allowing
to pass 0 as a special value and use it on this function.

(cherry picked from commit bf14d3db20)
2025-09-17 16:40:16 +02:00
Jehan
ddb1569d0e Revert "PDB: fix #14205 image-find-next-sample-point error"
This reverts commit 69894d8bbf.

Let's not randomly make our API less strict on types as a workaround for
a bug. If there are specific cases where it's needed to accept 0, then
these are the cases we have to handle.

Also unlike what the commit message was saying, it's not true that this
was only affecting Script-Fu. Any change to the PDB affects by
definition the whole PDB, as well as libgimp and all bindings (over PDB
or libgimp alike). And yes, this change **was** of "real consequence".

I'll do further commits for the proper fixes to #14205.

(cherry picked from commit 2d2f1d048d)
2025-09-17 16:40:16 +02:00
Jehan
c01459af11 Issue #13183: use the renamed desktop filename in Flatpak.
Since MR !2158, we set the desktop name as prgname, because that's what
is expected for Wayland. But this doesn't work on Flatpak where the
desktop file is renamed (and even to different names for the stable/beta
vs. nightly flatpaks). This commit adds some special-casing when we
detect we are inside a flatpak environment.

Note that on X11 (whether or not we are in flatpak), we just always use
the original desktop name, because then it will be set as windows'
WM_CLASS which will also match the StartupWMClass key we set in the
desktop file (cf. previous commit).

(cherry picked from commit 2244d70a94)
2025-09-17 16:40:16 +02:00
Alx Sa
204aa6685a tools: Don't run Foreground Selection without strokes
The Foreground Selection algorithm was being run when
users switched to a different tool, even if no strokes had been
painted. This caused an unnecessary delay, since no selection
will be generated.
This patch adds a check to verify we have at least one foreground
stroke made by the user before trying to create the selection.

(cherry picked from commit 0370aed02d)
2025-09-17 16:40:15 +02:00
Alx Sa
bc1f8cfd17 widgets, tools: Allow NDE filters on channels
This patch removes restrictions on applying
NDE filters to channels in the GUI. Note
that layer masks are still restricted, not for
technical reasons but because UX/UI needs
to be considered further.

(cherry picked from commit 54c95577df)
2025-09-17 16:40:15 +02:00
Alx Sa
c393e5ce7a widgets: Prevent filter container duplication
Resolves #14206
If the user clicks the Fx icon in the DrawableTreeView
repeatedly (and quickly enough), the "closed" signal
function that cleans up the Filter popover does not
run before the next creation code is started. This can
results in the previous view being left in editor->vbox,
leading to duplication.
This patch checks if the editor and view already exist when
the popover opens, and if so, it runs the clean-up code first.

(cherry picked from commit 6e58d05a56)
2025-09-17 16:40:15 +02:00
lloyd konneker
35d502edd2 PDB: fix #14205 image-find-next-sample-point error
Three types declared in pdbgen perl code,
for sample-point, guides, and tatto objects,
declare too restrictive a range of permissible values.
They should allow the value 0, which the API uses as a sentinel value,
to represent "invalid object ID".
The types are for object ID's, which are unsigned.

GObject checks the declared range when you chunk into a GValueArray,
to call the PDB.

Declaring the attribute in the perl .pdb "no-validate"
is not sufficient since GObject doesn't understand
GIMP_PARAM_NO_VALIDATE, that flag is distinct from G_PARAM_NO_VALIDATE.

Only affects the ScriptFu binding to PDB.
The GI binding to libgimp is not affected.

The declared range is no more restrictive than the underlying type
"unsigned int 32."
So of no real consequence.

The API could be changed to return a list which the caller
would iterate on.

(cherry picked from commit 69894d8bbf)
2025-09-17 16:40:15 +02:00
Alx Sa
90b8991995 core: Add alpha channel for certain transforms
In 756fed0c, we removed code that automatically added an
alpha channel for transformed layers, as it relied on the user
setting interpolation to anything other than NONE.

This patch attempts to restore this behavior with a different
check. If gimp_matrix_is_simple () returns FALSE, it means that
the transformation requires some form of interpolation, and thus
requires an alpha channel. Flipping and translating do not trigger
a change in the alpha channel, but rotation, shearing, and perspective
transforms do (even if the tool's interpolation is set to NONE).

(cherry picked from commit 4e1967bf70)
2025-09-17 16:40:14 +02:00
Jehan
0741f7fc72 app: fix a build warning.
Fixes:

> app/core/gimp-user-install.c:762:1: warning: no previous declaration for ‘user_update_post_process_menurc_over20’ [-Wmissing-declarations]

(cherry picked from commit 2056fb1dd3)
2025-09-17 16:40:14 +02:00
Jehan
8774f46c3d app: remove GIMP_HELP_PREFS_VIEWABLES_FOLLOW_THEME help ID.
It is unused and setting it on the new toggle button doesn't seem to
work anyway as the dockable's help ID is called. Improving the help page
for this dockable, rather than adding a specific help page, seems a
better fit anyway.

(cherry picked from commit d45ff5b5cd)
2025-09-17 16:40:14 +02:00
Jehan
4e01949adb app: localize some strings now that we are out of string freeze.
(cherry picked from commit 2f19042feb)
2025-09-17 16:40:14 +02:00
Jehan
87c090e829 app: draw the palette grids with the theme's background color.
Commit 80fca449a4 had a few issues:

- It was using the theme's foreground or background colors as non-entry
  color, depending on whether we draw a grid or not. It should just be
  the background's color.
- It was still defaulting color to white/black in some places, instead
  of fg/bg colors (though I just removed these defaults because the code
  just always properly set these colors later on).
- It was using the foreground colors for vertical grid lines, instead of
  background color.
- It was coloring horizontal grid lines as black, instead of background
  color.

(cherry picked from commit 0f900d2946)
2025-09-17 16:40:14 +02:00
Alx Sa
ae3a3db048 actions: Fix missing argument length check
Resolves #14192
In procedure_commands_get_display_args (), one
section missed a check for the argument array length
before trying to access the index. This caused a crash
if there were not enough arguments sent in for a Script-fu
plug-in. This patch adds that array length check to prevent
the crash.

(cherry picked from commit 6192b79d89)
2025-09-17 16:40:14 +02:00
Alx Sa
f73854a0ef core: Add Lock Content to undo history
In 2.10, we did not add a Undo History item for "Lock Content"
in the History dockable. In 3.0, we add the item, but Ctrl+Z
doesn't work because we don't actually push the undo item to
the stack.
Comments in fb1a6725 indicate this was intentionally left off
in 2.10. However, it's more consistent in 3.0 to have all locks
behave the same when it comes to undo history.

(cherry picked from commit e8c29f818e)
2025-09-17 16:40:14 +02:00
Michael Natterer
d67c859711 app: in gimp_drawable_merge_filters(), iterate the list of filters
with a while() loop and get list->next before removing the filter,
because removing deleted "list" under our feet.

(cherry picked from commit d896d60a5c)
2025-09-17 16:40:13 +02:00
Michael Natterer
3ad84e955f app: gimp_view_render_temp_buf_to_surface(): fix component extraction
The code was still assuming that GimpTempBuf is always 8 bit. Fixed
that, and optimized it to call babl_process() once per line instead of
per pixel. Fixes #13253.

(cherry picked from commit 6151deaff9)
2025-08-09 19:03:21 +02:00
Michael Natterer
ec1d626330 app: remove usless include in GimpLayerTreeView
(cherry picked from commit 7121109655)
2025-08-09 18:11:14 +02:00
Michael Natterer
96beda2ae5 app: make GimpItemList fully work on all item types
(cherry picked from commit f21aaf3416)
2025-08-09 18:11:14 +02:00
Michael Natterer
04e2d0016f app: the filters popover now seems smart enough to be shown when there
is a floating selection.

(cherry picked from commit 03366ae77c)
2025-08-09 18:11:14 +02:00
Michael Natterer
44bed73c6b app: gimp_drawable_update(): optimize a call to
gimp_drawable_get_bounding_box() away.

(cherry picked from commit 9e64535c22)
2025-08-09 18:11:14 +02:00
Michael Natterer
8993293996 app: GimpItemTreeView: show/hide the lock and search popovers
smoothly.

(cherry picked from commit 40ace1016d)
2025-08-09 18:11:14 +02:00
Michael Natterer
fd450f07f9 app: hide/destroy the filters popover properly when the view is
unmapped or the image is changed, don't run into hide/popdown
recursions, show/hide the popover smoothly.

(cherry picked from commit 8119591049)
2025-08-09 18:11:14 +02:00
Michael Natterer
e7f033ac67 app: fix my own confusion about gimp_drawable_update()
vs. gimp_drawable_update_bounding_box().

(cherry picked from commit fc0c089208)
2025-08-09 18:11:14 +02:00
Alx Sa
5ac4cc3a0e core: Don't merge floating selection as filter
Floating selections are added to the same stack as
non-destructive filters. While the GUI prevents merging
filters when there is a floating selection,
gimp_drawable_merge_filters () did not explicitly prevent
this. This patch replaces the while loop to merge filters with
a for loop, and explicitly checks if the item in the stack is a
drawable filter (and not a temporary one).

(cherry picked from commit ae02db90a3)
2025-08-09 18:11:14 +02:00
Michael Natterer
c480a66187 app: add accessors for GimpDrawableFilter::temporary and use them
instead of using the property dirtectly.  Also make sure temporary
filters don't go to the undo stack or to the XCF.

(cherry picked from commit 2baab5aa74)
2025-08-09 18:11:14 +02:00
Michael Natterer
eceef8dbc0 app: GimpDrawableFilter: move setters and getters together
(cherry picked from commit ac01289824)
2025-08-09 18:11:14 +02:00
Michael Natterer
647d3a0222 app: always show the filters popover if there are any potentially
editable filters, regardless of whether they are currently editable.
Also an ugly hack to make sure the popover resizes corrently with the
number of filters.

(cherry picked from commit 90db039270)
2025-08-09 18:11:14 +02:00
Michael Natterer
efcdcb7009 app: refactoring in filters and their UI
- move the filter popover to its own file
- centralize popover sensitivity settings
- get rid of gimp_item_refresh_filters()
- lots of minor filter fixes/changes

(cherry picked from commit 27b09025be)
2025-08-09 18:11:14 +02:00
Michael Natterer
afa454398f app: GimpDrawableTreeView: rename functions to be consistent
and s/effects/filters/

(cherry picked from commit 18a9d267a0)
2025-08-09 18:11:14 +02:00
Michael Natterer
34dc46f892 app: GimpDrawableTreeView: rename "effect" to "filter"
(cherry picked from commit 9b2fc547ef)
2025-08-09 18:11:14 +02:00
Michael Natterer
8f078f45a9 app: minor cleanups in GimpDrawableTreeView
(cherry picked from commit 2b82907967)
2025-08-09 18:11:14 +02:00
Michael Natterer
efa673b796 app: some random cleanups in widgets
(cherry picked from commit 624a62d489)
2025-08-09 18:11:14 +02:00
Michael Natterer
6486f908c4 app: move the entire filter code from GimpItemTreeView to
GimpDrawableTreeView, because it's filters on drawables not items.

(cherry picked from commit 3b60a1e01d)
2025-08-09 18:11:14 +02:00
Michael Natterer
c9788ceeb8 app: add gimp_drawable_raise,lower_filter()
and move code there from gimpitemtreeview.c

(cherry picked from commit a790dc3253)
2025-08-09 18:11:14 +02:00
Michael Natterer
a7cff72eaf app: micro cleanup in the filter undo code
(cherry picked from commit fb199fba34)
2025-08-09 18:11:14 +02:00
Michael Natterer
81f9026b16 app: move gimp_drawable_has_filter() around in its file
(cherry picked from commit 679c7a35c5)
2025-08-09 18:11:13 +02:00
Michael Natterer
fb12d2d1fe app: sanitize callback names of GimpItemTreeView drawable filter
callbacks, and remove unused variables.

(cherry picked from commit 2bf2f0e34f)
2025-08-09 18:11:13 +02:00
Estecka
5d261000a8 core,widgets: Fix filter manipulations on invisible layers
Many actions done on layers require refreshing its filters, by toggling
the layer off and on again. When done on an invisible layer, this would
turn it visible, which could not be undone.
Now, the layer remains invisible.

(cherry picked from commit a60c1097ab)
2025-08-09 18:11:13 +02:00
Bruno Lopes
cb11675766 app: Remove not-working GIMP_ICONS_LIKE_A_BOSS
'gtk-menu-images' simply does not
work on GTK3 (tested on AppImage, Flatpak
and Windows) and it is not present on GTK4.

(cherry picked from commit 65feecd32d)
2025-08-09 18:11:13 +02:00
Michael Natterer
3eca7cea89 app: move filter stack init/finalize to gimpdrawable-filters.c so we
can connect to signals and do other things right here for the entire
lifecycle of the drawable.

(cherry picked from commit 5805b96095)
2025-08-09 18:11:13 +02:00
Michael Natterer
6eaf61b86b app, pdb: move filter duplication to one place in
GimpItem::duplicate().

(cherry picked from commit bf877a8aa3)
2025-08-09 18:11:13 +02:00