You shouldn't rely on GObjects being `const`, since a reference count
operation does not respect that. That being said, this fixes a warning,
for a keyword that seems to be redundant here.
gegl:focus-blur blurs the image around a focal point. It can be
used to create fake depth-of-field effects.
Add a prop-gui constructor which uses a FOCUS controller to control
the focus geometry.
Add a new GimpToolFocus tool widget, which defines a focus region,
consisting of an inner limit, an outer limit, and a transition
midpoint between them. The widget allows controlling the limits
and the midpoint, and moving, scaling, and rotating the region.
Add a new GimpCanvasLimit canvas item, which draws an area limit
for different shapes. It will be used by the following commits to
implement GimpToolFocus.
In GimpDrawTool, update the tool widget on GIMP_TOOL_ACTION_RESUME,
so that it can respond to changes in the display-shell scale/
offset. We'd previously done that for individual tools/widgets,
but let's just do it in one place.
This commit makes sure we can properly run the tests in a headless
environment, i.e. they don't mess with the user's X display or their
session bus. The latter is also needed for parallel tests as they fail
to simultaneously own the same name on the session bus.
Replaced the "xvfb-run" meson option with the "headless" option, which
is more intuitive (and also more correct, since we now also require
`dbus-run-session` to run the tests, not only `xvfb-run`).
Finally, note that we need a version of `xvfb-run` that supports the
`-d` (`--auto-display`) option. The problem with `--auto-servernum`
which is also regularly used, is that it doesn't shut down cleanly,
returning a non-zero exit code, wich makes the test fail.
Fixes https://gitlab.gnome.org/GNOME/gimp/-/issues/5078
From commit 529aa743:
> `g_object_notify()` actually takes a global lock to look up the
> property by its name, which means there is a performance hit (albeit
> tiny) every time this function is called. For this reason, always try
> to use `g_object_notify_by_pspec()` instead.
While just _loading_ GIMP on my machine (ie during the splash screen)
`g_object_notify (curve, );` got called more than 6000 times already, so
it's not an unused path.
Note that it's also less easy to make an accidental typo when using
`g_object_notify_by_pspec()`, as the compiler will complain about the
enum value being incorrect.
There is no non-hackish way of fixing this without adding a new
"use-opacity-paint-mode" property to GimpToolPreset and a new toggle
in GimpToolPresetEditor. Restoring opacity and paint mode can now be
controlled explicitly, and defaults to TRUE.
`GET_PRIVATE()` expands to `gimp_viewable_get_instance_private()`, which
just returns an offset of the passed on pointer. As such, it's safe to
call this on any value (even NULL) and to put it at the top of the
function block, saving some lines.
From commit 529aa743:
> `g_object_notify()` actually takes a global lock to look up the
> property by its name, which means there is a performance hit (albeit
> tiny) every time this function is called. For this reason, always try
> to use `g_object_notify_by_pspec()` instead.
While just _loading_ GIMP on my machine (ie during the splash screen)
`g_object_notify (viewable, "icon-name");` got called more than 4000
times already, so it's not an unused path.
Note that it's also less easy to make an accidental typo when using
`g_object_notify_by_pspec()`, as the compiler will complain about the
enum value being incorrect.
Meson has a very useful tool for combining a set of linked libraries and
compiler arguments (like an internal pkg-config):
`declare_dependency()`. Use this command to ensure that we can easily
reuse libapp* over multiple libraries, executables and tests.
That way, if we also add a new dependency later on in one of the libapp
libraries, this won't need to be added multiple times.
The tests weren't building because they weren't linked to the static
libraries.
Note that some tests still need fixing, but at least they can be
built/run now.
If we don't do this, the clipboard owner doesn't get unreffed (also the
GtkClipboardClearFunc is not called either, but we don't set any so this
was not a big problem).
The main consequence was that copying was setting the Gimp object as an
owner, which kept a reference and prevent its finalize() method to run,
hence was leaking data (and in particular some GEGL buffers for
clipboard operations, which was how the issue became more visible upon
exit).
Properly initialize GimpSelectionTool::saved_operation upon
modifer-key press, even when some modifiers are masked out by
GimpPolygonSelectTool while the tool is active. This avoids
erroneously "restoring" the operation to a previously-saved state
once the modifier keys are released.
The GIR parser is giving warnings because both e.g. a signal, a
corresponding vfunc and a method emitting it are named
"channel_changed", which can and will give issues in some bindings.
The easiest option is to follow the general convention of starting the
signal emitters with `emit_`, which also makes clear the intention of
the method.
By only doing the snapping to white/black for whitest/blackest palette
entries when the original RGB data contained these colors we permit
choosing near white/black colors in the cases where this might be
a desirable result as the whitest/blackest colors.
The median-cut algorithm to derive a suitable palette for the image
computes each index to be used as the average of colors in a 3d box
in a color space, making the result value drift away from the extremes.
This makes it nigh impossible to achieve pure white or black, even
when the original image contained these colors, like in scans of
printed documents and technical drawings.
We counteract the drift by snapping the whitest color to white and the
blackest color to black if the resulting colors of median-cut are
already sufficiently close to white or black.
layers_opacity_cmd_callback(): get the select_type from
the GVariant instead of using the GVariant as an enum
directly (missed when porting, spotted by Massimo).
Fix the same bug in channels_select_cmd_callback()
and layers_mode_cmd_callback().
... which copies a TransInfo array to the current info array,
possibly with modifications. While the default implementation
simply copies the array as-is, the following commit will override
the function for the Unified Transform tool, to avoid copying the
pivot position when the pivot is locked.
Use the function in GimpTransformGridTool, instead of copying the
array directly, as necessary.
In GimpTransformGridTool, keep the transform-direction chain-button
insensitive while the tool is not active, and always unlink the
button when halting the tool. This avoids the directions from
accidentally being kept linked, resulting in the tool seemingly
having no effect.
On 64-bit, all seems fine, but when building to 32-bit (at least Windows
32-bit), G_GUINT64_FORMAT is defined to "%llu" while time_t is a long
int. So it doesn't match and the compiler complains:
> warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'time_t' {aka 'long int'}
Let's cast to (guint64) to make sure the type always match.