Commit Graph

24700 Commits

Author SHA1 Message Date
Jehan cb18908d15 app, menus: rename the files too.
I did it in 2 commits otherwise git has a hard time seeing the move+edit
as a file move and the `git show` on previous commit is much less
useful.
2024-08-05 12:08:59 +02:00
Jehan d46d26933b app, menus: rename all "vectors-" actions to "paths-".
Though these are not as user-facing as other strings, the action names
still are somewhat user-facing. Let's rename them consistently with the
GUI and the API.

This commit also handles user config migration so that custom shortcuts
are not lost.
2024-08-05 12:08:59 +02:00
Alx Sa 6bbaaeb39e dialogs, gui, widgets: Connect GimpPrefsBox to icon size changes
Inspired by Mark Sweeney's work.
This patch allows the icons in the tree
view in Preferences Dialog to scale based
on user icon scale preferences.
Rather than add a GimpGuiConfig to
GimpPrefsBox, we make a call to style_updated ()
from the Preferences Dialog to signal a
change.
2024-08-04 12:55:58 +00:00
Idriss Fekir 73557d011b text: keep fonts usable if the current one becomes missing
If a font is being used and becomes missing all other fonts become
unusable, setting the fontconfig object to the pango fontmap
fixes this.
2024-08-04 11:02:09 +01:00
Idriss Fekir fe32265b61 GimpText: Fix saving to xcf with text in an alias font
Alias fonts don't have a generated name, their alias name is used
instead. But the serialization code assumed that all fonts had a
generated name of the format "gimpfont%d" and this was causing a crash.
2024-08-04 11:02:09 +01:00
Idriss Fekir 81a68ae758 GimpFontFactory: More reliable font checking
check for font validity (whether it is usable by pango), using
harfbuzz instead of relying on file extentions.

We do this in the first place because pango when given a font it can't
support will look for the closest matching supported font, but we
iterate through all fonts, so that would create redundancy.
2024-08-04 11:02:09 +01:00
Idriss Fekir cd26f49b7a GimpFont: Improve font matching with old XCF files
Compare the font file gotten from the PangoFont object
related to the PangoFontDescription rather than just comparing
font names. This Helps because when pango is given an unsupported
font (Type1 or Bitmap fonts) it choses the closest matching ttf/otf
font, but reports the name of the unsupported font.
2024-08-04 11:02:09 +01:00
Jehan be0a4ab12a Issue #11828: Lock Path stroke not working as expected.
The "selected-layers-changed" signal was emitted while there were still
selected channels (which is an inconsistent state). And since
gimp_image_get_selected_drawables() returns selected channels first when
the image has any, vectors_actions_update() was using the previously
selected channel's lock information for deciding which actions to set
sensitive.
2024-08-03 13:34:17 +02:00
Jehan 9f5db5c153 Issue #11828: reverting a string change in commit f036812a94.
This had already been handled in commit 8bd3d5e0bb, but somehow the old
name slipped back in commit f036812a94.
2024-08-03 12:45:50 +02:00
Alx Sa 80f09fac59 libgimpwidgets: Finish converting classes to derivable type 2024-08-03 06:39:55 +00:00
Alx Sa 175b50ead5 libgimpthumb, app: Make gimpthumbnail attributes private
Move all public attributes of GimpThumbnail
from the header to a private struct in
GimpThumbnail.c. Also replace direct
access of these attributes in app/core and
app/widget with get/set calls.
2024-08-03 04:25:33 +00:00
Andre Klapper be944b20c5 Rename "Intelligent Scissors" menu item to "Scissors Select"
Be consistent with tool dialog and tooltip.

Fixes #10793
2024-08-03 00:02:49 +00:00
Jehan bc73232cd9 app, libgimpwidgets: fix CRITICAL on NULL GimpUnit.
I missed this one because it was using 0 instead of the GIMP_UNIT_PIXEL
macro. This was triggering CRITICALs when using the text tool.
2024-08-03 01:50:27 +02:00
Jehan 07196f371b Issue #11865: properly pass ui_meta() from GeglParamColor to GimpParamColor. 2024-08-03 01:50:27 +02:00
Jehan 318342039d Issue #11422: gimp_prop_widget_new_from_pspec: not supported: GeglParamColor
In all core code, transform GeglParamColor to GimpParamColor with alpha.
2024-08-02 18:44:00 +02:00
Jehan d493f0537f Issue #8900 and #9923: reimplementing GimpUnit as a proper class.
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!

Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.

As an aside, this also fixes #10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.

Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.

Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
2024-08-02 10:46:38 +02:00
Alx Sa 70ae12eb16 widgets, gui: Connect GimpToolBox to icon size changes
Inspired by Mark Sweeney's work.
This patch allows the active image, brush,
pattern, and gradient areas in the toolbox
to scale based on user icon scale
preferences.
Note that if the pattern itself is smaller
than the icon size, it currently won't scale
larger. This is a separate issue in the
renderer.
2024-07-28 13:25:51 +00:00
Alx Sa 45f390ffc4 display, gui: Connect GimpDisplayShell to icon size changes
Inspired by Mark Sweeney's work.
This patch allows the four buttons on the
sides of the canvas (Zoom, Quick Mask,
Image Menu, and Navigation Image)
to resize based on the user's icon size
preferences.
2024-07-23 22:01:55 +00:00
Andrzej Hunt fe26086e16 xcf: don't use potentially dangling pointer in xcf_load_layer_mask
layer_mask points to the original mask created by xcf_load_layer_mask. We copy
this pointer into channel, and xcf_load_channel_props can overwrite this
pointer and free the original mask. If this happens, layer_mask points to
the now-freed original mask, and should not be used.

Therefore we need to change later parts of xcf_load_layer_mask to use channel
instead of layer_mask. Additionally, we add a block and move layer_mask into
this block to guarantee that layer_mask cannot be used after it has
potentially been freed.

Adjustments by Jacob Boerema:
Follow GIMP's code style regarding variables, comment style and
position of braces

See also ASAN output below:

==5247==ERROR: AddressSanitizer: heap-use-after-free on address 0x615000010fd0 at pc 0x7f4e2dbbf31b bp 0x7ffca8a95cd0 sp 0x7ffca8a95cc8
READ of size 8 at 0x615000010fd0 thread T0
    #0 0x7f4e2dbbf31a in g_type_check_instance_cast /home/ahunt/git/glib/_build/../gobject/gtype.c:4117:26
    #1 0xb200fe in xcf_load_layer_mask /home/ahunt/git/gimp/app/xcf/xcf-load.c:2305:52
    #2 0xb18eea in xcf_load_layer /home/ahunt/git/gimp/app/xcf/xcf-load.c:2133:20
    #3 0xb13d91 in xcf_load_image /home/ahunt/git/gimp/app/xcf/xcf-load.c:499:15
    #4 0xb11deb in xcf_load_stream /home/ahunt/git/gimp/app/xcf/xcf.c:305:19
    #5 0x619dfd in LLVMFuzzerTestOneInput /home/ahunt/git/gimp/app/fuzzers/xcf_fuzzer.c:50:17
    #6 0x51d364 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:599:15
    #7 0x506fe2 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:323:6
    #8 0x50d350 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:856:9
    #9 0x5373a2 in main /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
    #10 0x7f4e2c84c349 in __libc_start_main (/lib64/libc.so.6+0x24349)
    #11 0x4e0779 in _start /home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:120

0x615000010fd0 is located 336 bytes inside of 504-byte region [0x615000010e80,0x615000011078)
freed by thread T0 here:
    #0 0x5e8562 in free /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:127:3
    #1 0x7f4e2d76ce08 in g_free /home/ahunt/git/glib/_build/../glib/gmem.c:199:3
    #2 0x7f4e2d797a6b in g_slice_free1 /home/ahunt/git/glib/_build/../glib/gslice.c:1183:7
    #3 0x7f4e2dbb7b04 in g_type_free_instance /home/ahunt/git/glib/_build/../gobject/gtype.c:2008:5
    #4 0x7f4e2db8fe3a in g_object_unref /home/ahunt/git/glib/_build/../gobject/gobject.c:3604:11
    #5 0xb22fff in xcf_load_channel_props /home/ahunt/git/gimp/app/xcf/xcf-load.c:1738:13
    #6 0xb20037 in xcf_load_layer_mask /home/ahunt/git/gimp/app/xcf/xcf-load.c:2292:9
    #7 0xb18eea in xcf_load_layer /home/ahunt/git/gimp/app/xcf/xcf-load.c:2133:20
    #8 0xb13d91 in xcf_load_image /home/ahunt/git/gimp/app/xcf/xcf-load.c:499:15
    #9 0xb11deb in xcf_load_stream /home/ahunt/git/gimp/app/xcf/xcf.c:305:19
    #10 0x619dfd in LLVMFuzzerTestOneInput /home/ahunt/git/gimp/app/fuzzers/xcf_fuzzer.c:50:17
    #11 0x51d364 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:599:15
    #12 0x506fe2 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:323:6
    #13 0x50d350 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:856:9
    #14 0x5373a2 in main /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
    #15 0x7f4e2c84c349 in __libc_start_main (/lib64/libc.so.6+0x24349)

previously allocated by thread T0 here:
    #0 0x5e87cd in malloc /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
    #1 0x7f4e2d76ccf2 in g_malloc /home/ahunt/git/glib/_build/../glib/gmem.c:106:13
    #2 0x7f4e2d7972e0 in g_slice_alloc /home/ahunt/git/glib/_build/../glib/gslice.c:1072:11
    #3 0x7f4e2d7978ae in g_slice_alloc0 /home/ahunt/git/glib/_build/../glib/gslice.c:1098:18
    #4 0x7f4e2dbb6e0a in g_type_create_instance /home/ahunt/git/glib/_build/../gobject/gtype.c:1911:17
    #5 0x7f4e2db9215e in g_object_new_internal /home/ahunt/git/glib/_build/../gobject/gobject.c:1945:24
    #6 0x7f4e2db91d1f in g_object_new_valist /home/ahunt/git/glib/_build/../gobject/gobject.c:2288:16
    #7 0x7f4e2db90e8b in g_object_new /home/ahunt/git/glib/_build/../gobject/gobject.c:1788:12
    #8 0xdb69e0 in gimp_item_new /home/ahunt/git/gimp/app/core/gimpitem.c:723:10
    #9 0xce11c8 in gimp_drawable_new /home/ahunt/git/gimp/app/core/gimpdrawable.c:1067:14
    #10 0xddf5d8 in gimp_layer_mask_new /home/ahunt/git/gimp/app/core/gimplayermask.c:254:5
    #11 0xb1ffc5 in xcf_load_layer_mask /home/ahunt/git/gimp/app/xcf/xcf-load.c:2279:31
    #12 0xb18eea in xcf_load_layer /home/ahunt/git/gimp/app/xcf/xcf-load.c:2133:20
    #13 0xb13d91 in xcf_load_image /home/ahunt/git/gimp/app/xcf/xcf-load.c:499:15
    #14 0xb11deb in xcf_load_stream /home/ahunt/git/gimp/app/xcf/xcf.c:305:19
    #15 0x619dfd in LLVMFuzzerTestOneInput /home/ahunt/git/gimp/app/fuzzers/xcf_fuzzer.c:50:17
    #16 0x51d364 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:599:15
    #17 0x506fe2 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:323:6
    #18 0x50d350 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:856:9
    #19 0x5373a2 in main /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
    #20 0x7f4e2c84c349 in __libc_start_main (/lib64/libc.so.6+0x24349)

SUMMARY: AddressSanitizer: heap-use-after-free /home/ahunt/git/glib/_build/../gobject/gtype.c:4117:26 in g_type_check_instance_cast
Shadow bytes around the buggy address:
  0x0c2a7fffa1a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2a7fffa1b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2a7fffa1c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2a7fffa1d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2a7fffa1e0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c2a7fffa1f0: fd fd fd fd fd fd fd fd fd fd[fd]fd fd fd fd fd
  0x0c2a7fffa200: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa
  0x0c2a7fffa210: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2a7fffa220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2a7fffa230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2a7fffa240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==5247==ABORTING
./crash-0507799c3e4291570e060f53332b58b8a96f95e5
2024-07-23 13:30:33 -04:00
Alx Sa 42300d9db0 dialogs, libgimpwidgets: Prevent wide dialogs due to image/profile name
Currently if your image history includes an
image with a long name, the Welcome
Dialog will stretch out to match its width.
If the color profile name is long, then the
color scales will also stretch out due to
the profile label.
This patch adds ellipses to the Welcome
Dialog and a scrollwindow to the
ColorScales to prevent this.
2024-07-22 16:32:47 +00:00
Alx Sa 9d40d79e4a gui, widgets: Scale Swap & Default Color icons...
...based on icon size preferences.
Inspired by Mark Sweeney's work.
Since the icon size is based on a formula,
the CSS value determines the maximum
size rather than being used directly.
2024-07-21 03:05:43 +00:00
bootchk 4a50143ba6 Fix 9066 Encapsulate access to dock_columns of dock_window
Needs backport to 2.10

gimp_dock_windows_constructed creates a GimpDockColumns, a child widget,
and keeps a private reference to it at dock_window->p->dock_columns.
Then it connects the signal dock_columns.doc_removed to two callbacks:
gimp_dock_window_dock_removed() and gimp_dock_window_update_title().
gimp_dock_window_dock_removed() callback is called first and can
destroy the GimpDockWindow widget and its child widget GimpDockColumns.
Then gimp_dock_window_update_title is called
and tries to call dock_window->p->dock_columns.get_docks()
but it is already destroyed.

The fix is to nullify the internal pointer to dock_columns when destroyed,
and encapsulate access to dock_columns.get_docks so that it
returns a valid but empty list when dock_columns has already been destroyed.

Alternatively, you might be able to fix it by rearranging the order
of connections to dock-removed signal, but then the title would be wrong.

Another alternative might be to rethink the whole destruction sequence.
2024-07-20 21:26:59 +00:00
Andrzej Hunt 7d949423ed xcf-load: avoid use-after-free for layers with multiple PROP_ACTIVE_LAYER
If a given layer's properties contain multiple PROP_ACTIVE_LAYER entries, we
could add multiple entries for the same layer in info->selected_layers.

However, xcf_load_layer_props and xcf_load_layer both contain logic that
overwrites the layer pointer - they do take care of updating
info->selected_layers and and info->floating_sel (both of which could contain
or point to the current layer). Crucially, they both assume that
info->selected_layers can only contain this layer once - hence they only
remove it from the list once. This logic also frees the old layer because it
thinks that it's no longer in use.

But if we've added the original layer to selected_layers multiple times,
and then use the logic that overwrites layer, selected_layers will still
contain an invalid pointer to the now-freed original layer. Any later
code that tries to read info->selected_layers will hit a user-after-free.

Therefore we need to check if the current layer is already in the
selected_layers list, and avoid adding it again if it's already there.
(It also seems illogical to say that a layer is selected twice, but I'm
 focusing on the code-correctness aspect in my analysis.)

Adjustment by Jacob Boerema: the correct way to test that a value does
not exist in a list is to check for the value being negative. Also add
a message to warn users.

ASAN output:

==21241==ERROR: AddressSanitizer: heap-use-after-free on address 0x615000012150 at pc 0x000000d54dbf bp 0x7ffcf813bb60 sp 0x7ffcf813bb58
READ of size 8 at 0x615000012150 thread T0
    #0 0xd54dbe in gimp_image_set_selected_layers /home/ahunt/git/gimp/app/core/gimpimage.c:4743:7
    #1 0xb146c6 in xcf_load_image /home/ahunt/git/gimp/app/xcf/xcf-load.c:690:7
    #2 0xb1199b in xcf_load_stream /home/ahunt/git/gimp/app/xcf/xcf.c:305:19
    #3 0x619cad in LLVMFuzzerTestOneInput /home/ahunt/git/gimp/app/fuzzers/xcf_fuzzer.c:35:17
    #4 0x51d2e4 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:599:15
    #5 0x506f62 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:323:6
    #6 0x50d2d0 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:856:9
    #7 0x537322 in main /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
    #8 0x7f064a594349 in __libc_start_main (/lib64/libc.so.6+0x24349)
    #9 0x4e06f9 in _start /home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:120

0x615000012150 is located 336 bytes inside of 504-byte region [0x615000012000,0x6150000121f8)
freed by thread T0 here:
    #0 0x5e84e2 in free /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:127:3
    #1 0x7f064b3f81c8 in g_free (/usr/lib64/libglib-2.0.so.0+0x581c8)
    #2 0x7f064b41133f in g_slice_free1 (/usr/lib64/libglib-2.0.so.0+0x7133f)
    #3 0x7f064b7015c0 in g_type_free_instance /usr/src/debug/glib2-2.62.6-lp152.2.3.1.x86_64/build/../gobject/gtype.c:1946
    #4 0xb187d8 in xcf_load_layer /home/ahunt/git/gimp/app/xcf/xcf-load.c:2146:3
    #5 0xb13997 in xcf_load_image /home/ahunt/git/gimp/app/xcf/xcf-load.c:504:15
    #6 0xb1199b in xcf_load_stream /home/ahunt/git/gimp/app/xcf/xcf.c:305:19
    #7 0x619cad in LLVMFuzzerTestOneInput /home/ahunt/git/gimp/app/fuzzers/xcf_fuzzer.c:35:17
    #8 0x51d2e4 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:599:15
    #9 0x506f62 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:323:6
    #10 0x50d2d0 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:856:9
    #11 0x537322 in main /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
    #12 0x7f064a594349 in __libc_start_main (/lib64/libc.so.6+0x24349)
    #13 0x4e06f9 in _start /home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:120

previously allocated by thread T0 here:
    #0 0x5e874d in malloc /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
    #1 0x7f064b3f80c8 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x580c8)
    #2 0x7f064b410da5 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x70da5)
    #3 0x7f064b411258 in g_slice_alloc0 (/usr/lib64/libglib-2.0.so.0+0x71258)
    #4 0x7f064b7011d5 in g_type_create_instance /usr/src/debug/glib2-2.62.6-lp152.2.3.1.x86_64/build/../gobject/gtype.c:1849
    #5 0x7f064b6e164f in g_object_new_internal /usr/src/debug/glib2-2.62.6-lp152.2.3.1.x86_64/build/../gobject/gobject.c:1827
    #6 0x7f064b6e354d in g_object_new_valist /usr/src/debug/glib2-2.62.6-lp152.2.3.1.x86_64/build/../gobject/gobject.c:2152
    #7 0x7f064b6e38c8 in g_object_new /usr/src/debug/glib2-2.62.6-lp152.2.3.1.x86_64/build/../gobject/gobject.c:1670
    #8 0xdb5b90 in gimp_item_new /home/ahunt/git/gimp/app/core/gimpitem.c:723:10
    #9 0xce0358 in gimp_drawable_new /home/ahunt/git/gimp/app/core/gimpdrawable.c:1067:14
    #10 0xddd8db in gimp_layer_new /home/ahunt/git/gimp/app/core/gimplayer-new.c:65:11
    #11 0xb182a6 in xcf_load_layer /home/ahunt/git/gimp/app/xcf/xcf-load.c:2027:11
    #12 0xb13997 in xcf_load_image /home/ahunt/git/gimp/app/xcf/xcf-load.c:504:15
    #13 0xb1199b in xcf_load_stream /home/ahunt/git/gimp/app/xcf/xcf.c:305:19
    #14 0x619cad in LLVMFuzzerTestOneInput /home/ahunt/git/gimp/app/fuzzers/xcf_fuzzer.c:35:17
    #15 0x51d2e4 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:599:15
    #16 0x506f62 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:323:6
    #17 0x50d2d0 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:856:9
    #18 0x537322 in main /home/abuild/rpmbuild/BUILD/llvm-12.0.0.src/build/../projects/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
    #19 0x7f064a594349 in __libc_start_main (/lib64/libc.so.6+0x24349)
    #20 0x4e06f9 in _start /home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:120

SUMMARY: AddressSanitizer: heap-use-after-free /home/ahunt/git/gimp/app/core/gimpimage.c:4743:7 in gimp_image_set_selected_layers
Shadow bytes around the buggy address:
  0x0c2a7fffa3d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2a7fffa3e0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2a7fffa3f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2a7fffa400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2a7fffa410: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c2a7fffa420: fd fd fd fd fd fd fd fd fd fd[fd]fd fd fd fd fd
  0x0c2a7fffa430: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa
  0x0c2a7fffa440: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2a7fffa450: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2a7fffa460: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2a7fffa470: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==21241==ABORTING

( crash-f37f84bd7072e65348ca0e2c920d1e08165356fd )
2024-07-20 13:26:31 -04:00
Alx Sa ff9f71e9a6 widgets: Connect GimpToolPresetEditor to icon size changes
Inspired by Mark Sweeney's work.
GimpToolPresetEditor has an icon next to its title which does
not react to icon size changes.
GimpToolPresetEditor's parent_instance, GimpEditor, already
has a "button-icon-size" CSS style which can be accessed in
its children. This patch adds signals to listen for icon size
changes and update the icon size accordingly.
2024-07-20 01:55:01 +00:00
Alx Sa e4ae257ae7 dialogs: Retain XCF compression setting after export
Resolves #9105
The XCF compression setting is initially
set to FALSE. It was only updated from the
Save Dialog, so if the user exports then
compression is reset if they save the XCF
again.

This patch adds a condition on export
where we get the image's compression
setting, instead of always defaulting to
FALSE. This allows you to save and export
the same image without having to
re-enable the compression setting each
time.
2024-07-20 00:06:03 +00:00
Alx Sa d701b70336 pdb, libgimpbase: Rename GIMP_VECTORS_STROKE_TYPE...
...to GIMP_PATH_STROKE_TYPE as part of
the GimpVectors -> GimpPath API
update.
2024-07-19 15:07:43 +00:00
Cheesequake 6b611a4802 actions: move top and bottom item check code 2024-07-18 17:57:17 +00:00
Alx Sa 0a3613e48d actions: Rename return_if_no_vectors_list macro...
...to return_if_no_paths to match the
change to GimpPath as well as the format
of the layers and channels macro.
2024-07-17 23:25:48 +00:00
Jacob Boerema 97df731de1 app: be consistent and use plural for multi-select path actions 2024-07-16 17:21:55 -04:00
Alx Sa f036812a94 libgimpwidgets, widgets: Fix icons on Path locks
The visibility lock icon and help ID was accidentally
left off the PathsTreeView set-up.
The Path Attributes also used the wrong icon to indicate
the paths were locked (compared to the one shown in the
Path Attributes dialogue).
2024-07-16 17:50:41 +00:00
Cheesequake afea82ed6c Issue #11809: Fix raise and lower actions for channels and paths 2024-07-16 15:21:44 +00:00
bootchk f4f71e4296 PDB: fix #11815 CRITCALS from defaulted args for gegl wrapper procs
Revise the tests that can't default the args.

Actual args default to the min value formal declared in the PDB.
The declared min value must correspond with declaration in GEGL.
2024-07-16 10:25:41 +00:00
Alx Sa ba635d83a7 pdb: Remove item_is_attached restriction from NDE filters
As of fcdddad2, the requirement for layers
to be attached before NDE filters can be
applied has been removed on app/core. 
This patch removes the restriction from 
the PDB call for filters as well.
2024-07-15 21:12:17 +00:00
Alx Sa d8b984a4eb pdb: Add check for indexed image to gimp_image_get_colormap ()
The description promises that we return
NULL if the image is not in indexed mode,
but we didn't actually verify that it was
before continuing with the colormap
code. This patch adds that verification step.
2024-07-15 12:31:58 +00:00
Cheesequake bdab00d04b Issue #11732: Fix Raise and Lower actions for Multi-Layer selections 2024-07-14 19:21:53 +00:00
Alx Sa f2699aaeeb app: Specify Levels meaning for translation
Some languages like Chinese use separate
words for Levels when referring to a color
scale versus a unit of measure. Currently
we group all of them together.
This patch distinguishes between Levels
as Color Scales versus "measurements" for
translation purposes.
2024-07-14 01:31:24 +00:00
Alx Sa 2e6938b3da app: Rename app/core GimpVectors vectors API...
...to path.
Changes the names of
gimp_vectors_* () API to
gimp_path[s]_* (). Renames related files
to [path] instead of [vectors], along with
relevant enums and functions.
2024-07-13 05:07:57 +00:00
Alx Sa e8df68fb65 libgimp, app, pdb: Rename GimpVectors to GimpPath
This commit renames the GimpVectors
object to GimpPath in both app/core and
in libgimp. It also renames the files
to gimppath.[ch] and updates the relevant
build and translation files.
There are still outstanding gimp_vectors_* ()
functions on the app side that need to be renamed
in a subsequent commit.
2024-07-12 06:16:25 +00:00
bootchk 24554d7fe2 app/plugin fix #11407 PLUGIN_DEBUG_WRAP=all
So a tester can valgrind all plugins.
2024-07-11 13:29:57 +00:00
Alx Sa 7fe398ca1a display: Fix regression accidentally introduced 2024-07-11 01:38:13 +00:00
Alx Sa d1af2efa95 vectors: Swap code files also 2024-07-11 01:17:49 +00:00
Alx Sa 5cd7c5c2f8 actions: Swapped text actions 2024-07-11 01:17:49 +00:00
Alx Sa 853f37bed9 app: Rename app/core GimpImage vectors API...
...to paths.
Similar to d0bdbdfd, but covering the
app/core versions of the API instead of
libgimp. Changes the names of
gimp_image_*_vectors () API to
gimp_image_*_path[s] ().
Also renames some related functions such
as gimp_image_pick_path (). The next step
will be to rename the gimp_vectors_* () to
gimp_path_* ().
2024-07-11 01:17:49 +00:00
Alx Sa c1bd108bba widgets: Connect Configure this tab icon to icon size changes
Inspired by Mark Sweeney's work.
GimpDockbook's dockable tabs update whenever the icon size is
changed. However, the Configure this tab button icon does not,
so it always remains at 12px. This patch adds code to resize it to 75%
of the current tab icon's size, which mirrors the default relationship
of 12px to 16px. This allows the icon to grow when the icon size is
set to Large or Huge.
2024-07-10 10:03:32 +00:00
bootchk 0dae61772a Fix #11613 crash Wayland flatpak unreffing GBytes window handle
Refactor: extract method gimp_widget_free_native_handle.
This reduces duplication of code and encapsulates Wayland specific code.

Call the new function in more places.
This is expected to fix #11613 but it is hard to be sure
since the exact sequence of events in 11613 was never determined
and only reproduceable in some flatpak builds.

Calling the new function in more places also should eliminate leaks.
But I did not test there was a leak prior to this fix.
2024-07-09 17:48:53 +00:00
bootchk 5cc187b597 Fix #9851 radio menu groups fail show any active item
End the radio group of a submenu when the submenu ends.
So subsequent radio menu items are in a new radio group.
2024-07-09 15:42:50 +00:00
Alx Sa b90b6bce00 pdb, libgimp: Rename libgimp GimpVectors vectors API...
...to paths
Follow-up to d0bdbdfd. Changes all
gimp_vectors_* () PDB to gimp_path_* ()
and renames relevant PDB files from
vectors to path.
The next step will be to rename
GimpVectors in libgimp to GimpPath,
removing the last (public) trace of it.
2024-07-08 23:39:51 +00:00
Alx Sa d0bdbdfdf6 pdb, libgimp: Rename libgimp GimpImage vectors API...
...to paths

The first step in converting GimpVectors
to GimpPath. The PDB API for any
gimp_image_*_vectors () is now
gimp_image_*_paths ().
This commit only covers libgimp, and
the app/core versions will be renamed in
a following commit.
2024-07-08 02:09:42 +00:00
Jehan ebc4f9afab app, libgimp: initialize GimpGroupLayer.
If the type is not registered, g_type_from_name() is not able to find
the GType from the type name.

Fixes:

> gimp_gp_param_to_value: type name GimpGroupLayer is not registered

Also add a bit more type handling code.
2024-07-07 22:27:22 +02:00
Alx Sa 8e6fb3d0e4 pdb: Remove uchar type
Resolves #10855
Replaces the uchar arguments in
plug_in_exchange () with floats to better
match gegl:color-exchange's arguments.
Since this was the last plug-in that used
uchar, we also remove the datatype from
PDB.
2024-07-07 11:14:41 +00:00
Jehan fc3cfc7771 app, libgimp: oups, fixing some generated sources.
These were some last minute fixes in the PDB and it looks like I forgot
to amend commit b1736a6736 with these!
2024-07-07 10:43:51 +02:00
Jehan b1736a6736 app, libgimp, pdb, plug-ins: new GimpGroupLayer class in libgimp.
Also:

- renaming gimp_layer_group_new() to gimp_group_layer_new() in order to keep the
  same name as in core code (i.e. GimpGroupLayer, not GimpLayerGroup).
- renaming gimp_image_merge_layer_group() to gimp_group_layer_merge()
- new functions: gimp_procedure_add_group_layer_argument(),
  gimp_procedure_add_group_layer_aux_argument() and
  gimp_procedure_add_group_layer_return_value().

This can be tested, e.g. in Python with these calls:

```py
i = Gimp.get_images()[0]
g = Gimp.GroupLayer.new(i, "hello")
i.insert_layer(g, None, 1)
g2 = Gimp.GroupLayer.new(i, "world")
i.insert_layer(g2, g, 1)
g.merge()
```

This was work started long ago, stored in an old stash which I finally
finish now! :-)
2024-07-07 10:27:04 +02:00
Alx Sa ea63e99ab8 widgets: Cast GimpColorDialog to GtkWidget...
...when passing it in gimp_color_dialog_style_updated ().
This fixes a compiler error introduced in c5efa0b8 on
some Windows builds.
2024-07-05 11:43:40 +00:00
cheesequake 8ebe9b090d core: Fix layer regeneration after crop undo
Resolves #10523
As we loop through every layer, we enable resizing
of the drawable on undo.
2024-07-03 11:26:55 +00:00
Alx Sa b3b32c7765 widgets: Disconnect gimp_color_editor_display_changed...
...when dockable is closed.
Resolves #11748

gimp_color_editor_display_changed () was still connected to
the user context when the Color dockable was closed. This
resulted in either a critical or crash if a new Color dockable
was opened or if the GIMP was closed. This patch should
cause the signal to be disconnected automatically when
the editor is destroyed.
2024-06-30 04:14:48 +00:00
Alx Sa c5efa0b874 gui, widgets: Connect GimpColorNotebook to icon size changes
Inspired by Mark Sweeney's work.
GimpColorNotebook has existing code to
update the color selector tab icon sizes
via CSS. However, it was not set up to be
notified of icon size changes from the GUI.
Since GimpColorNotebook is in libgimpwidgets,
we call its style_updated () function from
the style_updated () functions of the two
widgets its created in - GimpColorEditor
and GimpColorDialog.
2024-06-29 20:10:26 +00:00
Joachim Priesner 35deb1eb30 dialogs: Don't escape underscores in Welcome Dialog recent files list
It seems unnecessary – at least on my system, files with underscores in
their names are shown with two underscores in the recent files list.
This patch fixes that.
2024-06-28 20:50:21 +00:00
Alx Sa 87eadbf5d1 dialogs: Fix theme selection on reset
The Preference settings for themes and icon themes
are not directly connected to the property due to
the possibility of custom themes. Instead, we create
GtkListBoxes and load all the theme values. As a result,
when the preferences are reset, the row selection is not
updated.

This patch adds signals to the config object that update
the listbox selections when the Reset button is clicked.
The handler IDs are stored in the dialogue so that we
can remove them when the dialogue is closed.
2024-06-27 14:14:15 +00:00
Jacob Boerema 0c3bf56d83 app: fix help id for layer-lock-visibility is not set 2024-06-26 15:16:45 -04:00
Jacob Boerema 1e0be3d063 app: fix CI build failure core-enums.c is generated from core-enums.h
I only updated the mask strings to plural in core-enums.c, overlooking
that it is generated from core-enums.h.
So, update the same strings there after "desc".
2024-06-24 19:25:25 +00:00
Jacob Boerema 51b444b846 app, actions: be consistent and use plural for layer moving ...
commands that work on multiple layers:
Raise Layer -> Raise Layers
Layer to Top -> Layers to Top
Lower Layer -> Lower Layers
Layer to Bottom -> Layers to Bottom
Also update the hint strings.
2024-06-23 19:05:01 -04:00
Jacob Boerema 5f41b4460c app, actions: be consistent and call Duplicate Layer -> Duplicate Layers
Since it works on multiple selected layers use the plural like we
also do in other similar cases.
2024-06-23 14:09:06 -04:00
Jacob Boerema 6dbf144f6b app: add missing help ids for the text tool 2024-06-22 16:47:44 -04:00
Jacob Boerema 9c432f6505 app, actions: use consistent naming for Text to Path
In the main menu and layers dialog context menu it is called
`Text to Path`, let's use that same name in the text tool actions
instead of `Path from Text`.
2024-06-22 16:11:57 -04:00
Jacob Boerema a3ecca3487 app: fix some layer mask strings
Not all layer mask menu commands and help texts were updated to reflect
that they work on multiple masks.
Updates
- Apply Layer Mask -> Apply Layer Masks
- Delete Layer Mask -> Delete Layer Masks
- Their text hints and the one for Disable Layer Masks

Updates the undo strings, even though these don't seem to be used
anymore? Looks like undo always picks the menu command now.
2024-06-22 14:20:02 -04:00
Alx Sa fcdddad2a7 core: Include NDE filters when opening as layers
Adds code to copy any NDE filters when
importing an .xcf file as layers in an
existing project.
This also requires removing the check
for the layer being attached to an image,
which historically made sense because
filter effects were immediately merged
down. Now that filters can exist separately
the check is no longer required.
2024-06-20 19:06:57 +00:00
Alx Sa 134100fb8a app/tools: Allow locked layers to be used as sources
GimpSourceTools like Clone and Heal use GimpPaintTool's
code for determining if they can work on a pixel-locked
layer. This means that they can not set a locked layer as a
source even though that would not affect the locked layer's
pixels.
This patch adds an additional condition to GimpPaintTool, to
allow operations if the tool is a GimpSourceTool AND only
Ctrl is held down. This allows the layer to be set as a source
while preventing it from being drawn on.
2024-06-20 13:13:47 +00:00
Jacob Boerema d190c37a2c app: add missing help-id for layer effects
Note that this isn't enough for F1 to work, but that is a separate
issue.
I think that for now one help-id for all the layer effects is enough,
until we get a more final UI.
2024-06-19 13:42:49 -04:00
Alx Sa dc0449b05e widgets: Fix label background on Curves tool
Resolves #11702
In 2.10, the x/y label background on the Curves tool used
GtkStateType enums to get the widget's background color.
These enums were depreciated in GTK3, and during the
port the gdk_cairo_set_source_rgba() command was left
out. This resulted in the current line color being used instead,
making it hard to read the label in some instances.

This patch restores the Cairo color update command, using
the gridline color as an equivalent to the background color
from 2.10.
2024-06-17 13:05:38 +00:00
Alx Sa 9256a15363 widgets: Prevent image name from affecting the dialogue width
Resolves #7588
After the port to GTK3, the Filter dialogue's width started
to be affected the length of the image name. If the name
was very long, the filter dialogue would expand to fit it.

This patch encloses the image title label in a GtkScrolledWindow
with polices of EXTERNAL width and NEVER height. This ensures
there will not be a scrollbar, and the label will not influence the
width of the dialogue. A tooltip was added in case the user wants
to hover to see the full name.
2024-06-16 16:12:16 +00:00
cheesequake fb4cd9aedc core: Fix drawable filter duplication
Resolves #11690
While exporting, the image is duplicated, in turn,
filters are also duplicated. This patch fixes the
duplication by also copying the parent
GimpFilter's properties.
2024-06-15 13:58:33 +00:00
Alx Sa 0be5db0b77 widgets: Allow deleting inactive filters
Resolves #11687
Previously gimp_drawable_has_filters () was used to check
if a drawable had filters before deleting them. However,
this function actually only checks if there's an active filter -
if filters are attached but set to invisible, this returns false.
This mean that you could not delete filters if they were
invisible.
This patch switches to using gimp_container_have () instead
as it checks if the filter is in the drawable's filter stack.
2024-06-12 13:44:21 +00:00
Alx Sa 2260e8bbe8 core: Fix palette error handling
Resolves #11679
The loading code for ASE, ACB, and ACO palettes
set any errors with g_prefix_error (). However, the
error object is NULL at that point for those palettes.
Therefore, a NULL error object is returned to
palette_import_make_palette () which then tries to
access its attributes. This resulted in a crash.
This patch fixes the issue by using g_set_error () for
those three formats instead.
2024-06-11 12:43:39 +00:00
Alx Sa ceb9747e23 libgimpwidgets: New API to check system animation status
Ports the animation code started in e13cc635
to an independent gimp_widget_animation_enabled()
function. This allows plug-in authors to
also conditionally turn off animations if
the user's system settings say to do so.

The function is applied to the About
Dialogue animation as well as two Easter
Egg animations:
* Wilber's eyes blinking after 23 minutes
on an empty canvas
* Wilber's eyes following the mouse after
a certain sequence of tools is clicked
2024-06-10 13:47:25 +00:00
Cheesequake 22c59503b5 app/tools: Fix Filter GUI when expanding vertically,
Resolves #11656
Since e4b1f37e, Filter Tool widgets above the Blend
Mode frame do not expand vertically when the dialogue
is resized.
This especially impacts GeglGraph, as you can no longer
increase the text area to see more graph code.
This patch resolves the issue by adding a GtkExpander
to the GUI so that it allows the inner area to resize
vertically.
2024-06-09 15:02:48 +00:00
Jehan cca637135b app, libgimp, pdb, plug-ins: fix failure to set plug-in as transient.
While setting a plug-in as transient usually worked, it was failing in
cases the plug-in's progress bar was not initialized (i.e. if
progress_init() was not called before setting the dialog transient).

This commit stores the calling display, core side too (libgimp side, the
plug-in already had the calling display ID information), and we use this
when a GimpProgress has not been created yet.
2024-06-08 21:54:21 +02:00
Jehan 39ea23ed52 app, libgimp, plug-ins: improve GimpVectorLoadProcedure workflow.
I'm moving the logic of choosing a correct default for width/height by adding an
"extract dimensions" callback in the procedure. The logic is that every vector
format out there should likely have metadata either for pixel dimensions or
physical dimensions, or at the very least for no-unit dimensions (ratio only).

Vector load procedures will have to implement only the extraction of such data
in a callback called by GIMP but not how to act upon them, so that we have a
common logic for all vector images.

I am implementing this callback first in the SVG plug-in, moving all the code
to extract dimensions (and improving it) in this callback.

Also I am deleting "file-svg-load-thumb" procedure. I could simply reimplement
it using the same code, but it looks to me like this is very useless for vector
formats to have a specific thumbnail procedure (unless it were to use very
specific metadata for faster result). This is vector data, just ask it directly
at the proper bounding box size.
2024-06-08 18:58:06 +02:00
Bruno fb5474ae4d
Issue #4053: Add "*default_bin" support on Windows and enable it
Almost every program have a non-versioned .exe on Windows. MSYS2 does this too.
2024-06-05 11:51:14 -03:00
Alx Sa 29bb5b3608 dialogs: Respect Windows Show Animation option
Building on d25d8778, this patch checks the Window
"Show Animation" option and uses it to determine
if the About Dialogue animations should be active.
2024-06-05 12:49:20 +00:00
Alx Sa d25d877899 dialogs: Respect MacOS Reduced Motion option
e13cc635 uses gtk-enable-animation to determine whether
the more dynamic motion animation should be used for the
About Dialog credits. However, gtk-enable-animation does
not take into account the MacOS preferences.
This patch adds a check for this value using NSWorkspace's
accessibilityDisplayShouldReduceMotion boolean. Since the
value is TRUE on MacOS if the user wants animations turned
off, the boolean is inverted.
2024-06-04 16:46:01 +00:00
Jehan 349191b8ab Issue #10406: get rid completely of the animated authors list when…
… "Reduce Animation" is checked.

This is an alternate version for commit e13cc63525.
Instead of proposing a simpler animation (fade-in/out instead of wave
animation), let's just completely get rid of the whole thing when
someone enabled an accessibility option saying that long animated
contents are basically disturbing to them, which is how I understand
additional issue #11647.

In fact, reading Mozilla docs about such option:
https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion#user_preferences
… they even mention vestibular motion disorders, which seem pretty
serious and would make our About dialog quite uncomfortable.

I tried to experiment with just showing a part of the authors list, then
ending on a link text to the Credits tab after a few second, but it
didn't feel that interesting nor useful. Anyway the whole animated
widget is redundant with said Credits tab, and therefore more on the
"fancy" side of things than on the useful one. Hence let's make simple:
if someone configure their OS saying that animated elements are a
discomfort, let's just get rid of useless ones! Done!
2024-06-04 17:25:37 +02:00
Alx Sa 5bd293340f dialogs: Redesign Welcome Dialogue options layout
Currently, the additional customization
options are laid out horizontally.
Depending on the translation, this might
cause the dialogue window to become
much wider.

This patch converts those options to
GtkSwitch and puts them in a column.
prefs_switch_add () was modified to also
return the GtkSwitch object, so we could
bind its active property for the icon
override property.
2024-06-04 01:57:51 +00:00
Alx Sa e13cc63525 dialogs: Reduce About Dialog animations if requested
The About Dialog shows authors names using motion effects.
Since this is done with Cairo, it does not respect the
"gtk-enable-animations" setting or OSX's "Reduced Motion"
option.

This patch retrieves the "gtk-enable-animations" value.
If it is set to false, then the simple fade-in effect is used
for author names in place of the motion effects.
2024-06-02 02:05:24 +00:00
Alx Sa 1426701143 scriptfu, tools: Allow off-canvas guides in more places
Resolves #10609

Continuing from 1759174d, this patch
removes the on-canvas restrictions for
guides from the New Guide dialogue and
the Measure Tool's guide creation feature.
2024-05-31 12:03:44 +00:00
lillolollo a21b18bbec app/widgets: Fix deprecated code in GimpToolBox
Replaces gtk_widget_show () with gtk_widget_set_visible ()
and replaces margin-left/margin-right with margin-start and
margin-end properties.
2024-05-29 13:43:17 +00:00
Alx Sa 83141ba62d actions, plug-ins: Minor clean-up and warning fix
*In file-pnm, format_name is no longer
used due to changes in exporting
functions. This was creating a warning
about an unused variable.

*In 519f301c, an attempt to add a
short-key for MacOS Settings was left in.
It did not work because "comma" should
be spelled out rather than using ",". This
patch removes the accelerator.
2024-05-28 16:16:29 +00:00
Alx Sa 1759174d9d pdb: Allow off-canvas guides with Script-fu
Commit 015f4946 allowed guides to be
placed off-canvas in the GUI. However,
the restrictions were not removed from
the Script-fu implementation.
This patch fixes the Script-fu parameters
and conditional checks to match the
GUI implementation.
2024-05-27 15:42:10 +00:00
Alx Sa c8049f2ed5 app/tools: Fix editing custom NDE filters
Resolves #11211

The code that moves the temporary "editing" filter
when modifying an NDE filter was not being run
on custom GIMP filters like Curves. This meant that
editing Curves would always place the temporary
"editing" filter at the top of the filter stack, giving
an incorrect preview of what the changes would do.

This patch moves the reorder code from being in
gimp_filter_tool_create_filter () to being in
gimp_filter_tool_set_config (), which always runs
when any filter is created.

This change also fixes a separate issue where the
filter mask would not be copied over for Curves.
2024-05-26 12:37:47 +00:00
Alx Sa 742ec5689d widgets: Block removing tool-based NDE filters
Currently, messing with filters that are
being managed by tools (like Warp or
Gradient) causes crashes. For now, we'll
prevent removing NDE filters which are
tool-based, and revist after 3.0 is released.
2024-05-22 19:59:40 +00:00
Cheesequake e4b1f37e4e tools: Improve Filter Tool UI for Blending Options...
...by having it stay in the same position when expanded
and closed rather than moving to the bottom afterwards.
2024-05-21 19:15:43 +00:00
Alx Sa acf2756e4a widgets: Update image display on imageview select
In the Image Dockable, clicking on an image will update the layers and 
navigation views. However, the actual canvas image will not update
unless you double-click the item.
This adds a select_item function so the canvas is updated on a single 
click as well.
2024-05-21 17:31:05 +00:00
Idriss Fekir 4a174206af text: Fix loading XCFs with XLFD fonts 2024-05-21 17:19:33 +01:00
Alx Sa 5f38c37b98 tools, core: Don't stroke/fill paths on pixel locked layers
Resolves #11568

Currently, the Stroke/Fill Paths options on
the Path tool disregard the Pixel Locked
flag for layers. This patch resolves this as
follows:

* On the Paths tool, the Stroke/Fill button
does not pull up a dialogue if a single
layer is selected and it's pixel locked.
* If multiple layers are selected, only those
that are not pixel-locked have the Fill/Stroke
applied to them.

In both cases, a warning is also displayed.
2024-05-21 12:57:55 +00:00
Alx Sa 519f301c65 actions: Use Settings rather than Preferences on MacOS
Per Lukas Oberhuber, Preferences should be called Settings
on MacOS, as it was before the GTK3 menu port.
2024-05-19 02:12:44 +00:00
Alx Sa 47dde0580a libgimpwidgets: Fix formatting from 8adcc0cd
Some minor code style issues remained 
that I missed in 8adcc0cd.
After further reflection, I also converted
the code to be a private/internal function.
gimp_prop_check_button_new () should
cover the majority of GtkCheckButtons,
and the function is currently only used
to fix the size of those widgets. We could
revisit it as a public function in the
future if more use cases are found.
2024-05-19 02:10:23 +00:00
Mark Sweeney 8adcc0cdcb libgimpwidgets: Fix GUI twitching due to bold label sizing
Resolves #10026

Selecting a checkbutton makes the label bold. This increases the
width of its label, and if it's the longest item in a box, this
causes minor "twitching" and resizing of the dialogue.
This patch calculates the size of the label when bold and then
requests the label width be set accordingly to resolve the issue.
2024-05-18 21:33:51 +00:00
Alx Sa e51a128acd text: Update font property to GimpFront
Resolves #11550
The import code for X Logical Font Description fontnames
was not updated to use GimpFont instead of strings.
This caused crashes when we tried to set GimpFont properties
with gchars. This patch updates the code to create a new
GimpFont object from the font name string.
Additionally, it increases the read length by one, as we were losing
the last character of each field as it was split on the "-" character.
2024-05-17 14:47:29 +00:00
Oleg Kapitonov 7ccfad1716 app: Fix localization language in Windows 2024-05-16 16:42:47 +00:00
Alx Sa aa30b40fee core, xcf: Prevent copying tool-based NDE filters
For now, we can't keep certain GEGL ops
like Gradient as NDE filters, since they are
connected to tools. If the layer is copied
or saved as an .XCF while the tool is still
active, it attempts to save it and causes a
crash.
This patch adds a check to make sure the
copied filter has been commited and that
it's not a tool-based NDE filter before
being copied. It also adds some NULL
checks where gimp_drawable_filter_duplicate
is used to prevent NULL from being
added to the filter stack.
2024-05-14 04:05:06 +00:00
Simon Budig 1b142eb604 app: don't leak the GeglColor in GimpPaletteEntries. 2024-05-06 00:35:51 +02:00
Simon Budig 32336a2350 app: avoid uninitialized memory for color names 2024-05-06 00:35:51 +02:00
Simon Budig 6877a3cd43 app: use the logical rectangle for positioning the splash text.
This avoids jiggeling baselines for texts with/without descenders.
2024-05-05 16:55:41 +02:00
Alx Sa 3260299f4a libgimp, plug-ins: Remove n_drawables parameter from gimp_file_save () 2024-05-03 15:22:39 +00:00
Alx Sa 443947c6aa plug-ins: Remove n_drawables parameter
Port all plug-ins to retrieve the layers
directly from the image rather than
having them passed in. This resolves some
issues with introspection and sets the
foundation for future API work.
2024-05-03 15:22:39 +00:00
Alx Sa 0b171e9bae core: Copy NDE filters in layer group children
Resolves #10765
This allows us to retain any filters that a
layer group's children might have when
copied or exported. They were previously
lost when the group layer was duplicated.
Note that an OR condition was added to
GimpDrawableFilter creation, to allow
one to be created if the layer was 
attached to a parent layer rather than the
image.
2024-04-29 20:51:36 +00:00
Cheesequake 10cc33b28e widgets: Deleting effects now deletes the selected effect instead of the topmost effect
Resolves #11404
Since the GimpContainer selected function automatically updates which filter is the
"active" selected filter, we can remove the code that sets it to NULL after a filter
is deleted. This fixes a bug where the top effect was always deleted in subsequent
attempts rather than the highlighted one.
A now unnecessary gimp_drawable_remove_last_filter () function was also removed.
2024-04-29 11:34:59 +00:00
Alx Sa 9a4d365d59 core: Copy correct filters to new layers
Should resolve #11392

In dfb26f37, the NDE filters in the copied image are
retrieved with gimp_image_get_layer_iter (). This works
fine for single layer images or when all the layers are copied
at once. However, if a subset is copied then the filters are always
copied starting from the top level of the image. This can result
in an incorrect filter being copied to the wrong layer.
To fix this, we get the filters from the provided drawables list
instead. This matches the number of layers in the copied
image exactly, since it was used to create the copied image.
2024-04-26 04:17:08 +00:00
Jehan 9d93160de6 Issue #11384: new Image automatically uses comment from active image. 2024-04-25 00:20:32 +02:00
Jehan 390340b433 app: fix cases of missing data directories by always trying to mkdir them.
This happens in particular for in-build runs (or when using
GIMP3_DIRECTORY environment variable on an empty directory). In any
case, I don't see why we wouldn't try and create a directory which was
configured for data storage.
2024-04-24 19:48:59 +02:00
Jehan 768f871bc7 app, libgimp, pdb: new GimpVectorLoadProcedure class.
It's still basic but will help to share code for support of various vector-able
formats, such as the logic for dimensioning them, but also the generated GUI.

Not only this, but we are paving the way for the link layers (though it'll be
after GIMP 3, we want plug-in procedures' API to stay stable) by giving a way
for a plug-in procedure to advertize a vector format support. This way, the core
will know when a source file is vector and can be directly reloaded at any
target size (right now, in my MR for link layers, the list of "vector" formats
is hardcoded, which is not reliable).
2024-04-24 01:16:46 +02:00
cheesequake 5c646830a5 Fixes #11338: Layers do not teleport to the bottom of the list if dragged onto the headers 2024-04-24 00:23:40 +05:30
Anders Jonsson 83dee0e43a app: translate link labels and tooltip in Welcome dialog 2024-04-23 14:57:25 +00:00
Alx Sa 47aabfc93a core, libgimpcolor: CMKY & HSL to float
Continuing 32d64ab1, this converts the
few instances of CMYK and HSL/A double
to float to match babl's precision.
2024-04-23 13:38:59 +00:00
Alx Sa c691bd2a0b actions: Prevent crash due to non-existent editors
Resolves #10914

Some dockables such as "gimp-pattern-editor" and
"gimp-mybrush-editor" are listed as Editors even though
we don't yet have dedicated GimpDataEditors for them.
This causes problems when using certain features like
duplicating. To resolve for now, we check if
gimp_window_strategy_show_dockable_dialog () returns a
valid GimpDataEditor before trying to use it.
Per Jehan, we also verify that an edit button exists
and is visible before we try to call the edit command.
2024-04-22 01:24:36 +00:00
Bruno Lopes 3f0532ba86 app, devel-docs: add a bit of MS Store documentation
See also: Infrastructure/gimp-web-devel!46
2024-04-21 18:18:35 -03:00
Alx Sa 32d64ab1c9 core, widgets: Convert HSV/A to float
Per Pippin, the only color model that can
have double precision is RGB/A.
Therefore, we need to switch all others to
use float instead. This patch converts the
HSV and HSVA double babl formats.
2024-04-21 03:42:27 +00:00
Jehan 106d18605a libgimpcolor, app: gimp_color_parse_(css|hex|name)() renamed with _substring() suffix.
New functions with the same name as these functions are created, except without
the length argument (i.e. it's equivalent to calling these with -1).

The reason for this is that using strings with a length variant which may be
negative to switch to NUL-terminated strings are not bindable. At least in our
case, when testing in Python, the input string ended up as corrupted garbage and
GObject Introspection docs warns about such interfaces:

> In particular, avoid functions taking a const char * with a signed length that
> can be set to a negative value to let the function compute the string length
> in bytes. These functions are hard to bind, and require manual overrides.

(see: https://gi.readthedocs.io/en/latest/writingbindableapis.html#strings)

So instead, I create a simple version which runs on NUL-terminated strings only
and which is bound, whereas unbinding the generic length-version (making it
C-only, or maybe usable in some other bindings which ignore the (skip)
annotation; apparently some do this).
2024-04-20 12:37:20 +02:00
Jehan 2b27feb2fd app, libgimp*, modules, pdb, plug-ins: new GimpParamColor.
This is meant to obsolete GeglParamColor with at least an additional argument
has_alpha which we need in GIMP. It allows to advertize when a parameter wants
an opaque color, which in particular means we know when displaying a GUI to pick
colors with alpha or not.
2024-04-19 23:25:13 +02:00
Jehan cbb333c220 app: accept a NULL default color in plug-ins.
Our pluginrc code is already able to output NULL for a default NULL color, but
reading was failing with the following error:

> GIMP-Error: Error while parsing '/home/jehan/.config/GIMP/2.99/pluginrc' in line 289: unexpected identifier 'NULL', expected number (integer) - fatal parse error

Let's support reading such a value now, especially as for Python plug-ins, we
are not even able to add a default value to GeglColor arguments (cf. previous
commit).
2024-04-19 19:13:53 +02:00
Jehan e7b7efafe9 app, libgimpcolor: no GValue GimpRGB anymore! 2024-04-19 14:42:08 +02:00
Jehan a50759cda8 app, libgimp*, pdb, plug-ins: remove GimpRGB support in GIMP protocol.
There are no plug-ins which uses GimpRGB for procedure argument, nor is there
any base PDB procedure. We don't pass this type anymore through from/to
core/plug-ins. So let's clean the whole code out as a next step to get rid of
GimpRGB from our codebase!
2024-04-19 14:34:22 +02:00
Alx Sa 97d6aa5904 widgets: Close Layer Effects popover when changing images
Resolves #11347

In multi-window mode, it is possible to change images without
causing the layer effects popover to close. This results in the prior
image's layer effects being shown over the new image, which is
confusing. This patch causes the popover to automatically close
when the image is changed to prevent this problem.
2024-04-19 01:58:56 +00:00
Jehan 2434c41a12 app, plug-ins: renaming the `file-*-save-internal` procs to `file-*-export-internal`. 2024-04-18 16:02:00 +02:00
Jehan 9f149ef3a2 app, libgimp*, plug-ins: get rid of GimpRGB arrays now that we have GeglColor arrays. 2024-04-18 16:00:42 +02:00
megakite e961ff0fe2 app/menus: update tool options menu while initializing menus 2024-04-18 10:22:11 +00:00
Alx Sa dbbdbb45e1 core: Fix filter mask when copied to new image
Switch to using gimp_item_convert ()
instead of gimp_item_duplicate () so that
the filter mask can be properly associated
with a new image when copy/pasted.
2024-04-18 02:25:14 +00:00
Alx Sa dfb26f37e7 core: Allow copy/pasting NDE filters
Previously, filters were lost when copying
individual layers. This patch copies them
to the clipboard image on cut or copy,
then copies them back to the pasted
image.
It also fixes an issue where filters would
be merged down if a selection was
copied instead of the entire layer.
2024-04-18 02:25:14 +00:00
Jehan 252f991cfb app: swapping gimp_prop_color_button_new() and gimp_prop_gegl_color_button_new().
Color propwidgets now use GeglColor only.
2024-04-18 00:37:20 +02:00
Jehan 80334f0eba app: gimp_gegl_color_new() is not used anywhere anymore.
We don't need to convert GimpRGB to GeglColor now as we work directly with
GeglColor!
2024-04-18 00:25:14 +02:00
Alx Sa 2af0218d23 widgets: Do not show internal procedures as search actions
Resolves #11334

GBR, GIH, and PAT have internal save functions which are not meant
to be run directly. However, they were showing up in the Search dialogue
as valid options. This patch adds an additional check for "-internal" to
prevent users from accidentally running them, as they only give a warning.
2024-04-17 17:10:18 +00:00
Jehan 88d4033b98 Issue #9578: crash accessing tab menu.
The whole action name prefixing will definitely need to be straightened up in
our codebase at some point (differenciating the global actions and the local
ones).
2024-04-17 18:22:53 +02:00
Alx Sa c92cf7e8f2 plug-ins: Convert file_*_save to file_*_export
Resolves #10932

Since GIMP distinguishes between saving
XCF and exporting image like PNG,
we should change the PDB to show
export rather than save in the function
calls.
2024-04-16 16:07:10 +00:00
Jehan bf91e454fd app: fix build warnings.
Fix 2 "discards ‘const’ qualifier from pointer target type" warnings.
2024-04-16 16:40:36 +02:00
Jehan f10d9a706d app: keep image reference with weak pointer in GimpStatusBar.
Unlike the previous 2 commits, this was not making an error but was the reason
why our code was keeping the last closed GimpImage alive a bit longer than it
should. In particular, the status bar code was keeping a hard reference to the
image until the focus changed, hence preventing the object to get finalized
longer than necessary.

Now it will also be a weak reference, so the image is immediately freed when the
view is closed.
2024-04-16 15:48:54 +02:00
Jehan d888e95cfa app: keep track of image with a weak pointer.
Similar to the previous commit, but this time for the GimpAlignOptions.
2024-04-16 15:43:40 +02:00
Jehan 9abda0ab00 Issue #10826: crash when closing view.
Using weak pointers to make sure that the previously pointed image is still a
valid GimpImage.
2024-04-16 15:43:40 +02:00
Jacob Boerema af8ef61a04 app, pdb: fix incorrect group checks for edit-cut and edit-named-cut
As a follow up to the previous commit, I noticed that the pdb functions
gimp-edit-cut and gimp-edit-named-cut also incorrectly used
gimp_pdb_item_is_group.

This can be seen by calling Filters/Blur/Tileable blur when a group
layer is selected. The error message was incorrect.
We replace the call here also to `! gimp_pdb_item_is_not_group`.
2024-04-15 18:13:32 -04:00
Jacob Boerema 7aa33bf771 app, pdb: fix #8363 gimp_selection_float() crash
Calling gimp_selection_float from a Python plug-in could make it crash
with an error like Calling error for procedure 'gimp-selection-float':
Item x cannot be used because it is not a group item.

This is caused by an incorrect check for group layers.
gimp_pdb_item_is_group returns an error when the condition is False,
while we only want an error when a group layer is selected (True).
Thus we need to use gimp_pdb_item_is_not_group, which returns an error
when the item is a group, which is what we want.

These function names are a little confusing, we might need to think
about better naming sometime.

I added C/Python tests for this function, so that we can test whether
this works correctly.
2024-04-15 18:13:32 -04:00
Alx Sa 2ee847d8d0 actions: Hide Preview Size dockable option if not needed
Resolves #11250

In 2.10, we explicitly hid "dockable-preview-size-menu", the submenu
for Preview Size, if there were no previews to set sizes for in the
dockable dialogue. In 2.99, this code was removed as part of the
GAction port and code clean-up.
As a result, the Preview Size submenu is always visible even if the
options have no effect on the display. To restore the 2.10 behavior,
we set each Preview Size option's visibility. If all options are hidden,
the submenu does not appear.
2024-04-13 01:43:31 +00:00
Jehan ef9de3c263 app: initialize font to NULL.
In case there are no fonts loaded (which may happen in particular when starting
with --no-fonts), we need to make sure that font is initialized to NULL so that
we can return the standard GimpFont object and not a broken pointer.

Thanks to Idriss for the additional diagnosis, which would hopefully complete
commit 5dc86277e6 and take care of #11219.
2024-04-12 12:23:00 +02:00
Cheesequake 702d5e1e80 Issue #11071: Changed detailed_signal from "map" to "realize" to enable opening animations 2024-04-11 14:59:15 +00:00
Jehan 5dc86277e6 app: set font factory as GimpFont class member regardless of fonts being loaded.
Previous code would only set the class member when we were actually
loading fonts, so we ended with code paths where the member was NULL.

Fixes:

> GIMP-CRITICAL: gimp_container_get_n_children: assertion 'GIMP_IS_CONTAINER (container)' failed

It should hopefully also fix #11219 (though I couldn't reproduce this
failure).
2024-04-11 12:15:59 +02:00
Alx Sa 49c820e620 dialogs: Use error variable in Welcome Dialog
Resolves #11256

A GError variable was created but not passed to
file_open_with_display () when opening recent files.
As a result, if an error did occur the variable would be
used while it was still NULL. This patch fixes this
by passing a reference to error as the last parameter
of file_open_with_display ().
2024-04-11 01:25:42 +00:00
Alx Sa f346b1783b widgets: Disable DrawableChooser if no layer/channel selected
Resolves #11075

In the DrawableChooser pop-up, choosing an image without
also picking a layer or channel causes the pop-up not to
reappear on subsequent attempts to click it. This is because
the callback is only recreated when the drawable is updated,
and choosing just an image does not update the drawable.
For 3.0, we'll set the Okay button to insensitive unless a layer
or channel is picked.
2024-04-09 12:51:30 +00:00
Alx Sa cc74d40769 libgimpwidgets: Port GimpPickButton to GeglColor
Also have "color-picked" signal send a
GeglColor object rather than GimpRGB.
2024-04-09 00:48:35 +00:00
Luca Bacci d7228727d7 QuitDialog: disconnect signal handler on dialog destroy
...rather than finalize.

Fixes #10785
2024-04-04 20:18:56 +00:00
Anders Jonsson 134c354a9e app, pdb, plug-ins: lower Spread limit for Distort
Distort can call plug-in-spread with Spread of 1000 which causes an error.
This limits it to 512 which is the highest allowed by gegl:noise-spread
2024-04-04 12:04:12 +00:00
cheesequake 63a134a2b2 Issue #11021: cairo-ARGB32 uses "associated alpha", so changed the new formats accordingly. 2024-04-03 03:12:12 +05:30
Alx Sa c44941ae28 core: Resize filters with group layers
Resolves #11054

NDE Filters clip to the size of the layer when
applied. Group layers get their dimensions from
the largest layers under them, so an empty
layer has dimensions of 0 by 0. This means a
filter applied when the layer group is empty will
be clipped to 0 by 0 as well.
This patch adds code to refresh the filter's crop
whenever the group layer is resized by a
layer being added or removed.
2024-04-02 16:36:46 +00:00
Alx Sa 10eb615eff widgets: Port gimp_get_color_tag_color ()...
...to accept GeglColor paramaters instead
of GimpRGB. This function is used to draw
the layer/channel color tags.
Note that a temporary GimpRGB was left
to use with gimp_rgb_composite ().
It will be replaced once that function is
also converted to use GeglColor.
2024-04-02 04:00:50 +00:00