2006-12-09 21:33:38 +00:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2004-07-12 11:41:19 +00:00
|
|
|
* Copyright (C) 1995-2002 Spencer Kimball, Peter Mattis, and others
|
|
|
|
*
|
2009-01-17 22:28:01 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2004-07-12 11:41:19 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 22:28:01 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2004-07-12 11:41:19 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-11 23:27:07 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2004-07-12 11:41:19 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2013-10-15 01:58:39 +02:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
2008-10-09 20:24:04 +00:00
|
|
|
#include <gegl.h>
|
2004-07-12 11:41:19 +00:00
|
|
|
|
2006-02-07 12:47:50 +00:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2006-02-07 11:07:47 +00:00
|
|
|
|
2004-07-12 11:41:19 +00:00
|
|
|
#include "core-types.h"
|
|
|
|
|
|
|
|
#include "gimp.h"
|
|
|
|
#include "gimp-gui.h"
|
|
|
|
#include "gimpcontainer.h"
|
|
|
|
#include "gimpcontext.h"
|
2019-09-04 14:27:18 +02:00
|
|
|
#include "gimpdisplay.h"
|
2004-07-12 11:41:19 +00:00
|
|
|
#include "gimpimage.h"
|
2004-08-10 18:47:21 +00:00
|
|
|
#include "gimpprogress.h"
|
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 11:59:51 -04:00
|
|
|
#include "gimpwaitable.h"
|
2004-07-12 11:41:19 +00:00
|
|
|
|
2006-02-07 11:07:47 +00:00
|
|
|
#include "about.h"
|
2004-12-24 19:11:30 +00:00
|
|
|
|
2004-07-12 11:41:19 +00:00
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_gui_init (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
2014-07-10 22:52:29 +02:00
|
|
|
gimp->gui.ungrab = NULL;
|
|
|
|
gimp->gui.set_busy = NULL;
|
|
|
|
gimp->gui.unset_busy = NULL;
|
|
|
|
gimp->gui.show_message = NULL;
|
|
|
|
gimp->gui.help = NULL;
|
|
|
|
gimp->gui.get_program_class = NULL;
|
|
|
|
gimp->gui.get_display_name = NULL;
|
|
|
|
gimp->gui.get_user_time = NULL;
|
|
|
|
gimp->gui.get_theme_dir = NULL;
|
2015-12-08 14:52:12 -05:00
|
|
|
gimp->gui.get_icon_theme_dir = NULL;
|
2014-07-10 22:52:29 +02:00
|
|
|
gimp->gui.display_get_window_id = NULL;
|
|
|
|
gimp->gui.display_create = NULL;
|
|
|
|
gimp->gui.display_delete = NULL;
|
|
|
|
gimp->gui.displays_reconnect = NULL;
|
|
|
|
gimp->gui.progress_new = NULL;
|
|
|
|
gimp->gui.progress_free = NULL;
|
|
|
|
gimp->gui.pdb_dialog_set = NULL;
|
|
|
|
gimp->gui.pdb_dialog_close = NULL;
|
|
|
|
gimp->gui.recent_list_add_file = NULL;
|
|
|
|
gimp->gui.recent_list_load = NULL;
|
2014-07-22 20:29:52 +02:00
|
|
|
gimp->gui.get_mount_operation = NULL;
|
2015-08-23 10:51:31 +02:00
|
|
|
gimp->gui.query_profile_policy = NULL;
|
app, libgimp, plug-ins: move Orientation metadata handling into core.
Orientation is now handled by core code, just next to profile conversion
handling.
One of the first consequence is that we don't need to have a non-GUI
version gimp_image_metadata_load_finish_batch() in libgimp, next to a
GUI version of the gimp_image_metadata_load_finish() function in
libgimpui. This makes for simpler API.
Also a plug-in which wishes to get access to the rotation dialog
provided by GIMP without loading ligimpui/GTK+ (for whatever reason)
will still have the feature.
The main advantage is that the "Don't ask me again" feature is now
handled by a settings in `Preferences > Image Import & Export` as the
"Metadata rotation policy". Until now it was saved as a global parasite,
which made it virtually non-editable once you checked it once (no easy
way to edit parasites except by scripts). So say you refused the
rotation once while checking "Don't ask again", and GIMP will forever
discard the rotation metadata without giving you a sane way to change
your mind. Of course, I could have passed the settings to plug-ins
through the PDB, but I find it a lot better to simply handle such
settings core-side.
The dialog code is basically the same as an app/dialogs/ as it was in
libgimp, with the minor improvement that it now takes the scale ratio
into account (basically the maximum thumbnail size will be bigger on
higher density displays).
Only downside of the move to the core is that this rotation dialog is
raised only when you open an image from the core, not as a PDB call. So
a plug-in which makes say a "file-jpeg-load" PDB call, even in
INTERACTIVE run mode, won't have rotation processed. Note that this was
already the same for embedded color profile conversion. This can be
wanted or not. Anyway some additional libgimp calls might be of interest
to explicitly call the core dialogs.
2020-09-23 19:59:09 +02:00
|
|
|
gimp->gui.query_rotation_policy = NULL;
|
2004-07-12 11:41:19 +00:00
|
|
|
}
|
|
|
|
|
2006-09-09 16:36:15 +00:00
|
|
|
void
|
|
|
|
gimp_gui_ungrab (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
if (gimp->gui.ungrab)
|
|
|
|
gimp->gui.ungrab (gimp);
|
|
|
|
}
|
|
|
|
|
2004-07-12 11:41:19 +00:00
|
|
|
void
|
|
|
|
gimp_set_busy (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
/* FIXME: gimp_busy HACK */
|
|
|
|
gimp->busy++;
|
|
|
|
|
|
|
|
if (gimp->busy == 1)
|
|
|
|
{
|
|
|
|
if (gimp->gui.set_busy)
|
|
|
|
gimp->gui.set_busy (gimp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_idle_unset_busy (gpointer data)
|
|
|
|
{
|
|
|
|
Gimp *gimp = data;
|
|
|
|
|
|
|
|
gimp_unset_busy (gimp);
|
|
|
|
|
|
|
|
gimp->busy_idle_id = 0;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_set_busy_until_idle (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
if (! gimp->busy_idle_id)
|
|
|
|
{
|
|
|
|
gimp_set_busy (gimp);
|
|
|
|
|
|
|
|
gimp->busy_idle_id = g_idle_add_full (G_PRIORITY_HIGH,
|
2006-04-12 12:49:29 +00:00
|
|
|
gimp_idle_unset_busy, gimp,
|
|
|
|
NULL);
|
2004-07-12 11:41:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_unset_busy (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (gimp->busy > 0);
|
|
|
|
|
|
|
|
/* FIXME: gimp_busy HACK */
|
|
|
|
gimp->busy--;
|
|
|
|
|
|
|
|
if (gimp->busy == 0)
|
|
|
|
{
|
|
|
|
if (gimp->gui.unset_busy)
|
|
|
|
gimp->gui.unset_busy (gimp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-10-09 08:17:22 +00:00
|
|
|
gimp_show_message (Gimp *gimp,
|
|
|
|
GObject *handler,
|
|
|
|
GimpMessageSeverity severity,
|
|
|
|
const gchar *domain,
|
2018-02-12 01:59:08 +01:00
|
|
|
const gchar *message)
|
2004-07-12 11:41:19 +00:00
|
|
|
{
|
2018-02-12 01:59:08 +01:00
|
|
|
const gchar *desc = (severity == GIMP_MESSAGE_ERROR) ? "Error" : "Message";
|
2006-10-09 08:17:22 +00:00
|
|
|
|
2004-07-12 11:41:19 +00:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2006-10-09 08:17:22 +00:00
|
|
|
g_return_if_fail (handler == NULL || G_IS_OBJECT (handler));
|
2006-07-19 06:50:34 +00:00
|
|
|
g_return_if_fail (message != NULL);
|
2004-07-12 11:41:19 +00:00
|
|
|
|
2004-08-25 17:58:52 +00:00
|
|
|
if (! domain)
|
2006-02-07 11:07:47 +00:00
|
|
|
domain = GIMP_ACRONYM;
|
2004-07-12 11:41:19 +00:00
|
|
|
|
2006-10-09 08:17:22 +00:00
|
|
|
if (! gimp->console_messages)
|
2006-07-19 06:50:34 +00:00
|
|
|
{
|
2006-10-09 08:17:22 +00:00
|
|
|
if (gimp->gui.show_message)
|
|
|
|
{
|
2018-01-23 03:38:46 +01:00
|
|
|
gimp->gui.show_message (gimp, handler, severity,
|
2018-02-12 01:59:08 +01:00
|
|
|
domain, message);
|
2006-10-09 08:17:22 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (GIMP_IS_PROGRESS (handler) &&
|
|
|
|
gimp_progress_message (GIMP_PROGRESS (handler), gimp,
|
|
|
|
severity, domain, message))
|
|
|
|
{
|
|
|
|
/* message has been handled by GimpProgress */
|
|
|
|
return;
|
|
|
|
}
|
2006-07-19 06:50:34 +00:00
|
|
|
}
|
2006-10-09 08:17:22 +00:00
|
|
|
|
|
|
|
gimp_enum_get_value (GIMP_TYPE_MESSAGE_SEVERITY, severity,
|
|
|
|
NULL, NULL, &desc, NULL);
|
|
|
|
g_printerr ("%s-%s: %s\n\n", domain, desc, message);
|
2004-07-12 11:41:19 +00:00
|
|
|
}
|
|
|
|
|
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 11:59:51 -04:00
|
|
|
void
|
2018-05-30 02:20:37 -04:00
|
|
|
gimp_wait (Gimp *gimp,
|
|
|
|
GimpWaitable *waitable,
|
|
|
|
const gchar *format,
|
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 11:59:51 -04:00
|
|
|
...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
gchar *message;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (GIMP_IS_WAITABLE (waitable));
|
|
|
|
g_return_if_fail (format != NULL);
|
|
|
|
|
|
|
|
if (gimp_waitable_wait_for (waitable, 0.5 * G_TIME_SPAN_SECOND))
|
|
|
|
return;
|
|
|
|
|
|
|
|
va_start (args, format);
|
|
|
|
|
|
|
|
message = g_strdup_vprintf (format, args);
|
|
|
|
|
|
|
|
va_end (args);
|
|
|
|
|
|
|
|
if (! gimp->console_messages &&
|
|
|
|
gimp->gui.wait &&
|
|
|
|
gimp->gui.wait (gimp, waitable, message))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Translator: This message is displayed while GIMP is waiting for
|
|
|
|
* some operation to finish. The %s argument is a message describing
|
|
|
|
* the operation.
|
|
|
|
*/
|
|
|
|
g_printerr (_("Please wait: %s\n"), message);
|
|
|
|
|
|
|
|
gimp_waitable_wait (waitable);
|
|
|
|
|
|
|
|
g_free (message);
|
|
|
|
}
|
|
|
|
|
2004-07-12 11:41:19 +00:00
|
|
|
void
|
2008-06-10 09:54:54 +00:00
|
|
|
gimp_help (Gimp *gimp,
|
|
|
|
GimpProgress *progress,
|
|
|
|
const gchar *help_domain,
|
|
|
|
const gchar *help_id)
|
2004-07-12 11:41:19 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2008-06-10 09:54:54 +00:00
|
|
|
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
|
2004-07-12 11:41:19 +00:00
|
|
|
|
|
|
|
if (gimp->gui.help)
|
2008-06-10 09:54:54 +00:00
|
|
|
gimp->gui.help (gimp, progress, help_domain, help_id);
|
2004-07-12 11:41:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const gchar *
|
|
|
|
gimp_get_program_class (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
|
|
|
if (gimp->gui.get_program_class)
|
|
|
|
return gimp->gui.get_program_class (gimp);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
gchar *
|
2014-05-03 00:54:20 +02:00
|
|
|
gimp_get_display_name (Gimp *gimp,
|
2019-08-23 22:23:23 +02:00
|
|
|
gint display_id,
|
2018-04-29 17:27:47 +02:00
|
|
|
GObject **monitor,
|
|
|
|
gint *monitor_number)
|
2004-07-12 11:41:19 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
2014-05-03 00:54:20 +02:00
|
|
|
g_return_val_if_fail (monitor != NULL, NULL);
|
2018-04-29 17:27:47 +02:00
|
|
|
g_return_val_if_fail (monitor_number != NULL, NULL);
|
2004-07-12 11:41:19 +00:00
|
|
|
|
|
|
|
if (gimp->gui.get_display_name)
|
2019-08-23 22:23:23 +02:00
|
|
|
return gimp->gui.get_display_name (gimp, display_id,
|
2018-04-29 17:27:47 +02:00
|
|
|
monitor, monitor_number);
|
2004-07-12 11:41:19 +00:00
|
|
|
|
2018-04-29 17:27:47 +02:00
|
|
|
*monitor = NULL;
|
2004-07-12 11:41:19 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-03-27 16:30:29 +00:00
|
|
|
/**
|
|
|
|
* gimp_get_user_time:
|
|
|
|
* @gimp:
|
|
|
|
*
|
|
|
|
* Returns the timestamp of the last user interaction. The timestamp is
|
|
|
|
* taken from events caused by user interaction such as key presses or
|
|
|
|
* pointer movements. See gdk_x11_display_get_user_time().
|
|
|
|
*
|
2019-08-03 00:10:14 +02:00
|
|
|
* Returns: the timestamp of the last user interaction
|
2008-03-27 16:30:29 +00:00
|
|
|
*/
|
|
|
|
guint32
|
|
|
|
gimp_get_user_time (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), 0);
|
|
|
|
|
|
|
|
if (gimp->gui.get_user_time)
|
|
|
|
return gimp->gui.get_user_time (gimp);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-07-17 10:09:19 +02:00
|
|
|
GFile *
|
2004-07-12 11:41:19 +00:00
|
|
|
gimp_get_theme_dir (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
|
|
|
if (gimp->gui.get_theme_dir)
|
|
|
|
return gimp->gui.get_theme_dir (gimp);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-12-08 14:52:12 -05:00
|
|
|
GFile *
|
|
|
|
gimp_get_icon_theme_dir (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
|
|
|
if (gimp->gui.get_icon_theme_dir)
|
|
|
|
return gimp->gui.get_icon_theme_dir (gimp);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-07-03 20:55:03 +02:00
|
|
|
GimpObject *
|
|
|
|
gimp_get_window_strategy (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
|
|
|
if (gimp->gui.get_window_strategy)
|
|
|
|
return gimp->gui.get_window_strategy (gimp);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2019-09-04 14:27:18 +02:00
|
|
|
GimpDisplay *
|
2008-03-25 10:50:42 +00:00
|
|
|
gimp_get_empty_display (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
|
|
|
if (gimp->gui.get_empty_display)
|
|
|
|
return gimp->gui.get_empty_display (gimp);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
app, libgimp*, pdb, plug-ins: reimplement generic inter-process transient window.
Having windows ID as guint32 is a mistake. Different systems have
different protocols. In Wayland in particular, Windows handles are
exchanged as strings. What this commit does is the following:
In core:
- get_window_id() virtual function in core GimpProgress is changed to
return a GBytes, as a generic "data" to represent a window differently
on different systems.
- All implementations of get_window_id() in various classes implementing
this interface are updated accordingly:
* GimpSubProgress
* GimpDisplay returns the handle of its shell.
* GimpDisplayShell now creates its window handle at construction with
libgimpwidget's gimp_widget_set_native_handle() and simply return
this handle every time it's requested.
* GimpFileDialog also creates its window handle at construction with
gimp_widget_set_native_handle().
- gimp_window_set_transient_for() in core is changed to take a
GimpProgress as argument (instead of a guint32 ID), requests and
process the ID itself, according to the running platform. In
particular, the following were improved:
* Unlike old code, it will work even if the window is not visible yet.
In such a case, the function simply adds a signal handler to set
transient at mapping. It makes it easier to use it at construction
in a reliable way.
* It now works for Wayland too, additionally to X11.
- GimpPdbProgress now exchanges a GBytes too with the command
GIMP_PROGRESS_COMMAND_GET_WINDOW.
- display_get_window_id() in gimp-gui.h also returns a GBytes now.
PDB/libgimp:
- gimp_display_get_window_handle() and gimp_progress_get_window_handle()
now return a GBytes to represent a window handle in an opaque way
(depending on the running platform).
In libgimp:
- GimpProgress's get_window() virtual function changed to return a
GBytes and renamed get_window_handle().
- In particular GimpProgressBar is the only implementation of
get_window_handle(). It creates its handle at object construction with
libgimpwidget's gimp_widget_set_native_handle() and the virtual
method's implementation simply returns the GBytes.
In libgimpUi:
- gimp_ui_get_display_window() and gimp_ui_get_progress_window() were
removed. We should not assume anymore that it is possible to create a
GdkWindow to be used. For instance this is not possible with Wayland
which has its own way to set a window transient with a string handle.
- gimp_window_set_transient_for_display() and
gimp_window_set_transient() now use an internal implementation similar
to core gimp_window_set_transient_for(), with the same improvements
(works even at construction when the window is not visible yet + works
for Wayland too).
In libgimpwidgets:
- New gimp_widget_set_native_handle() is a helper function used both in
core and libgimp* libraries for widgets which we want to be usable as
possible parents. It takes care of getting the relevant window handle
(depending on the running platform) and stores it in a given pointer,
either immediately or after a callback once the widget is mapped. So
it can be used at construction. Also it sets a handle for X11 or
Wayland.
In plug-ins:
- Screenshot uses the new gimp_progress_get_window_handle() directly now
in its X11 code path and creates out of it a GdkWindows itself with
gdk_x11_window_foreign_new_for_display().
Our inter-process transient implementation only worked for X11, and with
this commit, it works for Wayland too.
There is code for Windows but it is currently disabled as it apparently
hangs (there is a comment in-code which links to this old report:
https://bugzilla.gnome.org/show_bug.cgi?id=359538). NikcDC tested
yesterday with re-enabling the code and said they experienced a freeze.
;-(
Finally there is no infrastructure yet to make this work on macOS and
apparently there is no implementation of window handle in GDK for macOS
that I could find. I'm not sure if macOS doesn't have this concept of
setting transient on another processus's window or GDK is simply lacking
the implementation.
2023-08-14 14:23:06 +02:00
|
|
|
GBytes *
|
2019-09-04 14:27:18 +02:00
|
|
|
gimp_get_display_window_id (Gimp *gimp,
|
|
|
|
GimpDisplay *display)
|
2005-09-05 20:47:12 +00:00
|
|
|
{
|
app, libgimp*, pdb, plug-ins: reimplement generic inter-process transient window.
Having windows ID as guint32 is a mistake. Different systems have
different protocols. In Wayland in particular, Windows handles are
exchanged as strings. What this commit does is the following:
In core:
- get_window_id() virtual function in core GimpProgress is changed to
return a GBytes, as a generic "data" to represent a window differently
on different systems.
- All implementations of get_window_id() in various classes implementing
this interface are updated accordingly:
* GimpSubProgress
* GimpDisplay returns the handle of its shell.
* GimpDisplayShell now creates its window handle at construction with
libgimpwidget's gimp_widget_set_native_handle() and simply return
this handle every time it's requested.
* GimpFileDialog also creates its window handle at construction with
gimp_widget_set_native_handle().
- gimp_window_set_transient_for() in core is changed to take a
GimpProgress as argument (instead of a guint32 ID), requests and
process the ID itself, according to the running platform. In
particular, the following were improved:
* Unlike old code, it will work even if the window is not visible yet.
In such a case, the function simply adds a signal handler to set
transient at mapping. It makes it easier to use it at construction
in a reliable way.
* It now works for Wayland too, additionally to X11.
- GimpPdbProgress now exchanges a GBytes too with the command
GIMP_PROGRESS_COMMAND_GET_WINDOW.
- display_get_window_id() in gimp-gui.h also returns a GBytes now.
PDB/libgimp:
- gimp_display_get_window_handle() and gimp_progress_get_window_handle()
now return a GBytes to represent a window handle in an opaque way
(depending on the running platform).
In libgimp:
- GimpProgress's get_window() virtual function changed to return a
GBytes and renamed get_window_handle().
- In particular GimpProgressBar is the only implementation of
get_window_handle(). It creates its handle at object construction with
libgimpwidget's gimp_widget_set_native_handle() and the virtual
method's implementation simply returns the GBytes.
In libgimpUi:
- gimp_ui_get_display_window() and gimp_ui_get_progress_window() were
removed. We should not assume anymore that it is possible to create a
GdkWindow to be used. For instance this is not possible with Wayland
which has its own way to set a window transient with a string handle.
- gimp_window_set_transient_for_display() and
gimp_window_set_transient() now use an internal implementation similar
to core gimp_window_set_transient_for(), with the same improvements
(works even at construction when the window is not visible yet + works
for Wayland too).
In libgimpwidgets:
- New gimp_widget_set_native_handle() is a helper function used both in
core and libgimp* libraries for widgets which we want to be usable as
possible parents. It takes care of getting the relevant window handle
(depending on the running platform) and stores it in a given pointer,
either immediately or after a callback once the widget is mapped. So
it can be used at construction. Also it sets a handle for X11 or
Wayland.
In plug-ins:
- Screenshot uses the new gimp_progress_get_window_handle() directly now
in its X11 code path and creates out of it a GdkWindows itself with
gdk_x11_window_foreign_new_for_display().
Our inter-process transient implementation only worked for X11, and with
this commit, it works for Wayland too.
There is code for Windows but it is currently disabled as it apparently
hangs (there is a comment in-code which links to this old report:
https://bugzilla.gnome.org/show_bug.cgi?id=359538). NikcDC tested
yesterday with re-enabling the code and said they experienced a freeze.
;-(
Finally there is no infrastructure yet to make this work on macOS and
apparently there is no implementation of window handle in GDK for macOS
that I could find. I'm not sure if macOS doesn't have this concept of
setting transient on another processus's window or GDK is simply lacking
the implementation.
2023-08-14 14:23:06 +02:00
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY (display), NULL);
|
2005-09-05 20:47:12 +00:00
|
|
|
|
2011-02-06 12:07:55 +01:00
|
|
|
if (gimp->gui.display_get_window_id)
|
|
|
|
return gimp->gui.display_get_window_id (display);
|
2005-09-05 20:47:12 +00:00
|
|
|
|
app, libgimp*, pdb, plug-ins: reimplement generic inter-process transient window.
Having windows ID as guint32 is a mistake. Different systems have
different protocols. In Wayland in particular, Windows handles are
exchanged as strings. What this commit does is the following:
In core:
- get_window_id() virtual function in core GimpProgress is changed to
return a GBytes, as a generic "data" to represent a window differently
on different systems.
- All implementations of get_window_id() in various classes implementing
this interface are updated accordingly:
* GimpSubProgress
* GimpDisplay returns the handle of its shell.
* GimpDisplayShell now creates its window handle at construction with
libgimpwidget's gimp_widget_set_native_handle() and simply return
this handle every time it's requested.
* GimpFileDialog also creates its window handle at construction with
gimp_widget_set_native_handle().
- gimp_window_set_transient_for() in core is changed to take a
GimpProgress as argument (instead of a guint32 ID), requests and
process the ID itself, according to the running platform. In
particular, the following were improved:
* Unlike old code, it will work even if the window is not visible yet.
In such a case, the function simply adds a signal handler to set
transient at mapping. It makes it easier to use it at construction
in a reliable way.
* It now works for Wayland too, additionally to X11.
- GimpPdbProgress now exchanges a GBytes too with the command
GIMP_PROGRESS_COMMAND_GET_WINDOW.
- display_get_window_id() in gimp-gui.h also returns a GBytes now.
PDB/libgimp:
- gimp_display_get_window_handle() and gimp_progress_get_window_handle()
now return a GBytes to represent a window handle in an opaque way
(depending on the running platform).
In libgimp:
- GimpProgress's get_window() virtual function changed to return a
GBytes and renamed get_window_handle().
- In particular GimpProgressBar is the only implementation of
get_window_handle(). It creates its handle at object construction with
libgimpwidget's gimp_widget_set_native_handle() and the virtual
method's implementation simply returns the GBytes.
In libgimpUi:
- gimp_ui_get_display_window() and gimp_ui_get_progress_window() were
removed. We should not assume anymore that it is possible to create a
GdkWindow to be used. For instance this is not possible with Wayland
which has its own way to set a window transient with a string handle.
- gimp_window_set_transient_for_display() and
gimp_window_set_transient() now use an internal implementation similar
to core gimp_window_set_transient_for(), with the same improvements
(works even at construction when the window is not visible yet + works
for Wayland too).
In libgimpwidgets:
- New gimp_widget_set_native_handle() is a helper function used both in
core and libgimp* libraries for widgets which we want to be usable as
possible parents. It takes care of getting the relevant window handle
(depending on the running platform) and stores it in a given pointer,
either immediately or after a callback once the widget is mapped. So
it can be used at construction. Also it sets a handle for X11 or
Wayland.
In plug-ins:
- Screenshot uses the new gimp_progress_get_window_handle() directly now
in its X11 code path and creates out of it a GdkWindows itself with
gdk_x11_window_foreign_new_for_display().
Our inter-process transient implementation only worked for X11, and with
this commit, it works for Wayland too.
There is code for Windows but it is currently disabled as it apparently
hangs (there is a comment in-code which links to this old report:
https://bugzilla.gnome.org/show_bug.cgi?id=359538). NikcDC tested
yesterday with re-enabling the code and said they experienced a freeze.
;-(
Finally there is no infrastructure yet to make this work on macOS and
apparently there is no implementation of window handle in GDK for macOS
that I could find. I'm not sure if macOS doesn't have this concept of
setting transient on another processus's window or GDK is simply lacking
the implementation.
2023-08-14 14:23:06 +02:00
|
|
|
return NULL;
|
2005-09-05 20:47:12 +00:00
|
|
|
}
|
|
|
|
|
2019-09-04 14:27:18 +02:00
|
|
|
GimpDisplay *
|
2004-07-12 11:41:19 +00:00
|
|
|
gimp_create_display (Gimp *gimp,
|
2006-03-28 17:08:36 +00:00
|
|
|
GimpImage *image,
|
2004-07-12 11:41:19 +00:00
|
|
|
GimpUnit unit,
|
2014-05-02 20:20:46 +02:00
|
|
|
gdouble scale,
|
2018-04-29 17:27:47 +02:00
|
|
|
GObject *monitor)
|
2004-07-12 11:41:19 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
2008-03-18 21:22:21 +00:00
|
|
|
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), NULL);
|
2018-04-29 17:27:47 +02:00
|
|
|
g_return_val_if_fail (monitor == NULL || G_IS_OBJECT (monitor), NULL);
|
2004-07-12 11:41:19 +00:00
|
|
|
|
|
|
|
if (gimp->gui.display_create)
|
2018-04-29 17:27:47 +02:00
|
|
|
return gimp->gui.display_create (gimp, image, unit, scale, monitor);
|
2004-07-12 11:41:19 +00:00
|
|
|
|
2006-05-09 19:15:49 +00:00
|
|
|
return NULL;
|
2004-07-12 11:41:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2019-09-04 14:27:18 +02:00
|
|
|
gimp_delete_display (Gimp *gimp,
|
|
|
|
GimpDisplay *display)
|
2004-07-12 11:41:19 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2019-09-04 14:27:18 +02:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2004-07-12 11:41:19 +00:00
|
|
|
|
|
|
|
if (gimp->gui.display_delete)
|
|
|
|
gimp->gui.display_delete (display);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_reconnect_displays (Gimp *gimp,
|
|
|
|
GimpImage *old_image,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (GIMP_IS_IMAGE (old_image));
|
|
|
|
g_return_if_fail (GIMP_IS_IMAGE (new_image));
|
|
|
|
|
|
|
|
if (gimp->gui.displays_reconnect)
|
|
|
|
gimp->gui.displays_reconnect (gimp, old_image, new_image);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpProgress *
|
2019-09-04 14:27:18 +02:00
|
|
|
gimp_new_progress (Gimp *gimp,
|
|
|
|
GimpDisplay *display)
|
2004-07-12 11:41:19 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
2019-09-04 14:27:18 +02:00
|
|
|
g_return_val_if_fail (display == NULL || GIMP_IS_DISPLAY (display), NULL);
|
2004-07-12 11:41:19 +00:00
|
|
|
|
2004-08-10 18:47:21 +00:00
|
|
|
if (gimp->gui.progress_new)
|
2006-03-23 21:56:13 +00:00
|
|
|
return gimp->gui.progress_new (gimp, display);
|
2004-07-12 11:41:19 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-08-10 18:47:21 +00:00
|
|
|
gimp_free_progress (Gimp *gimp,
|
|
|
|
GimpProgress *progress)
|
2004-07-12 11:41:19 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2004-08-10 18:47:21 +00:00
|
|
|
g_return_if_fail (GIMP_IS_PROGRESS (progress));
|
2004-07-12 11:41:19 +00:00
|
|
|
|
2004-08-10 18:47:21 +00:00
|
|
|
if (gimp->gui.progress_free)
|
|
|
|
gimp->gui.progress_free (gimp, progress);
|
2004-07-12 11:41:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_pdb_dialog_new (Gimp *gimp,
|
|
|
|
GimpContext *context,
|
2006-09-22 09:24:41 +00:00
|
|
|
GimpProgress *progress,
|
2004-07-12 11:41:19 +00:00
|
|
|
GimpContainer *container,
|
app, libgimp, pdb: add a parent_window parameter to gimp_*_popup() PDB calls.
Brush, font, gradient, palette and pattern choices are currently chosen through
a dialog created by the core, which then returns the user choice to the calling
plug-in. This has the unfortunate consequence of having a pile of likely at
least 3 windows (main GIMP window by core process, plug-in window by plug-in
process, then the choice popup by the core process) shared in 2 processes, which
often end up under each other and that's messy. Even more as the choice popup is
kinda expected to be like a sub-part of the plug-in dialog.
So anyway, now the plug-in can send its window handle to the core so that the
resource choice dialog ends up always above the plug-in dialog.
Of course, it will always work only on platforms where we have working
inter-process transient support.
2023-08-15 00:12:16 +02:00
|
|
|
GBytes *parent_handle,
|
2004-07-12 11:41:19 +00:00
|
|
|
const gchar *title,
|
|
|
|
const gchar *callback_name,
|
|
|
|
const gchar *object_name,
|
|
|
|
...)
|
|
|
|
{
|
|
|
|
gboolean retval = FALSE;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
|
2006-09-22 09:24:41 +00:00
|
|
|
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), FALSE);
|
2004-07-12 11:41:19 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
|
|
|
|
g_return_val_if_fail (title != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (callback_name != NULL, FALSE);
|
|
|
|
|
|
|
|
if (gimp->gui.pdb_dialog_new)
|
|
|
|
{
|
2006-09-22 09:24:41 +00:00
|
|
|
va_list args;
|
2004-07-12 11:41:19 +00:00
|
|
|
|
|
|
|
va_start (args, object_name);
|
|
|
|
|
2006-09-22 09:24:41 +00:00
|
|
|
retval = gimp->gui.pdb_dialog_new (gimp, context, progress,
|
app, libgimp, pdb: add a parent_window parameter to gimp_*_popup() PDB calls.
Brush, font, gradient, palette and pattern choices are currently chosen through
a dialog created by the core, which then returns the user choice to the calling
plug-in. This has the unfortunate consequence of having a pile of likely at
least 3 windows (main GIMP window by core process, plug-in window by plug-in
process, then the choice popup by the core process) shared in 2 processes, which
often end up under each other and that's messy. Even more as the choice popup is
kinda expected to be like a sub-part of the plug-in dialog.
So anyway, now the plug-in can send its window handle to the core so that the
resource choice dialog ends up always above the plug-in dialog.
Of course, it will always work only on platforms where we have working
inter-process transient support.
2023-08-15 00:12:16 +02:00
|
|
|
container, parent_handle, title,
|
2004-07-12 11:41:19 +00:00
|
|
|
callback_name, object_name,
|
|
|
|
args);
|
|
|
|
|
|
|
|
va_end (args);
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_pdb_dialog_set (Gimp *gimp,
|
|
|
|
GimpContainer *container,
|
|
|
|
const gchar *callback_name,
|
2023-08-16 20:17:53 +02:00
|
|
|
GimpObject *object,
|
2004-07-12 11:41:19 +00:00
|
|
|
...)
|
|
|
|
{
|
|
|
|
gboolean retval = FALSE;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
|
|
|
|
g_return_val_if_fail (callback_name != NULL, FALSE);
|
2023-08-16 20:17:53 +02:00
|
|
|
g_return_val_if_fail (object != NULL, FALSE);
|
2004-07-12 11:41:19 +00:00
|
|
|
|
|
|
|
if (gimp->gui.pdb_dialog_set)
|
|
|
|
{
|
2006-09-22 09:24:41 +00:00
|
|
|
va_list args;
|
2004-07-12 11:41:19 +00:00
|
|
|
|
2023-08-16 20:17:53 +02:00
|
|
|
va_start (args, object);
|
2004-07-12 11:41:19 +00:00
|
|
|
|
|
|
|
retval = gimp->gui.pdb_dialog_set (gimp, container, callback_name,
|
2023-08-16 20:17:53 +02:00
|
|
|
object, args);
|
2004-07-12 11:41:19 +00:00
|
|
|
|
|
|
|
va_end (args);
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_pdb_dialog_close (Gimp *gimp,
|
|
|
|
GimpContainer *container,
|
|
|
|
const gchar *callback_name)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
|
|
|
|
g_return_val_if_fail (callback_name != NULL, FALSE);
|
|
|
|
|
|
|
|
if (gimp->gui.pdb_dialog_close)
|
|
|
|
return gimp->gui.pdb_dialog_close (gimp, container, callback_name);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
drop own recently used files code in favour of GtkRecentManager:
* app/core/gimp-gui.c (gimp_recent_list_add_uri), app/core/gimp-gui.h,
app/gui/gui-vtable.c (gui_recent_list_add_uri): add
{gimp,gui}_recent_list_add_uri(), gui_recent_list_add_uri() dispatches to
GtkRecentManager
* app/dialogs/file-save-dialog.c (file_save_dialog_save_image),
app/actions/file-commands.c (file_save_cmd_callback),
app/widgets/gimpdnd-xds.c (gimp_dnd_xds_save_image): pass Gimp instance to
file_save() calls
* app/file/file-open.c (file_open_with_proc_and_display,
file_open_layers), app/file/file-save.c (file_save), app/file/file-save.h:
pass Gimp instance to gimp_recent_list_add_uri() calls
* app/file/gimprecentitem.c, app/file/gimprecentitem.h,
app/file/gimprecentlist.c, app/file/gimprecentlist.h: removed
* app/file/Makefile.am: drop reference to removed files
svn path=/trunk/; revision=23526
2007-09-13 14:19:30 +00:00
|
|
|
|
|
|
|
gboolean
|
2014-07-05 12:51:54 +02:00
|
|
|
gimp_recent_list_add_file (Gimp *gimp,
|
|
|
|
GFile *file,
|
|
|
|
const gchar *mime_type)
|
drop own recently used files code in favour of GtkRecentManager:
* app/core/gimp-gui.c (gimp_recent_list_add_uri), app/core/gimp-gui.h,
app/gui/gui-vtable.c (gui_recent_list_add_uri): add
{gimp,gui}_recent_list_add_uri(), gui_recent_list_add_uri() dispatches to
GtkRecentManager
* app/dialogs/file-save-dialog.c (file_save_dialog_save_image),
app/actions/file-commands.c (file_save_cmd_callback),
app/widgets/gimpdnd-xds.c (gimp_dnd_xds_save_image): pass Gimp instance to
file_save() calls
* app/file/file-open.c (file_open_with_proc_and_display,
file_open_layers), app/file/file-save.c (file_save), app/file/file-save.h:
pass Gimp instance to gimp_recent_list_add_uri() calls
* app/file/gimprecentitem.c, app/file/gimprecentitem.h,
app/file/gimprecentlist.c, app/file/gimprecentlist.h: removed
* app/file/Makefile.am: drop reference to removed files
svn path=/trunk/; revision=23526
2007-09-13 14:19:30 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
2014-07-05 12:51:54 +02:00
|
|
|
g_return_val_if_fail (G_IS_FILE (file), FALSE);
|
drop own recently used files code in favour of GtkRecentManager:
* app/core/gimp-gui.c (gimp_recent_list_add_uri), app/core/gimp-gui.h,
app/gui/gui-vtable.c (gui_recent_list_add_uri): add
{gimp,gui}_recent_list_add_uri(), gui_recent_list_add_uri() dispatches to
GtkRecentManager
* app/dialogs/file-save-dialog.c (file_save_dialog_save_image),
app/actions/file-commands.c (file_save_cmd_callback),
app/widgets/gimpdnd-xds.c (gimp_dnd_xds_save_image): pass Gimp instance to
file_save() calls
* app/file/file-open.c (file_open_with_proc_and_display,
file_open_layers), app/file/file-save.c (file_save), app/file/file-save.h:
pass Gimp instance to gimp_recent_list_add_uri() calls
* app/file/gimprecentitem.c, app/file/gimprecentitem.h,
app/file/gimprecentlist.c, app/file/gimprecentlist.h: removed
* app/file/Makefile.am: drop reference to removed files
svn path=/trunk/; revision=23526
2007-09-13 14:19:30 +00:00
|
|
|
|
2014-07-05 12:51:54 +02:00
|
|
|
if (gimp->gui.recent_list_add_file)
|
|
|
|
return gimp->gui.recent_list_add_file (gimp, file, mime_type);
|
drop own recently used files code in favour of GtkRecentManager:
* app/core/gimp-gui.c (gimp_recent_list_add_uri), app/core/gimp-gui.h,
app/gui/gui-vtable.c (gui_recent_list_add_uri): add
{gimp,gui}_recent_list_add_uri(), gui_recent_list_add_uri() dispatches to
GtkRecentManager
* app/dialogs/file-save-dialog.c (file_save_dialog_save_image),
app/actions/file-commands.c (file_save_cmd_callback),
app/widgets/gimpdnd-xds.c (gimp_dnd_xds_save_image): pass Gimp instance to
file_save() calls
* app/file/file-open.c (file_open_with_proc_and_display,
file_open_layers), app/file/file-save.c (file_save), app/file/file-save.h:
pass Gimp instance to gimp_recent_list_add_uri() calls
* app/file/gimprecentitem.c, app/file/gimprecentitem.h,
app/file/gimprecentlist.c, app/file/gimprecentlist.h: removed
* app/file/Makefile.am: drop reference to removed files
svn path=/trunk/; revision=23526
2007-09-13 14:19:30 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-03-24 11:11:15 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
gimp_recent_list_load (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
if (gimp->gui.recent_list_load)
|
|
|
|
gimp->gui.recent_list_load (gimp);
|
|
|
|
}
|
2014-07-10 22:52:29 +02:00
|
|
|
|
2014-07-22 20:29:52 +02:00
|
|
|
GMountOperation *
|
|
|
|
gimp_get_mount_operation (Gimp *gimp,
|
|
|
|
GimpProgress *progress)
|
2014-07-10 22:52:29 +02:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
|
|
|
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), FALSE);
|
|
|
|
|
2014-07-22 20:29:52 +02:00
|
|
|
if (gimp->gui.get_mount_operation)
|
|
|
|
return gimp->gui.get_mount_operation (gimp, progress);
|
2014-07-10 22:52:29 +02:00
|
|
|
|
2014-07-22 20:29:52 +02:00
|
|
|
return g_mount_operation_new ();
|
2014-07-10 22:52:29 +02:00
|
|
|
}
|
2015-08-23 10:51:31 +02:00
|
|
|
|
|
|
|
GimpColorProfilePolicy
|
2016-06-05 22:36:52 +02:00
|
|
|
gimp_query_profile_policy (Gimp *gimp,
|
|
|
|
GimpImage *image,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpColorProfile **dest_profile,
|
|
|
|
GimpColorRenderingIntent *intent,
|
|
|
|
gboolean *bpc,
|
|
|
|
gboolean *dont_ask)
|
2015-08-23 10:51:31 +02:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), GIMP_COLOR_PROFILE_POLICY_KEEP);
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), GIMP_COLOR_PROFILE_POLICY_KEEP);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), GIMP_COLOR_PROFILE_POLICY_KEEP);
|
|
|
|
g_return_val_if_fail (dest_profile != NULL, GIMP_COLOR_PROFILE_POLICY_KEEP);
|
|
|
|
|
|
|
|
if (gimp->gui.query_profile_policy)
|
|
|
|
return gimp->gui.query_profile_policy (gimp, image, context,
|
2016-06-05 22:36:52 +02:00
|
|
|
dest_profile,
|
|
|
|
intent, bpc,
|
|
|
|
dont_ask);
|
2015-08-23 10:51:31 +02:00
|
|
|
|
|
|
|
return GIMP_COLOR_PROFILE_POLICY_KEEP;
|
|
|
|
}
|
app, libgimp, plug-ins: move Orientation metadata handling into core.
Orientation is now handled by core code, just next to profile conversion
handling.
One of the first consequence is that we don't need to have a non-GUI
version gimp_image_metadata_load_finish_batch() in libgimp, next to a
GUI version of the gimp_image_metadata_load_finish() function in
libgimpui. This makes for simpler API.
Also a plug-in which wishes to get access to the rotation dialog
provided by GIMP without loading ligimpui/GTK+ (for whatever reason)
will still have the feature.
The main advantage is that the "Don't ask me again" feature is now
handled by a settings in `Preferences > Image Import & Export` as the
"Metadata rotation policy". Until now it was saved as a global parasite,
which made it virtually non-editable once you checked it once (no easy
way to edit parasites except by scripts). So say you refused the
rotation once while checking "Don't ask again", and GIMP will forever
discard the rotation metadata without giving you a sane way to change
your mind. Of course, I could have passed the settings to plug-ins
through the PDB, but I find it a lot better to simply handle such
settings core-side.
The dialog code is basically the same as an app/dialogs/ as it was in
libgimp, with the minor improvement that it now takes the scale ratio
into account (basically the maximum thumbnail size will be bigger on
higher density displays).
Only downside of the move to the core is that this rotation dialog is
raised only when you open an image from the core, not as a PDB call. So
a plug-in which makes say a "file-jpeg-load" PDB call, even in
INTERACTIVE run mode, won't have rotation processed. Note that this was
already the same for embedded color profile conversion. This can be
wanted or not. Anyway some additional libgimp calls might be of interest
to explicitly call the core dialogs.
2020-09-23 19:59:09 +02:00
|
|
|
|
|
|
|
GimpMetadataRotationPolicy
|
|
|
|
gimp_query_rotation_policy (Gimp *gimp,
|
|
|
|
GimpImage *image,
|
|
|
|
GimpContext *context,
|
|
|
|
gboolean *dont_ask)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), GIMP_METADATA_ROTATION_POLICY_ROTATE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), GIMP_METADATA_ROTATION_POLICY_ROTATE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), GIMP_METADATA_ROTATION_POLICY_ROTATE);
|
|
|
|
|
|
|
|
if (gimp->gui.query_rotation_policy)
|
|
|
|
return gimp->gui.query_rotation_policy (gimp, image, context, dont_ask);
|
|
|
|
|
|
|
|
return GIMP_METADATA_ROTATION_POLICY_ROTATE;
|
|
|
|
}
|