[gimp] libgimpbase, libgimp, app: pass misc. GEGL config to plug-ins



commit c288b28ac82a0bd3dc71d1ecb6963fd325908ca9
Author: Ell <ell_se yahoo com>
Date:   Mon Nov 19 16:13:07 2018 -0500

    libgimpbase, libgimp, app: pass misc. GEGL config to plug-ins
    
    Pass the GEGL tile-cache size, swap path, and thread-count to plug-
    ins as part of their config, and have libgimp set the plug-in's
    GeglConfig accordingly upon initialization.

 app/plug-in/gimppluginmanager-call.c |  3 +++
 libgimp/gimp.c                       |  3 +++
 libgimpbase/gimpprotocol.c           | 22 ++++++++++++++++++++++
 libgimpbase/gimpprotocol.h           |  5 ++++-
 4 files changed, 32 insertions(+), 1 deletion(-)
---
diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c
index 973ff6a44c..f76e269f1a 100644
--- a/app/plug-in/gimppluginmanager-call.c
+++ b/app/plug-in/gimppluginmanager-call.c
@@ -222,6 +222,9 @@ gimp_plug_in_manager_call_run (GimpPlugInManager   *manager,
       config.icon_theme_dir   = icon_theme_dir ?
                                   g_file_get_path (icon_theme_dir) :
                                   NULL;
+      config.tile_cache_size  = gegl_config->tile_cache_size;
+      config.swap_path        = gegl_config->swap_path;
+      config.num_processors   = gegl_config->num_processors;
 
       proc_run.name    = GIMP_PROCEDURE (procedure)->original_name;
       proc_run.nparams = gimp_value_array_length (args);
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
index a66eaa49df..378f215169 100644
--- a/libgimp/gimp.c
+++ b/libgimp/gimp.c
@@ -2164,6 +2164,9 @@ gimp_config (GPConfig *config)
   gimp_cpu_accel_set_use (config->use_cpu_accel);
 
   g_object_set (gegl_config (),
+                "tile-cache-size",     config->tile_cache_size,
+                "swap",                config->swap_path,
+                "threads",             (gint) config->num_processors,
                 "use-opencl",          config->use_opencl,
                 "application-license", "GPL3",
                 NULL);
diff --git a/libgimpbase/gimpprotocol.c b/libgimpbase/gimpprotocol.c
index 27068c9fe4..a79895f7ed 100644
--- a/libgimpbase/gimpprotocol.c
+++ b/libgimpbase/gimpprotocol.c
@@ -539,6 +539,16 @@ _gp_config_read (GIOChannel      *channel,
   if (! _gimp_wire_read_string (channel,
                                 &config->icon_theme_dir, 1, user_data))
     goto cleanup;
+  if (! _gimp_wire_read_int64 (channel,
+                               &config->tile_cache_size, 1, user_data))
+    goto cleanup;
+  if (! _gimp_wire_read_string (channel,
+                                &config->swap_path, 1, user_data))
+    goto cleanup;
+  if (! _gimp_wire_read_int32 (channel,
+                               (guint32 *) &config->num_processors, 1,
+                               user_data))
+    goto cleanup;
 
   msg->data = config;
   return;
@@ -548,6 +558,7 @@ _gp_config_read (GIOChannel      *channel,
   g_free (config->wm_class);
   g_free (config->display_name);
   g_free (config->icon_theme_dir);
+  g_free (config->swap_path);
   g_slice_free (GPConfig, config);
 }
 
@@ -628,6 +639,16 @@ _gp_config_write (GIOChannel      *channel,
   if (! _gimp_wire_write_string (channel,
                                  &config->icon_theme_dir, 1, user_data))
     return;
+  if (! _gimp_wire_write_int64 (channel,
+                                &config->tile_cache_size, 1, user_data))
+    return;
+  if (! _gimp_wire_write_string (channel,
+                                 &config->swap_path, 1, user_data))
+    return;
+  if (! _gimp_wire_write_int32 (channel,
+                                (const guint32 *) &config->num_processors, 1,
+                                user_data))
+    return;
 }
 
 static void
@@ -641,6 +662,7 @@ _gp_config_destroy (GimpWireMessage *msg)
       g_free (config->wm_class);
       g_free (config->display_name);
       g_free (config->icon_theme_dir);
+      g_free (config->swap_path);
       g_slice_free (GPConfig, config);
     }
 }
diff --git a/libgimpbase/gimpprotocol.h b/libgimpbase/gimpprotocol.h
index 5b2d63fe0a..b8e21be0d6 100644
--- a/libgimpbase/gimpprotocol.h
+++ b/libgimpbase/gimpprotocol.h
@@ -26,7 +26,7 @@ G_BEGIN_DECLS
 
 /* Increment every time the protocol changes
  */
-#define GIMP_PROTOCOL_VERSION  0x0102
+#define GIMP_PROTOCOL_VERSION  0x0103
 
 
 enum
@@ -80,6 +80,9 @@ struct _GPConfig
   gint32   monitor_number;
   guint32  timestamp;
   gchar   *icon_theme_dir;
+  guint64  tile_cache_size;
+  gchar   *swap_path;
+  gint32   num_processors;
 };
 
 struct _GPTileReq


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]