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.
This commit is contained in:
Ell 2018-11-19 16:13:07 -05:00
parent 77c24ca16c
commit c288b28ac8
4 changed files with 32 additions and 1 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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