[gimp] libgimp: move _gimp_read_expect_msg() back to gimp.c
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimp: move _gimp_read_expect_msg() back to gimp.c
- Date: Fri, 2 Aug 2019 16:29:34 +0000 (UTC)
commit 366047f423b423c46cb916ec9bd1ac361b44fa0a
Author: Michael Natterer <mitch gimp org>
Date: Fri Aug 2 18:26:52 2019 +0200
libgimp: move _gimp_read_expect_msg() back to gimp.c
and make it distinguish between old and new plug-in running.
libgimp/gimp-private.h | 1 +
libgimp/gimp.c | 32 ++++++++++++++++++++++++++++++++
libgimp/gimplegacy.c | 32 +++-----------------------------
libgimp/gimpplugin-private.c | 10 ++++------
libgimp/gimpplugin-private.h | 20 +++++++++++---------
5 files changed, 51 insertions(+), 44 deletions(-)
---
diff --git a/libgimp/gimp-private.h b/libgimp/gimp-private.h
index 12d8f387db..d1f6cb7859 100644
--- a/libgimp/gimp-private.h
+++ b/libgimp/gimp-private.h
@@ -36,6 +36,7 @@ void _gimp_config (GPConfig *config);
void _gimp_loop (GimpRunProc run_proc);
void _gimp_read_expect_msg (GimpWireMessage *msg,
gint type);
+void _gimp_process_message (GimpWireMessage *msg);
G_END_DECLS
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
index 51493f36bf..21797b4b78 100644
--- a/libgimp/gimp.c
+++ b/libgimp/gimp.c
@@ -801,6 +801,38 @@ gimp_quit (void)
exit (EXIT_SUCCESS);
}
+void
+_gimp_read_expect_msg (GimpWireMessage *msg,
+ gint type)
+{
+ while (TRUE)
+ {
+ if (! gimp_wire_read_msg (_gimp_readchannel, msg, NULL))
+ gimp_quit ();
+
+ if (msg->type == type)
+ return; /* up to the caller to call wire_destroy() */
+
+ if (msg->type == GP_TEMP_PROC_RUN || msg->type == GP_QUIT)
+ {
+ if (PLUG_IN)
+ {
+ _gimp_plug_in_process_message (PLUG_IN, msg);
+ }
+ else
+ {
+ _gimp_process_message (msg);
+ }
+ }
+ else
+ {
+ g_error ("unexpected message: %d", msg->type);
+ }
+
+ gimp_wire_destroy (msg);
+ }
+}
+
GimpValueArray *
gimp_run_procedure_with_array (const gchar *name,
GimpValueArray *arguments)
diff --git a/libgimp/gimplegacy.c b/libgimp/gimplegacy.c
index 6b0c8e56be..3ecd2a2ae1 100644
--- a/libgimp/gimplegacy.c
+++ b/libgimp/gimplegacy.c
@@ -48,7 +48,6 @@
static gpointer gimp_param_copy (gpointer boxed);
static void gimp_param_free (gpointer boxed);
-static void gimp_process_message (GimpWireMessage *msg);
static void gimp_single_message (void);
static gboolean gimp_extension_read (GIOChannel *channel,
GIOCondition condition,
@@ -589,31 +588,6 @@ gimp_extension_process (guint timeout)
#endif
}
-void
-_gimp_read_expect_msg (GimpWireMessage *msg,
- gint type)
-{
- while (TRUE)
- {
- if (! gimp_wire_read_msg (_gimp_readchannel, msg, NULL))
- gimp_quit ();
-
- if (msg->type == type)
- return; /* up to the caller to call wire_destroy() */
-
- if (msg->type == GP_TEMP_PROC_RUN || msg->type == GP_QUIT)
- {
- gimp_process_message (msg);
- }
- else
- {
- g_error ("unexpected message: %d", msg->type);
- }
-
- gimp_wire_destroy (msg);
- }
-}
-
/**
* gimp_run_procedure: (skip)
* @name: the name of the procedure to run
@@ -1261,8 +1235,8 @@ gimp_plugin_icon_register (const gchar *procedure_name,
/* private functions */
-static void
-gimp_process_message (GimpWireMessage *msg)
+void
+_gimp_process_message (GimpWireMessage *msg)
{
switch (msg->type)
{
@@ -1307,7 +1281,7 @@ gimp_single_message (void)
if (! gimp_wire_read_msg (_gimp_readchannel, &msg, NULL))
gimp_quit ();
- gimp_process_message (&msg);
+ _gimp_process_message (&msg);
gimp_wire_destroy (&msg);
}
diff --git a/libgimp/gimpplugin-private.c b/libgimp/gimpplugin-private.c
index 0350883d53..320eae912b 100644
--- a/libgimp/gimpplugin-private.c
+++ b/libgimp/gimpplugin-private.c
@@ -36,8 +36,6 @@
static void gimp_plug_in_register (GimpPlugIn *plug_in,
gboolean init);
static void gimp_plug_in_loop (GimpPlugIn *plug_in);
-static void gimp_plug_in_process_message (GimpPlugIn *plug_in,
- GimpWireMessage *msg);
static void gimp_plug_in_proc_run (GimpPlugIn *plug_in,
GPProcRun *proc_run);
static void gimp_plug_in_temp_proc_run (GimpPlugIn *plug_in,
@@ -233,14 +231,14 @@ _gimp_plug_in_single_message (GimpPlugIn *plug_in)
if (! gimp_wire_read_msg (_gimp_readchannel, &msg, NULL))
gimp_quit ();
- gimp_plug_in_process_message (plug_in, &msg);
+ _gimp_plug_in_process_message (plug_in, &msg);
gimp_wire_destroy (&msg);
}
-static void
-gimp_plug_in_process_message (GimpPlugIn *plug_in,
- GimpWireMessage *msg)
+void
+_gimp_plug_in_process_message (GimpPlugIn *plug_in,
+ GimpWireMessage *msg)
{
switch (msg->type)
{
diff --git a/libgimp/gimpplugin-private.h b/libgimp/gimpplugin-private.h
index 66fe8acba8..bf0edf4aa0 100644
--- a/libgimp/gimpplugin-private.h
+++ b/libgimp/gimpplugin-private.h
@@ -49,15 +49,17 @@ struct _GimpPlugInPrivate
};
-void _gimp_plug_in_query (GimpPlugIn *plug_in);
-void _gimp_plug_in_init (GimpPlugIn *plug_in);
-void _gimp_plug_in_run (GimpPlugIn *plug_in);
-void _gimp_plug_in_quit (GimpPlugIn *plug_in);
-
-gboolean _gimp_plug_in_extension_read (GIOChannel *channel,
- GIOCondition condition,
- gpointer data);
-void _gimp_plug_in_single_message (GimpPlugIn *plug_in);
+void _gimp_plug_in_query (GimpPlugIn *plug_in);
+void _gimp_plug_in_init (GimpPlugIn *plug_in);
+void _gimp_plug_in_run (GimpPlugIn *plug_in);
+void _gimp_plug_in_quit (GimpPlugIn *plug_in);
+
+gboolean _gimp_plug_in_extension_read (GIOChannel *channel,
+ GIOCondition condition,
+ gpointer data);
+void _gimp_plug_in_single_message (GimpPlugIn *plug_in);
+void _gimp_plug_in_process_message (GimpPlugIn *plug_in,
+ GimpWireMessage *msg);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]