Commit graph

25619 commits

Author SHA1 Message Date
Jehan
0129126fb8 app: remove GimpPickableSelect.
It has now been fully replaced by GimpItemSelect.
2025-11-17 13:47:07 +01:00
Jehan
2e0d9504ed app, libgimp, plug-ins: move our code to use only non-deprecated code.
- Though GimpDrawableChooser itself is deprecated, make it call the
  new items popup API, which will work just as well.
- gimp_procedure_dialog_get_widget() will now return a GimpItemChooser
  widget by default. I did hesitate if for API behavior stability, it
  should not still return a GimpDrawableChooser, but considered that if
  someone set G_TYPE_NONE, they want our "best choice" and are not
  considering tweaking it. If someone wants to make sure this function
  always returns a specific widget type, they should specify said type.
  So I also added a note in the function docs related to this
  assumption.
- Van Gogh plug-in must now use the GimpItemChooser API to set the item
  to show. Also I am specifying the widget type, even though it is now
  the new default, because of the previous point. Since we tweak further
  the widget with its API, let's specify so that any further defaults
  update doesn't break this code.
- Adding some pragma to ignore warnings on the few pieces of code where
  we have to call deprecated functions (because inside other deprecated
  functions themselves).
- gui_pdb_dialog_*() API should just always create GimpItemSelect
  dialogs now. Also I ref rather than peek the class, because even if
  the class has not been instanciated yet (a case I ran into), we still
  want to obtain the class structure.
2025-11-17 12:47:20 +01:00
Jehan
135ed4d2b6 app, libgimp, pdb: set all drawable selection functions as deprecated.
Also fix a bit of "Since:" annotations, some minor spacing fixing and
remove one useless test (if we test if a type is an item, we don't need
to test the children drawable type).
2025-11-17 12:14:56 +01:00
Alx Sa
37a0e37d25 widgets, pdb, libgimp: GimpProcedureDialog Item Widget
This patch adds a GimpItemChooser widget
for use in GimpProcedureDialog Item parameter
GUI creation.
This will deprecate the existing
GimpDrawableChooser, as it covers all the
same cases plus others such as GimpPath.
2025-11-16 16:42:24 +00:00
Alx Sa
bb9c3a85dc core: Fix copied channel naming
Per Jehan's note in the UX repo, we should
call copied channels "Floating Channels" rather
than the default "Floating Selection".
2025-11-16 14:07:55 +00:00
Alx Sa
5fde1b9e89 libgimpwidgets, theme: Group radio buttons together
This patch swaps out the GtkBox in
gimp_enum_icon_box_new_with_toggle ()
with a GtkButtonBox and sets it to EXPAND
so that the buttons are pressed together.
It also adds some CSS style to complete
the effect.
2025-11-15 02:50:17 +00:00
Jacob Boerema
5cc55d078b app: fix #15288 crash when loading malformed xcf
ZDI-CAN-28376 vulnerability

Add extra tests to not crash on a NULL g_class.
2025-11-13 18:49:15 -05:00
Alx Sa
a9dc4ddb2c widgets, pdb, libgimp: GimpProcedureDialog Image Widget
This patch adds a GimpImageChooser widget
for use in GimpProcedureDialog Image parameter
GUI creation.
2025-11-12 03:12:24 +00:00
Sabri Ünal
814b66a887 plug-ins: Fix Title Case usages 2025-11-10 13:02:05 +01:00
Bruno Lopes
0c70a9fe00
app, build, plug-ins: Run interpreters conditionally on Windows console
Closes: #12642

Now, we will check at runtime if GIMP is not on a console and
use the corresponding _win.interp file on such case only.
2025-11-09 15:56:32 -03:00
Alx Sa
40fcefad9c actions: Fix "Merge Visible Path" behavior for vector layers
Similar to 0dd7d9a9, but preventing users from breaking
vector layers when using "Merge Visible Paths" to merge
the associated paths.
2025-11-09 18:33:43 +00:00
Jehan
0be9672d56 Issue #15260: allow translation of percent sign. 2025-11-09 17:34:10 +01:00
Alx Sa
ea3c4dfc5a core: Pass through group mask size matches render
In 85d381bd, we fixed pass through layer groups to match
the size of the group render, allowing for filter effects to
be applied on all layers below.
This patch extends that fix to layer masks created on pass
through layer groups. This allows you to create a mask and
then selectively hide/show effects on the layer below,
like a maskable adjustment layer.
2025-11-09 15:47:17 +00:00
Jehan
926d5c6daa app, libgimp*, plug-ins: fix previous commit and add gimp_cairo_surface_get_buffer().
The previous commit was not taking into account usages of
gimp_cairo_surface_create_buffer(), other than the text layer rendering
usage, as it was focused on fixing #14970.

In particular, in other pieces of code, we were using a temporary
GeglBuffer as a way to edit the original Cairo surface but the syncing
back was not happening anymore. So previous commit was breaking all
thumbnails of layers or images, as well as PDF export for all raster
layers.

After some thought, I decided to implement a new function
gimp_cairo_surface_get_buffer() which would do what
gimp_cairo_surface_create_buffer() was doing, but adding a boolean flag
to declare whether or not we were expecting to sync back into the Cairo
surface's data. After all, when we don't need to sync back, better avoid
the useless work of copying possibly huge data.

I also added back the possibility of returning a linear-memory backed
buffer, after some discussion with pippin. Because for very small
surfaces, and if we are indeed looking to sync back into the source
Cairo surface, the advantages of using a linear buffer may still be
worth it, even though it's not true for the general case (where tiled
buffers will be much more efficient). I used 4096 (64^2 because our
current tile dimensions are 64 right now in GIMP), though this number is
kinda random and doesn't matter too much (it doesn't have to be the
square of the tile's width or height). I don't put any info about this
in the new function's documentation because developers should not have
any expectations on the type of buffer they get (only whether or not it
will sync back to the source).

As a consequence of all this, gimp_cairo_surface_create_buffer() has
been deprecated as of GIMP 3.2, though it will still work the same. The
new function will be recommended as a replacement.
2025-11-08 20:34:55 +01:00
Gabriele Barbero
5d03bb847e core, widgets: ensure to add colors of GimpFillEditor in color history once
Previously, changing the color via the GimpFillEditor color button
immediately pushed each intermediate value into the color history,
polluting it with transient previews. Only the final choice
confirmed by the user should be recorded.

Now the color is recorded in the history only when the user explicitly
confirms the selection (e.g. OK/Apply), preventing noisy
history entries while preserving the expected behavior when a color
is accepted.

core: add spaces to fix alignment
2025-11-08 18:50:33 +01:00
Bruno Lopes
c79bf5790d
app, libgimp: Fix truncation and lack of color on attached Windows console 2025-11-08 12:02:56 -03:00
Bruno Lopes
8913271706
app: Catch CTRL + C signal on Windows attached console
This solves the second issue noted on the last paragraph of 9e795acb
2025-11-08 10:03:41 -03:00
Jehan
5ff80c7dfb app: fix duplicating link layers.
Link layer duplicates were reusing the same GimpLink as the original
layer, because the properties sync was done after we created a new link
object.
2025-11-08 13:34:16 +01:00
Sabri Ünal
3027db96ff dialogs: "Maximum Image Size" changed to "Maximum new image size"
Because of the real GUI string is "Maximum new image size", this patch
was necessary.
2025-11-08 08:56:48 -03:00
Jehan
8a0754a5be Issue #15121: link layer positioning problem.
Only store a PROP_TRANSFORM if there is a transform. Otherwise the
stored offsets are bogus and would only break the position at load.
2025-11-08 12:37:45 +01:00
Jehan
b2e70c5b89 Issue #15206: do not initialize transform tools when swapping tools…
… automatically.

We still initialize on manual swapping through the action.
2025-11-08 11:26:04 +01:00
Alx Sa
0dd7d9a936 actions: Fix "Delete Path" behavior for vector layers
Instead of deleting all selected paths except
for those attached to vector layers, we
stop the action and notify the user that
they can not delete paths attached to
vector layers.
2025-11-08 04:55:30 +00:00
Alx Sa
32c9d11fd1 widgets: Don't hardcode item column in blink_item ()
In gimp_item_tree_view_blink_item (), we
originally used "3" because that is the
item column in the layer and channel
dockables. However, the path dockable
item column is at "2" since it lacks a
filter column.

To make this more general, Jehan
suggested we create a
gimp_container_tree_view_get_main_column_position ()
function in GimpContainerTreeView that
finds and returns the column index of
the main item. Then, we use that function
in gimp_item_tree_view_blink_item ().
2025-11-08 04:55:30 +00:00
Gabriele Barbero
c5e9b51c0d Revert "core, display: Enable resize for GUI layer copying"
This reverts commit 975d1a4aa3.
2025-11-07 22:50:45 +00:00
Gabriele Barbero
50dfd8d9e9 core: enable the resize undo for drawables inside gimp_item_resize
This commit makes sure each layer has the resize undo enabled
when rezising, in order to make sure that are correctly added to the
undo step.
2025-11-07 22:50:45 +00:00
Idriss Fekir
cd2d2bd8bc GimpContainerEntry:Fix non unique names issue and wrong callback signature
Signature for "match-selected" signal on GtkEntryCompletion was wrong,
and code didn't handle the case of multiple resouces sharing the same
name. (e.g. 2 different fonts both named "Holiday").
2025-11-07 21:27:57 +00:00
Alx Sa
ac01a8b625 text: Add alpha when reverting text rasterization
Resolves #4275
Text layers should have transparency when they are
not rasterized. It is possible to remove the alpha channel
when a text layer is rasterized, which causes a CRITICAL
when gimp_text_layer_render () runs to re-render the
vector-based text layer when the rasterization is reverted.

This patch adds a check in the set_rasterized () function to
verify the text layer still has an alpha channel when it's being
converted back to a vector-based layer. If the alpha channel
was removed, it is restored before re-rendering.
2025-11-07 03:49:30 +00:00
Alx Sa
ab620151c5 core: Workaround for link layer monitoring on Windows
As of GLib 2.86.1-1, GFileMonitors created with the
G_FILE_MONITOR_WATCH_HARD_LINKS
flag are not monitored on Windows.
This means that link layers will not
automatically update when the external
source is edited.
We will temporarily use the
G_FILE_MONITOR_NONE flag on Windows
until this is resolved
2025-11-06 22:19:54 +00:00
Jehan
459f80a6de Revert "widgets: Update tool item visibility code"
This reverts commit 2ba6725761.

This too is wrong. First it mentions "visible-vertical" and
"visible-horizontal" properties of GtkAction, but this is not it! Two
similarly named properties are also on GtkToolItem and these are not
deprecated! Looking at the code, tool_button is a GimpToolButton, whose
parenting indeed goes up to GtkToolItem (and that's obviously not an
action anyway).

Secondly, it creates other bugs, in particular I now sometimes have a
completely empty toolbox. That's clearly wrong.

Reverting for now. Issue #9813 will have to be fixed differently.
2025-11-06 22:00:21 +01:00
Jehan
3215e6c967 Revert "app/widgets: Guard against division by zero"
This reverts commit ee421da346.

This is wrong. This case should not happen, or if it does, this is very
likely not the proper fix. In fact, it was trying to fix a bug created
in commit 2ba6725761 which is also wrong (and which I'm going to revert
next).

See also my comment in Gitlab:
ee421da346 (note_2596612)
2025-11-06 21:55:00 +01:00
Ondřej Míchal
ee421da346 app/widgets: Guard against division by zero
Resolves crashes happening occasionally when opening GIMP.

Maybe related to 2ba6725761bfa687fcab0f259712fcdd8aac0bdd?
2025-11-06 05:06:09 +02:00
Alx Sa
2ba6725761 widgets: Update tool item visibility code
"visible-vertical" and "visible-horizontal" attributes
of GtkActions were deprecated in GTK 3.10, and since
the GAction port, we don't set them anyway on actions.
This seems to have impacted the ability to toggle a toolbutton's
visibility when a toolitem's "show" property is changed.
This patch replaced the deprecated "visibile-vertical" and
"visible-vertical" properties with a single "visible" property,
which consistently updates when the eye icon is toggled in
GimpToolEditor.
2025-11-05 17:05:52 +00:00
Alx Sa
96a921f4d5 actions: Remove image from container after deletion
Resolves #9285
In images_delete_image_cmd_callback (), we dereference
images which we want to delete. This works for images created
via the GUI. However, images created via PDB scripts are not
automatically connected to the display if created with no layers.
If you try to delete them, they will be dereferenced but will still
in the ImageView dockable. This can cause a crash if you try to
access the container again, since it will point to an unreferenced
variable.

This patch removes the image from the container first before
dereferencing it, to prevent the crash.
2025-11-05 05:44:30 +00:00
Alx Sa
b5c79ebf94 actions: Fix CRITICAL on raising empty canvas
When the user chooses "Raise or Open Image" in the
Document History, we first try to raise an image in
documents_raise_display (). This calls gimp_display_get_image ()
to get the active image from the current display, and raise it
if it already exists.

However, if you call this when the canvas is empty, it will throw a
CRITICAL since the "image" parameter for gimp_image_get_file ()
and gimp_image_get_imported_file () calls will be NULL.
This patch adds a check if the image received from
gimp_display_get_image () is NULL, and if so, we stop the function
before trying to raise it.
2025-11-05 05:35:42 +00:00
aruius
7850b61961 paint: Issue #9774 eval core_brush symmetry before paintbrush params
This sets symmetry reflect correctly in the initial
gimp_brush_core_get_brush_pixmap call.
2025-11-05 02:51:00 +00:00
Alx Sa
29e09ff2b5 widgets: Allow dragging ColorHistory colors
The intention was that you could drag colors from
the color history to the canvas, similar to the
Foreground/Background editor colors.
However, because the GimpColorArea widgets are added
to a button, the button intercepts the DnD signal mask.
This patch adds a call to gimp_dnd_color_source_add ()
when the buttons are created, to pass the ColorArea color
onward.
2025-11-03 12:30:29 +00:00
Alx Sa
aaa6bc5f9c gui, widgets: Connect ViewableDialog to style updates
This patch allows the header icon and view
in GimpViewableDialogs (and children of
this dialogue class) to scale based on user
custom icon size.
Note that it only scales when a new dialogue
is opened; it is not set to update if a dialogue
is already open and the slider is changed.
This could be added later if desired.
2025-11-03 11:37:35 +00:00
Alx Sa
2e6bb273dd widgets: Center buttons in OverlayDialog
Resolves #15215
The GtkButtonBox that holds the overlay buttons
in GimpOverlayDialog were set to GTK_BUTTONBOX_END,
which caused them to go offscreen on one side on the smaller
overlays like Scale and Sheer.
This patch changes the layout style to GTK_BUTTONBOX_CENTER
to ensure the buttons are centered within the overlay.
2025-11-03 02:14:42 +00:00
Jehan
6a40e98c9b app: fix CLang build.
Our Weekly CLang build for Debian failed with:

> ../app/widgets/gimpfiledialog.c:924:37: error: label at end of compound statement: expected statement
>                             default:

That is not a problem locally (with GCC), but I guess we can just add a
g_return_if_reached() in here as this code path is not supposed to ever
be reached indeed.
2025-11-01 19:22:49 +01:00
Bruno Lopes
72cb583489
app, app-tools, libgimp: Fix GIMP not outputing on non-native shells
As per IEEE Std 1003.1-2017, Section 8.3, TERM and
SHELL vars says we are running GIMP on POSIX shell.
They are not set by either the deprecated Windows CMD
nor by Windows PowerShell since they are not POSIX.

POSIX shells are supported by us on Linux and macOS but
actually not on Windows, since they are non-native: they
rely on forking to Cygwin which have terrible performance
(##11385) and do other tricks to make deps believe they
are on Unix which breaks e.g. GObject Introspection (#11424).
Anyway, it is Unix emulation at its prime, tricky by nature.

Even so, does not hurt allow the output on these
unsupported shells on Windows so not disrupt workflows
of adventurous developers but they will be warned that
problems (like the ones above) can and indeed appear.
2025-11-01 14:24:01 -03:00
Bruno Lopes
9e795acba7
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.
2025-10-31 17:28:22 -03:00
Gabriele Barbero
c12ea92376 tools: destry text style editor each time a textbox is selected
This patch ensures that the text style editor is destroyed whenever a text layer
is selected, even switching between them clicking on different textboxes.
This is necessary to ensure that the on-canvas editor is positioned
correctly according to the coordinates of the selected text layer.
2025-10-31 15:39:10 +01:00
Gabriele Barbero
f089ed69d7 tools: prevent on-canvas text editor from being dragged outside the image bounds
This commit prevents the on-canvas text editor from being dragged outside
the image bounds by checking the overlay's position and adjusting the
coordinates to keep it within the canvas. Additionally, it checks whether
the overlay is entirely outside the canvas and, if so, pushes it back inside.
2025-10-31 15:39:10 +01:00
Gabriele Barbero
791f9616fe move style_overlay_offset_[xy] to text_layer 2025-10-31 15:39:10 +01:00
Gabriele Barbero
dc1bd701ac tools: add icon to restore on-canvas text editor position
This commit adds a button inside the on-canvas text editor
that restores the editor to its original position after it has
been moved. The button is only visible when the editor has been
moved, and disappears when it returns to its default position.
2025-10-31 15:39:10 +01:00
Gabriele Barbero
a193d45ab8 tools: implement restore option for on-canvas text editor ...
... to reset its position via right-click menu

This commit adds the ability to restore the original position of the
on-canvas text editor after it has been moved, by accessing the option
from the context menu opened with a right-click on the text box.
2025-10-31 15:39:10 +01:00
Gabriele Barbero
83497695fd tools: store the on-canvas text editor position per text layer
Once the on-canvas text editor has been moved, its position should be
preserved across editing sessions. This commit stores the editor's
position per text layer and restores it when the layer is activated again.
2025-10-31 15:39:10 +01:00
Gabriele Barbero
bd6fc8594a tools: fix on-canvas text editor position on screen after being moved
After the on-canvas text editor has been moved, it should remain fixed
on the screen when zooming or panning the canvas. This commit preserves
the current behavior when the editor is in its original position, and
fixes its position on-screen after it has been moved.
2025-10-31 15:39:10 +01:00
Gabriele Barbero
dae8472d58 tools: allow on-canvas text editor to move
This commit implements the ability to freely move the on-canvas
text editor across the screen by introducing a drag-and-drop mechanism.
2025-10-31 15:39:10 +01:00
Jehan
bfd414ead9 Issue #9463: select back the previous tool when halting a layer effect.
This implies both when canceling or committing a filter.

Part of the fix is that we don't store filter tools as part of the tool
history, which means that when we swap back to the previous tool, the
filter tool info is dropped as though we never went through it. This
way, filter tools don't actually look as other tools (even though they
technically still are, since this is how we can implement canvas
interaction for some of the filters).
2025-10-31 13:54:59 +01:00