Commit Graph

23213 Commits

Author SHA1 Message Date
lloyd konneker c324ec3e8c Fix #6980 /app/pdb/gimppdb.c unnecessarily includes core/gimpmarshal.h 2021-08-06 14:21:51 +00:00
Jehan 7982a5d18c Issue #5386: Gimp crashes when setting AdobeRGB image to Indexed colors.
Similar to the fix of commit c0e605ef for RGB images with a profile as
notified by Massimo.
2021-08-05 18:53:15 +02:00
Massimo Valentini 3b2a8f79f0 Issue #5267: Cage transform tool causes artifacts.
I somewhat bisected GEGL commits between 0.4.20 and 0.4.24 and found
that the one that introduced the env var GEGL_OPERATION_INIT_OUTPUT is
the first showing the problem.

Reviewer (Jehan) note: so it would be commit 6e9610e65c on GEGL repo.
This fix makes sense as it means that since this commit, the output
buffer could have random values. It's not a problem for any operation
where we fill every value, but I guess it's not the case for
"gimp:cage-coef-calc" which was likely relying on the old behavior of
being 0-initialized.
2021-08-05 16:58:55 +02:00
Des McGuinness 4f9b7373e6 Issue #5989 - performance improvement patches for gtk and gimp
Reviewer comment (Jehan): we have used this patch successfully on our
installers since start of 2021 (see commit b4d665d of our gtk-osx fork)
and it really improved the situation. I only fixed minor coding style
stuff in the patch.
Looking at what it does, I guess it is not ideal long-term if related to
10-bit display (as I understand from the comment), which a graphics app
would want to support properly. But for now, this is better than
extra-slow display until we get macOS developers able to look at this
more in depth in the future (I don't think that our dependencies are
really ready yet for 10-bit display support anyway, though I may be
wrong).
Some other forums seem to say it comes from macOS invalidating now more
than it should (i.e. the whole area instead of only the changed area)
and this NSViewUsesAutomaticLayerBackingStores flag would disable this
behavior. It might be one of these reasons, the other or both. This is
anyway a good first start for future contributors.
2021-08-04 21:47:26 +02:00
lloyd konneker 37593d6da3 Fix #6979 meson build fails link libexecinfo on Alpine 2021-08-04 18:21:22 +00:00
Jehan f2fb98cb69 Issue #6610: crashes on free select for images of certain dimensions.
g_alloca() is unadvised. Even though it might be more efficient in some
specific cases, it is pretty subject to stack overflow when a lot of
memory is requested.

Let's allocate dynamic memory instead. To avoid doing it too much, let's
just reuse the same pointer especially since region of interest will
usually be the same size when iterating a buffer, except for border
ones (which would usually be smaller, so we can use the same allocated
buffer again). I still make size checks, just in case.
2021-08-04 14:41:44 +00:00
Jehan cc57860837 Issue #7115: properly chaining up finalize() methods.
Thanks to Massimo Valentini for finding these.
Fixes:

> GLib-GObject-CRITICAL **: 13:21:53.256: Object 0x5485140 of type GimpLineArt not finalized correctly.
> GLib-GObject-CRITICAL **: 13:21:57.472: Object 0x231f520 of type GimpExtension not finalized correctly.

Outputted when glib is built with -Dglib_debug=enabled and GIMP is run
with GOBJECT_DEBUG=objects.
2021-08-04 01:59:41 +02:00
Jacob Boerema af909b82b2 app: fix #6724 When creating keyboard shortcut the section being edited disappears
After updating a keyboard shortcut in the Configure Keyboard Shortcuts
Dialog, the section containing the changed shortcut disappeared.

Apparently a changed shortcut makes its parent invisible so we make the
parent visible again.
We also store a text version of the selected path in the tree to the
shortcut and then use that to restore the path after making the parent
visible again.
2021-07-29 17:59:30 -04:00
Jacob Boerema 42fe8abc98 app: fix #5153 keyboard shortcuts Shift+[ and ] don't work on most keyboards
On most keyboards the [ and ] keys are shared with { and }. Which means
that if you press Shift+[ you get {. We were using this key combination
to increase the tool's size by 10 and the other to decrease it by 10.

However, on all keyboards where these keys share the same physical spot
on the keyboard, this wasn't working.
So, let's change the actual keys to do this to { and }.
2021-07-28 13:38:26 -04:00
Jehan f8f768c077 app: adding a comment for translators.
As per comment by Alexandre Franke, so that translators are aware this
is not about a "map" like a "world map", but like "mapping" filters.

Cf. https://gitlab.gnome.org/Teams/Translation/fr/-/issues/17#note_1209282
2021-07-22 17:11:16 +02:00
Jehan 3598562472 app, libgimpwidgets: drop the thumbnail icon feature.
From years of discussions, it turns out that:
- The thumbnailed-Wilber icon replacing the generic icon of GIMP often
  makes the application harder to spot in the icon list of running
  processes.
- In single-window mode in particular, it makes even less sense as we
  just show the one active image anyway.
- Even in multi-window mode, nowadays many OSes or desktop group windows
  of a same application under one icon. So we end up with several image
  windows under a thumbnail only showing the top image. This happens in
  KDE, GNOME, Cinnamon and Windows at least apparently (as far as is
  being reported).
- Some platforms would just use only the OS-declared icon and not care
  about runtime-declared ones. This is apparently the case on macOS, and
  also on GNOME when the desktop file is seen by the desktop
  environment. So all our code about generating thumbnailed icon is
  wasted on these platform anyway.
- When intensively testing the current behavior, I had cases when the
  icon was not properly updated. We could of course investigate and fix
  the issues, but considering all the previous points, it might make
  more sense to simply drop the feature which is mostly useless, or
  worse bothersome, hence simplify the code greatly.
- Finally API to set icons from GdkPixbuf data has been removed in GTK4.
  So long term, trying to keep this whole machinery feels like just
  making our life difficult for a feature which all OSes seem to
  deprecate and which might not be possible anymore soon (or just get
  harder and harder to implement).

Note that I don't use gtk_window_set_default_icon_name() because it
would use the icon from our theme, yet so far we are not sure it makes
sense for the application icon which we probably always want to be the
same, whatever the chosen theme. Finally I just list various common icon
sizes because GTK API doesn't seem to be clever enough yet. I can't just
give it 1 SVG image (e.g. with gtk_window_set_default_icon_from_file())
and hope it does the resizing at the last minute. It turns out it
doesn't and we get an extra-small icon. So instead, let's generate
common sizes ourselves from the same SVG.
2021-07-06 11:21:37 +02:00
Jehan d3105e5c72 app: add a comment and some newlines before the debug data section.
The markdown triple-quote (```) has to be on its own at the start of a
newline. Schumaml was telling me that too many reporters would paste
just after some text, which would therefore break the markdown syntax.

Instead let's add 3 newlines before the triple-quote, so that even
people who would not hit the "Copy Bug Information" button (but instead
select and copy) have a hint that these newlines are made on purpose.
Also add a comment (which is discarded by Gitlab) to make this even more
obvious.

Then even when pasting just after some text on the same line, the
triple-quote will end up on its own line.
2021-07-05 16:44:54 +02:00
Jehan 086ae77929 app: new gimp_display_grab_focus() function.
The goal of this function is to give the focus to the active image
display. This is implemented as a core GimpDisplay virtual function
(with the actual implementation in GimpDisplayImpl), allowing to be used
even in core code, without actual GUI code (this was not necessary right
now, but I think it will be useful in future use).

This function is now called from the toolbox code (cf. 2 commits
earlier), avoiding code duplication. I also added a usage at the end of
toolbox_paste_received() so that a newly opened image by middle-click
paste in the toolbox directly gains focus.
2021-07-05 15:31:36 +02:00
Jehan 2d123b8290 app: fix wrong unref-ing.
Testing this middle-click opening of image by their PATH/URI in the
toolbox, I realized there was a bug. The original author was obviously
intending to unref the toolbox which was ref-ed when calling
gtk_clipboard_request_text(), not freeing the toolbox context, which
could have dire consequences!

Fixes this CRITICAL:

> g_object_unref: assertion 'G_IS_OBJECT (object)' failed
2021-07-05 13:01:47 +02:00
Jehan 3d9996f1a6 Issue #6869: Toolbox buttons should focus the canvas as side effect.
Toolbox buttons don't require focus keeping (no further keyboard input
needed and navigating through/selecting tools can be done in various
other ways with a keyboard), which is why I removed focusability of
toolbox buttons years ago (cf. commit c83ee61c07).

Nevertheless this is not enough, and since toolbox is meant to work on
the canvas anyway, let's give back canvas focus as soon as any click
happens on dead areas of the toolbox, as well as on the Wilber (dnd)
drawing, but also each time a toolbox button is selected (though not on
the longer clicks to see tool groups' contents without selecting a tool
in the end).
This will allow to directly start working on the image without requiring
a click first (for instance panning with Space or similar interactions
which would not give focus to the image canvas).

This can also count as an alternative to the "Esc" shortcut to get
canvas focus back, with a mouse click instead of a keyboard key.
2021-07-05 12:45:24 +02:00
Niels De Graef def862bae4 meson: Always enable CPU extensions
Don't enable conditionally based on the buildtype.

Further, don't use `add_project_arguments()` to enable the instructions:
this will lead to crashes within g-ir-scanner, which can't properly
parse these instructions.

https://gitlab.gnome.org/GNOME/gimp/-/issues/5053
2021-06-15 21:15:32 +00:00
Ian Martins 825067eab7 plug-ins: fix #6859 Hurl random pct limits in PDB are incorrect
(cherry picked from commit a038051bb8)
2021-05-24 18:45:48 +02:00
lloyd konneker 003f137dc0 6872 gimp-pdb-dump print type of GValue instead of type of GParamSpec 2021-05-24 15:26:30 +00:00
Pavel Artsishevsky 603c5dcb2c app: call parent's window_state_event() from GimpImageWindow
Fixes #6883
2021-05-24 11:34:41 +00:00
Stanislav Grinkov 203393a9fc core: function documentation clarification
Update api documentation of GimpObject and GimpThumbnail classes to
clarify who and when will take care of disposing passed strings.
2021-05-24 11:04:44 +00:00
Stanislav Grinkov f8320ce535
core: minor memleak fixes
Fix several memory leaks when uri obtained by g_file_get_uri ()
was not g_free'd ().
2021-05-23 20:57:44 +06:00
Jehan 0625902d71 app: set "OK" the default button to the "Create a New Image" dialog.
In Linux, I never paid attention to it because it was already working as
expected (i.e. Ctrl-n followed by Enter for instance would directly
create the image), but when testing GIMP on Windows for the installer,
these last few days, I realized that hitting Enter when focus was on the
dimension entries was doing nothing. Having to move the pointer to click
a button on Windows was frustrating. So let's make OK the official
"default response" directive for this dialog.
2021-05-20 20:45:28 +02:00
Jehan 668c9de5a5 app: add back a timeout-based idle function to queue a canvas redraw.
I'm still very unclear why exactly but it would seem that just queuing
the redraw with an idle function is not enough. At least on Windows,
Jacob was having cases where opening an image would get stuck unless the
mouse was moved (causing draw events most likely).

So let's use a timeout function instead. Probably no need to queue the
idle followed by the timeout function as we had before commit
4fee04b839. Instead just directly queue a draw if relevant, then run the
timeout at regular interval (marching ants speed).
2021-05-11 19:36:20 +02:00
Marc Espie 6dc98fe7f0 Issue #6850: support for memory in the dashboard under OpenBSD. 2021-05-09 19:57:49 +02:00
Jehan 6466d46052 app: check the time before last selection draw before queuing a redraw.
This way, we would queue a lot less canvas region unnecessary redraws.
We still remake the time-before-last-draw check in the draw() signal
handling before we want to update the marching ants index for draw
events coming for other reasons (canvas updates, moving/zooming on
canvas, exposition changes, etc.).
2021-05-09 15:51:20 +02:00
Jehan e8a531e51e app: fix selection display on right/bottom borders when rulers are…
… displayed.

We should use the dimensions from the GimpDisplayShell not the the
GimpCanvas. Indeed the canvas is shorter when rulers are visible, hence
the selection next to the extreme sides (bottom and right sides of the
canvas) was not drawn.
2021-05-09 15:37:22 +02:00
Jehan 4fee04b839 Issue #5640: Selection tools not showing selection on Wayland.
As suggested in a comment (itself coming from an IRC discussion), we
should not use gdk_window_(begin|end)_draw_frame() functions as this
works on X, but not on Wayland anymore. Instead draw directly during
draw() call of the shell widget, and force it to happen regularly, to
update the marching ants, via gtk_widget_queue_draw_region().

This is tested and works on Wayland. Please everyone, test thoroughly to
make sure it works well in all situations, and also that we don't get
any unexpected slowdowns.

Since the symptoms are very similar, it is highly possible that it also
fixes the issue #5952 too, for selection not showing on macOS since Big
Sur 11 (maybe they changed the same way as Wayland did). Unfortunately I
can't check this myself. Please test, whoever has access to a macOS Big
Sur and can build GIMP!
2021-05-09 02:47:47 +02:00
Jehan 6c1a0e8be7 app: gui_free_progress() should accept any GimpProcess widget.
Simply it should free only GimpProgressDialog as these would be
dedicated dialog (with no meaning once progression is done), and leave
alone other GimpProgress widgets. In any case, it should not output
CRITICAL errors on these.

Fixing the following CRITICAL:
> GIMP-CRITICAL: gui_free_progress: assertion 'GIMP_IS_PROGRESS_DIALOG (progress)' failed

When dropping an image on the toolbox.
2021-05-06 00:19:25 +02:00
Jehan 1566d9437e app: make sure we send the origin display to plug-ins through PDB. 2021-04-30 03:48:12 +02:00
Jehan 7eaa4f1ca9 app, libgimp, pdb: new gimp_display_present() PDB call. 2021-04-30 03:46:52 +02:00
Jehan 2211ca7fd3 app: wait child processes with g_child_watch_add_full() rather than…
… waitpid().

My use case was when testing gimp_brush_select_new(). When doing tests,
if I let the brush dialog opened while letting the plug-in exit cleanly
otherwise, it somehow locked the process (I have stared so long at the
code and still don't understand why).
gimp_plug_in_close() would wait for it forever and the only way out was
to kill GIMP completely. I guess we could try to run waitpid() with
WNOHANG (and finally force-kill the child if it really won't exit) but
it made the whole logics extra complicated.

The logics with g_child_watch_add_full() is that we don't stop waiting
for the child and just set a callback to finalize what needs to be. Now
the worst case scenario would be to leave zombie processes dangling
around, but it's better than freezing GIMP.

Finally as a weird side effect, doing this change even unblocked the
process with an unfinished brush selector so we don't even have a zombie
anymore (at least for this specific case). All good in the end!

Last side effect: it can speed up a tiny bit the plug-in close as we
don't wait for processes anymore, which could be more visible at first
startups (when we reload all the plug-ins). Though there is nothing
scientific to my numbers, after multiple "first startups", it seems it
went down from about 3.5 to 3.2 seconds on my specific machine. Nothing
extra fancy, but we take what we can (and speeding up the startup was
never the goal of this change anyway). It doesn't affect Windows which
has its own logics to handle process termination and I preferred not to
touch it.
2021-04-29 02:19:41 +02:00
Jehan 4ee3a9caa1 app: fix core crash when a plug-in calling a GimpPdbDialog crashes.
There are 2 parts for this fix:
- First expect the GimpPdbDialog to possibly disappear while
  gimp_pdb_dialog_run_callback() is running. This can indeed happen as
  this core dialog is tied to a PDB call. If the calling processus
  crashes (which may happen, and has to be expected for third-party
  plug-ins), then this dialog may just end up closing at anytime (signal
  "plug-in-closed" from the plug-in manager which implies a
  GTK_RESPONSE_CLOSE, hence dialog destruction).
  To account for this, we check the dialog availability with a weak
  pointer and returns the info to the caller as well.
- Don't connect to "value-changed" on the spacing adjustment because
  when a crash happened, I had cases when the adjustment was finalized
  while being set (crash in GTK code). This one is a bit harder to
  explain (I had to look long at backtraces) but having a proper signal
  "spacing-changed" on the GimpBrushFactoryView is actually much cleaner
  code than relying on a public object anyway and it fixes this crash.

Note: this fix is related to my previous commit. When running
gimp_brush_select_new() from Python code, the plug-in crashed when
trying to run the callback, which also resulted into core crash (and
this part is obviously not acceptable at all).
2021-04-28 02:47:24 +02:00
Ian Martins c97cf30e6e pdb: add a PDB compat procedure for median-blur
(cherry picked from commit eb9eec4acb)

Reviewer note: with re-generated C files for the updated PDB in the main
branch.
2021-04-25 15:56:41 +02:00
Jehan c8020c20a5 app: don't print a NULL insensitive action reason.
Print an empty string itself, otherwise it actually displays "(null)".
And anyway it's not clean code to use a NULL pointer in a printf format.
2021-04-24 23:26:33 +02:00
Jehan ef2402bf8e app, libgimp, pdb, plug-ins: allow pasting multiple full layers.
When a selection exists, we are copying then pasting the selection
contents. In particular, with multi-layer selection, it means pasting a
merged result of the selected layers (like a sample merged but limited
to selected layers).

Yet when no selection exists, with a single layer selected, a cut in
particular would remove the layer fully, then a paste would copy it
elsewhere (in the same image or even on a different image). This was
still working, but not with multiple layers. This is now fixed and we
can now copy/cut then paste several layers (without merge), which is
sometimes a very practical way to move layers (sometimes simpler than
drag'n drop, especially between images).

As a consequence, the PDB function gimp_edit_paste() now also returns an
array of layers (not a single layer).
2021-04-24 23:22:58 +02:00
Jehan 11e1f6ea5e app: fix out-of-gamut representation (pink triangle).
The small pink triangles were completely broken, i.e. displayed at the
wrong coordinates.
2021-04-24 19:32:13 +02:00
bootchk c6fde64815 GIMP-CRITICAL: gimp_marshal_VOID__OBJECT_STRING_STRING: assertion 'n_param_values == 4' failed 2021-04-24 15:00:42 +02:00
Jehan d6dac25579 Issue #5008: Always true condition (i>=0) inside fill_inverse_cmap_gray.
Removing useless condition, add a g_return_if_fail() assertion for the
only (impossible unless bug) case which we don't expect. Also set
default mindist to G_MAXLONG instead of a magic number (which was ok now
but might become a problem if some day colormap allowed more than 16-bit
per channel colors).
Finally break when we reach a distance of 0 since we won't get lower
anyway, so better stop early.

Thanks to Rafał Mikrut and Øyvind Kolås for code commenting.
2021-04-24 14:48:22 +02:00
Jehan c0e605ef96 app: fix an assertion when converting grayscale images to indexed.
We cannot just compare the drawable format with the model-type specs of
the color model. We need to include the space now.
In my case, some random screenshot converted to gray then indexed would
assert because the format is "Y' u8-space-gray-sRGB" (or for layers with
alpha: "Y'A u8-space-gray-sRGB"), hence indexed conversion failed and
ended up dark.
2021-04-24 14:12:57 +02:00
Jehan 13a02aea23 app: append insensitive reason to GimpAction proxy tooltip.
With my previous commit, I improved the search action display and search
algorithm (which was returning wrong results), but we had lost showing
the non-sensitive reason in menu item tooltips. This fixes it, by
actually appending the reason, but only in the end, on the GtkWidget
tooltip (not in the action's tooltip itself).
2021-04-23 19:48:37 +02:00
Jehan 811d356953 app: GimpAction now has a "reason" parameter to explain being disabled.
In some cases, in particular for actions generated from plug-in
procedure right now, we were displaying the reason of the insensitivity
(typically right now, only the drawable type is cited). This was done by
appending the reason to the tooltip, separated by 2 newlines, which
resulted in extra ugly design, no nice way to style this info directly
(with pango for instance if the widget display allows it, or on a
separate info widget in a possible future, or whatnot).

Also it would mean that the action search could match a disabled action
by mistake if a search word happens to be in the reason message.

This improves the situation with the following changes:
* gimp_action_set_sensitive() now takes an optional reason string to set
  the reason message.
* Same for gimp_action_group_set_action_sensitive().
* gimp_action_get_sensitive() returns an optional reason string.
* gimp_procedure_get_sensitive()'s tooltip return value now becomes a
  reason (it won't contain anymore the tooltip and the reason
  concatenated, only the reason for separate processing).
2021-04-23 19:43:30 +02:00
Povilas Kanapickas a8b258cd84 app: Implement canvas support for touchpad gesture zoom by pinch 2021-04-22 17:45:32 +00:00
lloyd konneker 34c1dbde13 Fix #6676 brush select crash, pass GimpArray->data instead of GimpArray*
Same issue for brush, pattern, gradient
2021-04-21 15:38:23 +00:00
Jehan 68dcb4b421 app: fix sending signals to finalized object.
Fixing:

> GLib-GObject-WARNING **: 01:43:13.747: instance with invalid (NULL) class pointer
> GLib-GObject-CRITICAL **: 14:15:37.327: g_signal_emit_valist: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

When changing brushes through tool options. Thanks to ankh for noticing
this.
2021-04-21 14:19:05 +02:00
Jehan 3f9184f576 app, pdb: plug-in-autocrop-layer() multi-layer aware.
This PDB procedure will now crop all selected layers relatively to the
input drawable.
2021-04-21 00:13:24 +02:00
Jehan 60b9c5633e app, libgimp: validate procedure arguments taking class heritage into…
… account.
2021-04-21 00:00:32 +02:00
Jehan 0b750eca6f app: print to standard error output when procedure uses deprecated…
… single drawable run() function.
All Scheme scripts use a single drawable and I am not so sure where to
change this (or rather I hope someone will handle this rather than I).
So let's not output a warning which would result into a stacktrace,
blocking the GUI for a second or 2 and displaying an annoying popup each
time. Let's just output to stderr for now until we get into a better
state.
2021-04-20 17:43:53 +02:00
Sebastien e8b23d6e4b typo in pdb/groups/plug_in_compat.pdb 2021-04-19 14:44:00 +00:00
Michael Schumacher 530dc883ca app, libgimp*: glib-genmarshal warns about --header --body
Using --header --body is mentioned as being deprecated, the way to get the desired result said to be
--prototypes --body now.
2021-04-17 22:50:49 +02:00
Jacob Boerema 4aaad4f749 app: fix 3d transform tool not added to gimphelp-ids.h 2021-04-09 18:01:04 -04:00