Commit Graph

41479 Commits

Author SHA1 Message Date
Ell fdf330857b app: use gimp_wait() to wait for histogram in threshold and levels tools
In the threshold and levels tools, use gimp_wait() to wait for
histogram calculation to complete before applying auto-adjustment,
so that a message is displayed in the meantime.  Allow the
operation to be canceled, in which case we simply abort the auto-
adjustment, but let the histogram calculation continue.
2018-05-29 16:04:28 -04:00
Ell f2134180de app, pdb: wait for fonts to load before dependent operations
Use gimp_fonts_wait(), added in the previous commit, to wait for
fonts to finish loading before operations that depend on font
availability.  In particular, this includes font- and text-related
PDB functions, and text-layer rendering.
2018-05-29 16:04:28 -04:00
Ell 0a5a4fed03 app: add gimp_fonts_wait()
... which waits for font-loading to complete, using gimp_wait() to
show a message while waiting.

Note that we don't currently allow the wait to be canceled, since
it may have unpredictable effects on plug-ins, but the interface is
such that the wait might not complete, so calling code should be
prepared for that.
2018-05-29 16:04:28 -04:00
Ell cec17de3c2 app: add gimp_wait()
Add a GimpGui::wait() virtual function, and a corresponding
gimp_wait() function.  The function takes an object implementing
the GimpWaitable interface, and a printf-style message, and waits
for the object to become ready, displaying the message as
indication in the meantime.  The default implementation simply
prints the message to STDERR.

Implement the function in gui-vtable, using the busy-dialog plug-
in added in the previous commit, to display the message in a
dialog.  Additionally, if the object implements the GimpCancelable
interface, provide a "cancel" button in the dialog, which, when
pressed, causes gimp_cancelable_cancel() to be called on the
object.  Note that the function keeps waiting on the object even
after requesting cancelation; GimpTriviallyCancelableWaitable can
be used to stop the wait once cancelation has been requested.
2018-05-29 16:04:28 -04:00
Ell 032e95fad6 plug-ins: add busy-dialog plug-in
This plug-in is used internally to show an interactive dialog in a
separate process, while the main process is blocking waiting for an
operation to complete.  The dialog shows a custom message in a
GimpBusyBox, and potentially a "cancel" button, allowing the
operation to be canceled.  Communication with the main process is
performed through a pair of file descriptors, passed to the plug-in
as arguments.
2018-05-29 16:04:28 -04:00
Ell 97925de8eb libgimpbase, libgimp, app: pass icon theme dir to plug-ins through config
Pass the current icon theme directory to plug-ins through the
config message, and add a gimp_icon_theme_dir() libgimp function
for retrieving it.  Note that we already have a similar
gimp_icon_get_theme_dir() PDB function, which we keep around, since
it can be used to dynamically query for the current icon dir,
unlike the former, and since it returns a dynamically-allocated
string, while the rest of the config-related functions return
statically allocated strings.

Use the new function, instead of gimp_get_icon_theme_dir(), in
gimp_ui_init().  This allows gimp_ui_init() to run without making
any PDB calls.  Consequently, this allows us to start plug-ins that
call gimp_ui_init() without entering the main loop in the main app.
We're going to add a plug-in that displays an interactive dialog
while the main app is blocking waiting for an operation to
complete, and we need to be able to start the plug-in without
entering the main loop, to avoid the possibility of arbitrary code
being executed during the wait.

Bump the protocol version.
2018-05-29 16:04:28 -04:00
Ell dd096d3ce5 app: show indication during font loading in text tool and font views
While fonts are loading, show a GimpBusyBox with an appropriate
message above the text tool options, and make the options
themselves insensitive, and in font views, such as in the fonts
dialog (through gimp_container_editor_bind_to_async_set(), added in
the previous commit).
2018-05-29 16:04:28 -04:00
Ell 03983f9547 app: add gimp_container_editor_bind_to_async_set()
... which takes a GimpAsyncSet and a message, and shows a
GimpBusyBox with that message, instead of the container view, while
the async set is nonempty.

We're going to use this for font-loading indication in font views,
such as in the fonts dialog.
2018-05-29 16:04:28 -04:00
Ell 000fd8e69b libgimpwidgets: add GimpBusyBox
GimpBusyBox is used to show a message indicating an operation is in
progress.  It's basically just a spinner and a label, with some
styling.

We're going to use it both in app/ and in a plug-in.
2018-05-29 16:04:28 -04:00
Ell d5bc5cad45 app: disallow editing text layers while fonts are loading
We already avoid rendering text layers while fonts are loading,
showing an appropriate message, but this will soon be replaced with
waiting for the fonts to finish loading.

Instead, don't allow the text tool to start at all while the fonts
are loading (showing an appropriate tool message, and a BAD cursor
modifier), and halt the tool when reloading fonts if it's already
started.
2018-05-29 16:04:28 -04:00
Ell 1ac2b928d0 app: use GimpAsyncSet for keeping track of font loading
Replace the boolean fonts_loading member of Gimp with
fonts_async_set, which is a GimpAsyncSet object.  This allows us
to easily respond to the completion of font loading and reloading,
as will be done in the next commits.

Additionally, move the call to FcConfigSetCurrent(), used to
activate the loaded font configuration, from the async thread to
the main thread, just to be on the safe side, and avoid calling
FcInitReinitialize() in gimp_fonts_reset() if font loading is still
in progress, which is unsafe.
2018-05-29 16:04:28 -04:00
Ell 56bbd07a89 app: fix indentation in core-types.h 2018-05-29 16:04:28 -04:00
Ell 80de723022 app: add GimpAsyncSet
GimpAsyncSet represents a dynamic set of running GimpAsync objects.
The objects are automatically removed from the set once they're
synced.

GimpAsyncSet implements the GimpWaitable and GimpCancelable
interfaces, allowing the entire set to be waited-on or canceled.

Additionally, GimpAsyncSet provides an "empty" property, which
indicates whether the set is empty or not.  This allows responding
to the completion of all the GimpAsync objects through the set's
"notify::empty" signal, or drive UI changes through property
bindings.
2018-05-29 16:04:28 -04:00
Ell e24ce8861d app: add GimpTriviallyCancelableWaitable
GimpTriviallyCancelableWaitable is a proxy object for another
GimpWaitable object, implementing both the GimpWaitable interface
and the GimpCancelable interface.  While waiting on the proxy
simply waits on the underlying waitable, canceling the proxy
doesn't affect the underlying waitable, even if it implements
the GimpCancelable interface as well, but rather causes subsequent
wait operations on the proxy to successfully complete immediately.

This essentially causes cancelation to abort only the wait, rather
than the underlying operation.
2018-05-29 16:04:28 -04:00
Ell 4cc92ebd74 app: add GimpUncancelableWaitable
GimpUncancelableWaitable is a simple proxy object for another
GimpWaitable object, implementing only the GimpWaitable interface.
Its main purpose is to mask away the cancelability of an object
implementing both GimpWaitable and GimpCancelable.
2018-05-29 16:04:28 -04:00
Ell 46a80811a8 app: implement GimpWaitable::try_wait() in GimpAsync 2018-05-29 16:04:28 -04:00
Ell e0c47673e0 app: add GimpWaitable::try_wait() vfunc
... which should never block, but rather return TRUE or FALSE
immediately, depending on whether or not the waitable is ready.
2018-05-29 16:04:28 -04:00
Ell e085fc5fee app: lower thread priority of independent async operations
In gimp_parallel_run_async(), lower the priority of threads
executing independent async operations.  Independent operations
are generally potentially long-standing background tasks, which we
don't want to bog down the rest of the program.

This is currently only implemented on Linux and Windows.
2018-05-29 16:04:28 -04:00
Michael Natterer e332ba008b app: fix setting dock window size from GimpSessionInfo
In gimp_session_info_apply_geometry(), use gtk_window_resize() instead
of gtk_window_set_default_size() which magically fixes things. Leave a
big comment there because set_default_size() should just work.
2018-05-29 21:11:26 +02:00
Michael Natterer 0ecf0818a5 app: don't set a permanent size request on the canvas
Reset the canvas size request from gimp_display_shell_constructed() in
gimp_display_shell_canvas_size_allocate() so the image window can be
made smaller again. GTK+ 3.x always respects size requests.
2018-05-29 21:09:44 +02:00
Michael Natterer ce02f4ad05 m4macros: forgot 2.0 -> 3.0 here 2018-05-29 10:14:58 +02:00
Michael Natterer e237d431de app: fix some stuff in tests, down to 3 failing
- set GIMP3_DIRECTORY env variable not GIMP2_DIRECTORY
- make sure the cursors resource gets compiled in
- remove tab autosizing test, that code is gone
2018-05-29 00:44:51 +02:00
Michael Natterer a0805e460a Issue #1521 - First time start: GIMP-Error: Error while parsing templaterc
Don't use deprecated "fill-type" value names in the defailt templaterc.
2018-05-29 00:04:31 +02:00
Michael Natterer 2f425f0e2a libgimpwidgets: allow NULL adjustments in gimp_scroll_adjustment_values() 2018-05-29 00:04:31 +02:00
Marco Ciampa 073219e615 Updated Italian translation 2018-05-28 23:53:58 +02:00
Jehan cba95fb8a5 themes: prefer symbolic icons when available.
This is a first step to make our 2 symbolic themes into one and properly
"announce" them as symbolic through icon naming (which will allow
recoloring according to style colors).
With this CSS style, GTK+ widgets will search for symbolic icon variants
when using the generic name (with "*-symbolic" suffix).
2018-05-28 21:09:08 +02:00
Anders Jonsson cafbec9b83 Update Swedish translation
(cherry picked from commit a0dde2d40f)
2018-05-28 18:55:59 +00:00
Michael Natterer 4e472986c2 app: force gimp-tool-cursors.c to be linked into the binary 2018-05-28 20:20:13 +02:00
Michael Natterer ab9aa50925 cursors: oops, I optimized generation of resource files away 2018-05-28 20:09:09 +02:00
Jehan 27badebb23 gitlab: Adding issue templates.
We realize that gitlab doesn't encourage people to give base information
as software version or operating system.
Issue templates are not perfect but better than nothing.
2018-05-28 19:19:00 +02:00
Michael Natterer 9f800b05b4 plug-ins: hopefully make it build after my GdkScreen/GdkMonitor b0rk 2018-05-28 18:40:38 +02:00
Michael Natterer a9592a59c8 Merge request 4 - Generated .c sources are used as headers...
...Generate .h files instead.

Generate proper .c and .h files for color-picker and tool cursors in
the directories where they are built, and stop including them in other
.c files.
2018-05-28 17:25:18 +02:00
Michael Natterer 7fab74f431 libgimpwidgets: use G_DEFINE_ABSTRACT_CLASS for preview classes 2018-05-28 17:24:58 +02:00
Michael Natterer 3773ccbe1f docs: update .gitignore 2018-05-28 12:49:47 +02:00
Michael Natterer 061f4e4019 tools, app-tools: update .gitignore 2018-05-28 12:41:48 +02:00
Michael Natterer 1b71bd38ae desktop: update .gitignore 2018-05-28 12:34:30 +02:00
Michael Natterer 09e91b61fa plug-ins: gfig was still connecting to an "expose-event" signal 2018-05-28 09:01:54 +02:00
Michael Natterer 2ae830290e app: fix synthesizing pointer events in test-tools.c
Makes tests fail later.
2018-05-28 08:59:37 +02:00
Jehan d4ff504735 app: fix broken debug output on gitlab.
The GIMP version string and the backtrace both look completely wrong
when pasted as-is on gitlab. Somehow all linefeed are gone.

This can be fixed by surrounding these as blocks (triple backticks),
using markdown syntax. Of course now the debug content is not for our
tracker only since packagers are encouraged to replace with their own
tracker URL, but this small markdown syntax is simple enough that it
should not break formatting on other platforms (as far as I know).
2018-05-28 06:26:46 +02:00
Jehan 2795512822 build: remove dev flatpak and replace nightly with gtk3 manifest.
Now gtk3-port old branch has become master!
Also we don't need a dev flatpak for now. We'll see later when we will
do new development releases.
2018-05-27 22:24:37 +02:00
Jehan fc8d815ab8 build: update the flatpak howto. 2018-05-27 22:20:09 +02:00
Michael Natterer dbf059fd70 plug-ins: undeprecate print-preview.c 2018-05-27 21:07:12 +02:00
Michael Natterer 1b18f73d32 menus: forgot to remove automatic tab style 2018-05-27 21:05:31 +02:00
Ell 3fa4c01bcf app: fix gimp_parallel_run_async() cancelation
In gimp_parallel_run_async(), when aborting a GimpAsync operation
in reponse to its "cancel" signal, properly clean up internal data
attached to the object, to avoid use-after-free if the signal is
emitted again.
2018-05-27 13:58:59 -04:00
Ell ad8add6808 app: add "independent" parameter to gimp_parallel_run_async()
Add a boolean "independent" parameter to gimp_parallel_run_async().
When FALSE, the passed function is run in the shared async thread
pool; when TRUE, the passed function is run in an independent
thread.

Generally, async operations should run in the async pool, however,
it might be desirable to run long-standing operations, especially
ones that can't be canceled, in independent threads.  This avoids
stalling quicker operations, and shutdown.

Adapt the rest of the code for the change.  In particular,
initialize the font cache in an independent thread.
2018-05-27 13:17:24 -04:00
Ell 3958ffbe50 app: abort canceled pending operations in gimp_parallel_run_async()
In gimp_parallel_run_async(), connect to the returned GimpAsync's
"cancel" signal, and abort the operation in response if it's still
enqueued, i.e., if its execution hasn't started yet.
2018-05-27 13:17:24 -04:00
Ell e2c56ef407 app: implement GimpWaitable and GimpCancelable in GimpAsync
Have GimpAsync implement the GimpWaitable and GimpCancelable
interfaces, added in the previous two commits, instead of providing
its own public version of the corresponding functions.

Add gimp_async_cancel_and_wait() as a convenience function for both
canceling an async operation, and waiting for it to complete.

Adapt the rest of the code to the change.
2018-05-27 13:17:24 -04:00
Ell 722f92d011 app: add GimpCancelable interface
... which provides a method for canceling an operation managed by
an object.
2018-05-27 13:17:24 -04:00
Ell 0fe066890e app: add GimpWaitable interface
... which provides methods for waiting on an object.
2018-05-27 13:17:24 -04:00
Jehan f3de5cd3fe tools: make gimptool memory-managed.
The code was basically leaking memory everywhere, and apparently on
purpose (according to a top comment). Even on short-lived process, not
properly managing memory is not a good habit, especially if we plan to
maintain a program for the long run.
So here are some fixes. I'm sure I must have missed some places (code
was a mess), and hopefully I broke nothing. But that's good for now. At
least it is somewhat sane code now.
2018-05-27 17:53:26 +02:00