replaced the never used "gdouble gamma" with 8 reserved gint8 and stuffed

2004-09-03  Michael Natterer  <mitch@gimp.org>

	* libgimpbase/gimpprotocol.h (struct _GPConfig): replaced the
	never used "gdouble gamma" with 8 reserved gint8 and stuffed two
	gint8 behind "gint8 show_tool_tips" where they fit in in a binary
	compatible way due to 32bit aligning of the following "gint32
	min_colors". Use the latter ones for "check_size" and
	"check_type".

	* libgimpbase/gimpprotocol.c (_gp_config_read,write): changed
	accordingly to pass the new stuff over the wire.

	* app/plug-in/plug-in-run.c: ditto. Pass the transpareny values
	from GimpDisplayConfig to plug-ins.

	* libgimp/gimp.[ch] (gimp_config): remember the new config values.
	(gimp_check_size,type): new functions returning the new config values.

	* libgimp/gimpdrawablepreview.c (gimp_drawable_preview_init):
	use the new values to configure preview->area accordingly.
This commit is contained in:
Michael Natterer 2004-09-03 12:19:26 +00:00 committed by Michael Natterer
parent 1b81142365
commit 4085b1fecf
9 changed files with 207 additions and 58 deletions

View file

@ -1,3 +1,24 @@
2004-09-03 Michael Natterer <mitch@gimp.org>
* libgimpbase/gimpprotocol.h (struct _GPConfig): replaced the
never used "gdouble gamma" with 8 reserved gint8 and stuffed two
gint8 behind "gint8 show_tool_tips" where they fit in in a binary
compatible way due to 32bit aligning of the following "gint32
min_colors". Use the latter ones for "check_size" and
"check_type".
* libgimpbase/gimpprotocol.c (_gp_config_read,write): changed
accordingly to pass the new stuff over the wire.
* app/plug-in/plug-in-run.c: ditto. Pass the transpareny values
from GimpDisplayConfig to plug-ins.
* libgimp/gimp.[ch] (gimp_config): remember the new config values.
(gimp_check_size,type): new functions returning the new config values.
* libgimp/gimpdrawablepreview.c (gimp_drawable_preview_init):
use the new values to configure preview->area accordingly.
2004-09-03 Sven Neumann <sven@gimp.org>
* libgimpbase/gimpchecks.h

View file

@ -103,19 +103,28 @@ plug_in_run (Gimp *gimp,
if (progress)
plug_in->progress = g_object_ref (progress);
config.version = GIMP_PROTOCOL_VERSION;
config.tile_width = TILE_WIDTH;
config.tile_height = TILE_HEIGHT;
config.shm_ID = plug_in_shm_get_ID (gimp);
config.gamma = 1.0;
config.install_cmap = gimp->config->install_cmap;
config.show_tool_tips = GIMP_GUI_CONFIG (gimp->config)->show_tool_tips;
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.gdisp_ID = gdisp_ID;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (gimp);
config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor);
config.monitor_number = monitor;
config.version = GIMP_PROTOCOL_VERSION;
config.tile_width = TILE_WIDTH;
config.tile_height = TILE_HEIGHT;
config.shm_ID = plug_in_shm_get_ID (gimp);
config.gimp_reserved_1 = 0;
config.gimp_reserved_2 = 0;
config.gimp_reserved_3 = 0;
config.gimp_reserved_4 = 0;
config.gimp_reserved_5 = 0;
config.gimp_reserved_6 = 0;
config.gimp_reserved_7 = 0;
config.gimp_reserved_8 = 0;
config.install_cmap = gimp->config->install_cmap;
config.show_tool_tips = GIMP_GUI_CONFIG (gimp->config)->show_tool_tips;
config.check_size = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_size;
config.check_type = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_type;
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.gdisp_ID = gdisp_ID;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (gimp);
config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor);
config.monitor_number = monitor;
proc_run.name = proc_rec->name;
proc_run.nparams = argc;

View file

@ -103,19 +103,28 @@ plug_in_run (Gimp *gimp,
if (progress)
plug_in->progress = g_object_ref (progress);
config.version = GIMP_PROTOCOL_VERSION;
config.tile_width = TILE_WIDTH;
config.tile_height = TILE_HEIGHT;
config.shm_ID = plug_in_shm_get_ID (gimp);
config.gamma = 1.0;
config.install_cmap = gimp->config->install_cmap;
config.show_tool_tips = GIMP_GUI_CONFIG (gimp->config)->show_tool_tips;
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.gdisp_ID = gdisp_ID;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (gimp);
config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor);
config.monitor_number = monitor;
config.version = GIMP_PROTOCOL_VERSION;
config.tile_width = TILE_WIDTH;
config.tile_height = TILE_HEIGHT;
config.shm_ID = plug_in_shm_get_ID (gimp);
config.gimp_reserved_1 = 0;
config.gimp_reserved_2 = 0;
config.gimp_reserved_3 = 0;
config.gimp_reserved_4 = 0;
config.gimp_reserved_5 = 0;
config.gimp_reserved_6 = 0;
config.gimp_reserved_7 = 0;
config.gimp_reserved_8 = 0;
config.install_cmap = gimp->config->install_cmap;
config.show_tool_tips = GIMP_GUI_CONFIG (gimp->config)->show_tool_tips;
config.check_size = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_size;
config.check_type = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_type;
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.gdisp_ID = gdisp_ID;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (gimp);
config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor);
config.monitor_number = monitor;
proc_run.name = proc_rec->name;
proc_run.nparams = argc;

View file

@ -103,19 +103,28 @@ plug_in_run (Gimp *gimp,
if (progress)
plug_in->progress = g_object_ref (progress);
config.version = GIMP_PROTOCOL_VERSION;
config.tile_width = TILE_WIDTH;
config.tile_height = TILE_HEIGHT;
config.shm_ID = plug_in_shm_get_ID (gimp);
config.gamma = 1.0;
config.install_cmap = gimp->config->install_cmap;
config.show_tool_tips = GIMP_GUI_CONFIG (gimp->config)->show_tool_tips;
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.gdisp_ID = gdisp_ID;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (gimp);
config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor);
config.monitor_number = monitor;
config.version = GIMP_PROTOCOL_VERSION;
config.tile_width = TILE_WIDTH;
config.tile_height = TILE_HEIGHT;
config.shm_ID = plug_in_shm_get_ID (gimp);
config.gimp_reserved_1 = 0;
config.gimp_reserved_2 = 0;
config.gimp_reserved_3 = 0;
config.gimp_reserved_4 = 0;
config.gimp_reserved_5 = 0;
config.gimp_reserved_6 = 0;
config.gimp_reserved_7 = 0;
config.gimp_reserved_8 = 0;
config.install_cmap = gimp->config->install_cmap;
config.show_tool_tips = GIMP_GUI_CONFIG (gimp->config)->show_tool_tips;
config.check_size = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_size;
config.check_type = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_type;
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.gdisp_ID = gdisp_ID;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (gimp);
config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor);
config.monitor_number = monitor;
proc_run.name = proc_rec->name;
proc_run.nparams = argc;

View file

@ -169,19 +169,21 @@ const guint gimp_micro_version = GIMP_MICRO_VERSION;
static HANDLE shm_handle;
#endif
static gint _tile_width = -1;
static gint _tile_height = -1;
static gint _shm_ID = -1;
static guchar *_shm_addr = NULL;
static gdouble _gamma_val = 1.0;
static gboolean _install_cmap = FALSE;
static gboolean _show_tool_tips = TRUE;
static gint _min_colors = 144;
static gint _gdisp_ID = -1;
static gchar *_wm_class = NULL;
static gchar *_display_name = NULL;
static gint _monitor_number = 0;
static const gchar *progname = NULL;
static gint _tile_width = -1;
static gint _tile_height = -1;
static gint _shm_ID = -1;
static guchar *_shm_addr = NULL;
static gdouble _gamma_val = 1.0;
static gboolean _install_cmap = FALSE;
static gboolean _show_tool_tips = TRUE;
static GimpCheckSize _check_size = GIMP_CHECK_SIZE_MEDIUM_CHECKS;
static GimpCheckType _check_type = GIMP_CHECK_TYPE_GRAY_CHECKS;
static gint _min_colors = 144;
static gint _gdisp_ID = -1;
static gchar *_wm_class = NULL;
static gchar *_display_name = NULL;
static gint _monitor_number = 0;
static const gchar *progname = NULL;
static guint8 write_buffer[WRITE_BUFFER_SIZE];
static guint write_buffer_index = 0;
@ -1111,6 +1113,38 @@ gimp_show_tool_tips (void)
return _show_tool_tips;
}
/**
* gimp_check_size:
*
* Returns the size of the checkerboard to be used in previews.
* This is a constant value given at Plug-In config time.
*
* Return value: the check_size value
*
* Since: GIMP 2.2
**/
GimpCheckSize
gimp_check_size (void)
{
return _check_size;
}
/**
* gimp_check_type:
*
* Returns the type of the checkerboard to be used in previews.
* This is a constant value given at Plug-In config time.
*
* Return value: the check_type value
*
* Since: GIMP 2.2
**/
GimpCheckType
gimp_check_type (void)
{
return _check_type;
}
/**
* gimp_default_display:
*
@ -1603,9 +1637,10 @@ gimp_config (GPConfig *config)
_tile_width = config->tile_width;
_tile_height = config->tile_height;
_shm_ID = config->shm_ID;
_gamma_val = config->gamma;
_install_cmap = config->install_cmap;
_show_tool_tips = config->show_tool_tips;
_check_size = config->check_size;
_check_type = config->check_type;
_min_colors = config->min_colors;
_gdisp_ID = config->gdisp_ID;
_wm_class = g_strdup (config->wm_class);

View file

@ -310,6 +310,8 @@ gdouble gimp_gamma (void) G_GNUC_CONST;
gboolean gimp_install_cmap (void) G_GNUC_CONST;
gint gimp_min_colors (void) G_GNUC_CONST;
gboolean gimp_show_tool_tips (void) G_GNUC_CONST;
GimpCheckSize gimp_check_size (void) G_GNUC_CONST;
GimpCheckType gimp_check_type (void) G_GNUC_CONST;
gint32 gimp_default_display (void) G_GNUC_CONST;
const gchar * gimp_wm_class (void) G_GNUC_CONST;
const gchar * gimp_display_name (void) G_GNUC_CONST;

View file

@ -36,6 +36,7 @@
static void gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass);
static void gimp_drawable_preview_init (GimpDrawablePreview *preview);
static void gimp_drawable_preview_style_set (GtkWidget *widget,
GtkStyle *prev_style);
@ -62,7 +63,7 @@ gimp_drawable_preview_get_type (void)
NULL, /* class_data */
sizeof (GimpDrawablePreview),
0, /* n_preallocs */
NULL /* instance_init */
(GInstanceInitFunc) gimp_drawable_preview_init
};
preview_type = g_type_register_static (GIMP_TYPE_PREVIEW,
@ -86,6 +87,15 @@ gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass)
preview_class->draw = gimp_drawable_preview_draw_original;
}
static void
gimp_drawable_preview_init (GimpDrawablePreview *preview)
{
g_object_set (GIMP_PREVIEW (preview)->area,
"check-size", gimp_check_size (),
"check-type", gimp_check_type (),
NULL);
}
static void
gimp_drawable_preview_style_set (GtkWidget *widget,
GtkStyle *prev_style)

View file

@ -465,8 +465,29 @@ _gp_config_read (GIOChannel *channel,
if (! wire_read_int32 (channel,
(guint32 *) &config->shm_ID, 1, user_data))
goto cleanup;
if (! wire_read_double (channel,
&config->gamma, 1, user_data))
if (! wire_read_int8 (channel,
(guint8 *) &config->gimp_reserved_1, 1, user_data))
goto cleanup;
if (! wire_read_int8 (channel,
(guint8 *) &config->gimp_reserved_2, 1, user_data))
goto cleanup;
if (! wire_read_int8 (channel,
(guint8 *) &config->gimp_reserved_3, 1, user_data))
goto cleanup;
if (! wire_read_int8 (channel,
(guint8 *) &config->gimp_reserved_4, 1, user_data))
goto cleanup;
if (! wire_read_int8 (channel,
(guint8 *) &config->gimp_reserved_5, 1, user_data))
goto cleanup;
if (! wire_read_int8 (channel,
(guint8 *) &config->gimp_reserved_6, 1, user_data))
goto cleanup;
if (! wire_read_int8 (channel,
(guint8 *) &config->gimp_reserved_7, 1, user_data))
goto cleanup;
if (! wire_read_int8 (channel,
(guint8 *) &config->gimp_reserved_8, 1, user_data))
goto cleanup;
if (! wire_read_int8 (channel,
(guint8 *) &config->install_cmap, 1, user_data))
@ -474,6 +495,12 @@ _gp_config_read (GIOChannel *channel,
if (! wire_read_int8 (channel,
(guint8 *) &config->show_tool_tips, 1, user_data))
goto cleanup;
if (! wire_read_int8 (channel,
(guint8 *) &config->check_size, 1, user_data))
goto cleanup;
if (! wire_read_int8 (channel,
(guint8 *) &config->check_type, 1, user_data))
goto cleanup;
if (! wire_read_int32 (channel,
(guint32 *) &config->min_colors, 1, user_data))
goto cleanup;
@ -520,12 +547,30 @@ _gp_config_write (GIOChannel *channel,
return;
if (! wire_write_int32 (channel, (guint32*) &config->shm_ID, 1, user_data))
return;
if (! wire_write_double (channel, &config->gamma, 1, user_data))
if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_1, 1, user_data))
return;
if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_2, 1, user_data))
return;
if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_3, 1, user_data))
return;
if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_4, 1, user_data))
return;
if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_5, 1, user_data))
return;
if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_6, 1, user_data))
return;
if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_7, 1, user_data))
return;
if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_8, 1, user_data))
return;
if (! wire_write_int8 (channel, (guint8*) &config->install_cmap, 1, user_data))
return;
if (! wire_write_int8 (channel, (guint8*) &config->show_tool_tips, 1, user_data))
return;
if (! wire_write_int8 (channel, (guint8*) &config->check_size, 1, user_data))
return;
if (! wire_write_int8 (channel, (guint8*) &config->check_type, 1, user_data))
return;
if (! wire_write_int32 (channel, (guint32*) &config->min_colors, 1, user_data))
return;
if (! wire_write_int32 (channel, (guint32*) &config->gdisp_ID, 1, user_data))

View file

@ -66,9 +66,18 @@ struct _GPConfig
guint32 tile_width;
guint32 tile_height;
gint32 shm_ID;
gdouble gamma;
gint8 gimp_reserved_1;
gint8 gimp_reserved_2;
gint8 gimp_reserved_3;
gint8 gimp_reserved_4;
gint8 gimp_reserved_5;
gint8 gimp_reserved_6;
gint8 gimp_reserved_7;
gint8 gimp_reserved_8;
gint8 install_cmap;
gint8 show_tool_tips;
gint8 check_size;
gint8 check_type;
gint32 min_colors;
gint32 gdisp_ID;
gchar *app_name;