depend on GLib >= 2.4.5 and GTK+ >= 2.4.4.

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

	* configure.in: depend on GLib >= 2.4.5 and GTK+ >= 2.4.4.

	* app/gui/gui.c: changed accordingly.

	* app/sanity.c: ditto. Added check for GLib and put each check
	into its own utility function. Enabled #if 0'ed check for
	FreeType >= 6.2.7.

	* app/widgets/gimpactiongroup.c
	* app/widgets/gimpcursor.c
	* app/widgets/gimpselectiondata.c
	* app/widgets/gimpuimanager.c
	* app/widgets/gimpwidgets-utils.c: removed workarounds for library
	versions we refuse to start with.
This commit is contained in:
Michael Natterer
2004-09-16 14:31:39 +00:00
committed by Michael Natterer
parent f338d93835
commit 357dc2d777
9 changed files with 152 additions and 206 deletions

View File

@ -1,3 +1,20 @@
2004-09-16 Michael Natterer <mitch@gimp.org>
* configure.in: depend on GLib >= 2.4.5 and GTK+ >= 2.4.4.
* app/gui/gui.c: changed accordingly.
* app/sanity.c: ditto. Added check for GLib and put each check
into its own utility function. Enabled #if 0'ed check for
FreeType >= 6.2.7.
* app/widgets/gimpactiongroup.c
* app/widgets/gimpcursor.c
* app/widgets/gimpselectiondata.c
* app/widgets/gimpuimanager.c
* app/widgets/gimpwidgets-utils.c: removed workarounds for library
versions we refuse to start with.
2004-09-16 Michael Natterer <mitch@gimp.org> 2004-09-16 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdnd.c (gimp_dnd_uri_list_dest_add): reverse * app/widgets/gimpdnd.c (gimp_dnd_uri_list_dest_add): reverse

View File

@ -31,7 +31,6 @@
#include "config/gimpguiconfig.h" #include "config/gimpguiconfig.h"
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimp-utils.h"
#include "core/gimpcontainer.h" #include "core/gimpcontainer.h"
#include "core/gimpcontext.h" #include "core/gimpcontext.h"
#include "core/gimpenvirontable.h" #include "core/gimpenvirontable.h"
@ -235,18 +234,6 @@ gui_post_init (Gimp *gimp)
gimp_dialog_factory_dialog_new (global_dialog_factory, gimp_dialog_factory_dialog_new (global_dialog_factory,
gdk_screen_get_default (), gdk_screen_get_default (),
"gimp-tips-dialog", -1, TRUE); "gimp-tips-dialog", -1, TRUE);
if (gimp_check_glib_version (2, 4, 4) == NULL &&
gimp_check_glib_version (2, 4, 5) != NULL)
{
g_message ("You are using GLib version 2.4.4.\n\n"
"This version of GLib contains a bug "
"affecting filename conversions. "
"The GIMP won't be able to open any file "
"with non-ASCII characters (e.g. umlauts) "
"in its filename.\n\n"
"Please upgrade to GLib 2.4.5 or newer.");
}
} }
@ -259,7 +246,7 @@ gui_sanity_check (void)
#define GTK_REQUIRED_MAJOR 2 #define GTK_REQUIRED_MAJOR 2
#define GTK_REQUIRED_MINOR 4 #define GTK_REQUIRED_MINOR 4
#define GTK_REQUIRED_MICRO 1 #define GTK_REQUIRED_MICRO 4
mismatch = gtk_check_version (GTK_REQUIRED_MAJOR, mismatch = gtk_check_version (GTK_REQUIRED_MAJOR,
GTK_REQUIRED_MINOR, GTK_REQUIRED_MINOR,

View File

@ -24,19 +24,79 @@
#include "libgimpbase/gimpenv.h" #include "libgimpbase/gimpenv.h"
#include "core/gimp-utils.h"
#include "sanity.h" #include "sanity.h"
#include "gimp-intl.h" #include "gimp-intl.h"
static gchar * sanity_check_filename_encoding (void); static gchar * sanity_check_glib (void);
static gchar * sanity_check_fontconfig (void);
static gchar * sanity_check_freetype (void);
static gchar * sanity_check_filename_encoding (void);
/* public functions */
const gchar * const gchar *
sanity_check (void) sanity_check (void)
{ {
gchar *abort_message = NULL; gchar *abort_message = sanity_check_glib ();
if (! abort_message)
abort_message = sanity_check_fontconfig ();
if (! abort_message)
abort_message = sanity_check_freetype ();
if (! abort_message)
abort_message = sanity_check_filename_encoding ();
return abort_message;
}
/* private functions */
static gchar *
sanity_check_glib (void)
{
const gchar *mismatch;
#define GLIB_REQUIRED_MAJOR 2
#define GLIB_REQUIRED_MINOR 4
#define GLIB_REQUIRED_MICRO 5
mismatch = gimp_check_glib_version (GLIB_REQUIRED_MAJOR,
GLIB_REQUIRED_MINOR,
GLIB_REQUIRED_MICRO);
if (mismatch)
{
return g_strdup_printf
("%s\n\n"
"The GIMP requires GLib+ version %d.%d.%d or later.\n"
"Installed GLib+ version is %d.%d.%d.\n\n"
"Somehow you or your software packager managed\n"
"to install The GIMP with an older GLib+ version.\n\n"
"Please upgrade to GLib+ version %d.%d.%d or later.",
mismatch,
GLIB_REQUIRED_MAJOR, GLIB_REQUIRED_MINOR, GLIB_REQUIRED_MICRO,
glib_major_version, glib_minor_version, glib_micro_version,
GLIB_REQUIRED_MAJOR, GLIB_REQUIRED_MINOR, GLIB_REQUIRED_MICRO);
}
#undef GLIB_REQUIRED_MAJOR
#undef GLIB_REQUIRED_MINOR
#undef GLIB_REQUIRED_MICRO
return NULL;
}
static gchar *
sanity_check_fontconfig (void)
{
gint fc_version = FcGetVersion (); gint fc_version = FcGetVersion ();
gint fc_major_version = fc_version / 100 / 100; gint fc_major_version = fc_version / 100 / 100;
gint fc_minor_version = fc_version / 100 % 100; gint fc_minor_version = fc_version / 100 % 100;
@ -50,8 +110,7 @@ sanity_check (void)
(FC_REQUIRED_MINOR * 100) + (FC_REQUIRED_MINOR * 100) +
(FC_REQUIRED_MICRO * 1))) (FC_REQUIRED_MICRO * 1)))
{ {
abort_message = return g_strdup_printf
g_strdup_printf
("The Fontconfig version being used is too old!\n\n" ("The Fontconfig version being used is too old!\n\n"
"The GIMP requires Fontconfig version %d.%d.%d or later.\n" "The GIMP requires Fontconfig version %d.%d.%d or later.\n"
"The Fontconfig version loaded by The GIMP is %d.%d.%d.\n\n" "The Fontconfig version loaded by The GIMP is %d.%d.%d.\n\n"
@ -66,18 +125,17 @@ sanity_check (void)
#undef FC_REQUIRED_MINOR #undef FC_REQUIRED_MINOR
#undef FC_REQUIRED_MICRO #undef FC_REQUIRED_MICRO
return NULL;
}
#if 0 static gchar *
/* disabled until we definitely figured if and how freetype causes sanity_check_freetype (void)
* some of these windows dll hell bugs {
*/ FT_Library ft_library;
if (! abort_message) FT_Int ft_major_version;
{ FT_Int ft_minor_version;
FT_Library ft_library; FT_Int ft_micro_version;
FT_Int ft_major_version; FT_Int ft_version;
FT_Int ft_minor_version;
FT_Int ft_micro_version;
FT_Int ft_version;
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
#define FT_REQUIRED_MAJOR 2 #define FT_REQUIRED_MAJOR 2
@ -89,52 +147,44 @@ sanity_check (void)
#define FT_REQUIRED_MICRO 7 #define FT_REQUIRED_MICRO 7
#endif #endif
if (FT_Init_FreeType (&ft_library) != 0) if (FT_Init_FreeType (&ft_library) != 0)
g_error ("FT_Init_FreeType() failed"); g_error ("FT_Init_FreeType() failed");
FT_Library_Version (ft_library, FT_Library_Version (ft_library,
&ft_major_version, &ft_major_version,
&ft_minor_version, &ft_minor_version,
&ft_micro_version); &ft_micro_version);
if (FT_Done_FreeType (ft_library) != 0) if (FT_Done_FreeType (ft_library) != 0)
g_error ("FT_Done_FreeType() failed"); g_error ("FT_Done_FreeType() failed");
ft_version = (ft_major_version * 10000 + ft_version = (ft_major_version * 10000 +
ft_minor_version * 100 + ft_minor_version * 100 +
ft_micro_version * 1); ft_micro_version * 1);
if (ft_version < ((FT_REQUIRED_MAJOR * 10000) +
(FT_REQUIRED_MINOR * 100) +
(FT_REQUIRED_MICRO * 1)))
{
abort_message =
g_strdup_printf
("FreeType version too old!\n\n"
"The GIMP requires FreeType version %d.%d.%d or later.\n"
"Installed FreeType version is %d.%d.%d.\n\n"
"Somehow you or your software packager managed\n"
"to install The GIMP with an older FreeType version.\n\n"
"Please upgrade to FreeType version %d.%d.%d or later.",
FT_REQUIRED_MAJOR, FT_REQUIRED_MINOR, FT_REQUIRED_MICRO,
ft_major_version, ft_minor_version, ft_micro_version,
FT_REQUIRED_MAJOR, FT_REQUIRED_MINOR, FT_REQUIRED_MICRO);
}
if (ft_version < ((FT_REQUIRED_MAJOR * 10000) +
(FT_REQUIRED_MINOR * 100) +
(FT_REQUIRED_MICRO * 1)))
{
return g_strdup_printf
("FreeType version too old!\n\n"
"The GIMP requires FreeType version %d.%d.%d or later.\n"
"Installed FreeType version is %d.%d.%d.\n\n"
"Somehow you or your software packager managed\n"
"to install The GIMP with an older FreeType version.\n\n"
"Please upgrade to FreeType version %d.%d.%d or later.",
FT_REQUIRED_MAJOR, FT_REQUIRED_MINOR, FT_REQUIRED_MICRO,
ft_major_version, ft_minor_version, ft_micro_version,
FT_REQUIRED_MAJOR, FT_REQUIRED_MINOR, FT_REQUIRED_MICRO);
}
#undef FT_REQUIRED_MAJOR #undef FT_REQUIRED_MAJOR
#undef FT_REQUIRED_MINOR #undef FT_REQUIRED_MINOR
#undef FT_REQUIRED_MICRO #undef FT_REQUIRED_MICRO
}
#endif
if (! abort_message) return NULL;
abort_message = sanity_check_filename_encoding ();
return abort_message;
} }
static gchar * static gchar *
sanity_check_filename_encoding (void) sanity_check_filename_encoding (void)
{ {

View File

@ -395,17 +395,9 @@ gimp_action_group_add_actions (GimpActionGroup *group,
entries[i].callback, entries[i].callback,
group->user_data); group->user_data);
#ifdef __GNUC__ gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
#warning FIXME: remove this hack as soon as we depend on GTK+ 2.4.3 GTK_ACTION (action),
#endif entries[i].accelerator);
if (entries[i].accelerator && ! entries[i].accelerator[0] &&
gtk_check_version (2, 4, 3))
gtk_action_group_add_action (GTK_ACTION_GROUP (group),
GTK_ACTION (action));
else
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].help_id) if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID, g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
@ -450,17 +442,9 @@ gimp_action_group_add_toggle_actions (GimpActionGroup *group,
entries[i].callback, entries[i].callback,
group->user_data); group->user_data);
#ifdef __GNUC__ gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
#warning FIXME: remove this hack as soon as we depend on GTK+ 2.4.3 GTK_ACTION (action),
#endif entries[i].accelerator);
if (entries[i].accelerator && ! entries[i].accelerator[0] &&
gtk_check_version (2, 4, 3))
gtk_action_group_add_action (GTK_ACTION_GROUP (group),
GTK_ACTION (action));
else
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].help_id) if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID, g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
@ -512,17 +496,9 @@ gimp_action_group_add_radio_actions (GimpActionGroup *group,
if (value == entries[i].value) if (value == entries[i].value)
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
#ifdef __GNUC__ gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
#warning FIXME: remove this hack as soon as we depend on GTK+ 2.4.3 GTK_ACTION (action),
#endif entries[i].accelerator);
if (entries[i].accelerator && ! entries[i].accelerator[0] &&
gtk_check_version (2, 4, 3))
gtk_action_group_add_action (GTK_ACTION_GROUP (group),
GTK_ACTION (action));
else
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].help_id) if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID, g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
@ -572,17 +548,9 @@ gimp_action_group_add_enum_actions (GimpActionGroup *group,
callback, callback,
group->user_data); group->user_data);
#ifdef __GNUC__ gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
#warning FIXME: remove this hack as soon as we depend on GTK+ 2.4.3 GTK_ACTION (action),
#endif entries[i].accelerator);
if (entries[i].accelerator && ! entries[i].accelerator[0] &&
gtk_check_version (2, 4, 3))
gtk_action_group_add_action (GTK_ACTION_GROUP (group),
GTK_ACTION (action));
else
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].help_id) if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID, g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
@ -627,17 +595,9 @@ gimp_action_group_add_string_actions (GimpActionGroup *group,
callback, callback,
group->user_data); group->user_data);
#ifdef __GNUC__ gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
#warning FIXME: remove this hack as soon as we depend on GTK+ 2.4.3 GTK_ACTION (action),
#endif entries[i].accelerator);
if (entries[i].accelerator && ! entries[i].accelerator[0] &&
gtk_check_version (2, 4, 3))
gtk_action_group_add_action (GTK_ACTION_GROUP (group),
GTK_ACTION (action));
else
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].help_id) if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID, g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
@ -682,17 +642,9 @@ gimp_action_group_add_plug_in_actions (GimpActionGroup *group,
callback, callback,
group->user_data); group->user_data);
#ifdef __GNUC__ gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
#warning FIXME: remove this hack as soon as we depend on GTK+ 2.4.3 GTK_ACTION (action),
#endif entries[i].accelerator);
if (entries[i].accelerator && ! entries[i].accelerator[0] &&
gtk_check_version (2, 4, 3))
gtk_action_group_add_action (GTK_ACTION_GROUP (group),
GTK_ACTION (action));
else
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].help_id) if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID, g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,

View File

@ -581,34 +581,6 @@ gimp_cursor_new (GdkDisplay *display,
0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0,
GDK_INTERP_NEAREST, 200); GDK_INTERP_NEAREST, 200);
#ifdef __GNUC__
#warning FIXME: remove this hack as soon as we depend on GTK+ 2.4.4
#endif
/* premultiply the cursor pixels manually for GTK+ < 2.4.4 */
if (gtk_check_version (2, 4, 4))
{
guint rowstride;
guchar *pixels, *p;
gint x, y;
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
pixels = gdk_pixbuf_get_pixels (pixbuf);
for (y = 0; y < height; y++)
{
p = pixels + y * rowstride;
for (x = 0; x < width; x++)
{
p[0] = (p[0] * p[3]) >> 8;
p[1] = (p[1] * p[3]) >> 8;
p[2] = (p[2] * p[3]) >> 8;
p += 4;
}
}
}
cursor = gdk_cursor_new_from_pixbuf (display, pixbuf, cursor = gdk_cursor_new_from_pixbuf (display, pixbuf,
bmcursor->x_hot, bmcursor->x_hot,
bmcursor->y_hot); bmcursor->y_hot);

View File

@ -28,7 +28,6 @@
#include "widgets-types.h" #include "widgets-types.h"
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimp-utils.h"
#include "core/gimpbrush.h" #include "core/gimpbrush.h"
#include "core/gimpcontainer.h" #include "core/gimpcontainer.h"
#include "core/gimpdatafactory.h" #include "core/gimpdatafactory.h"
@ -182,7 +181,6 @@ gimp_selection_data_get_uri_list (GtkSelectionData *selection)
GList *uri_list = NULL; GList *uri_list = NULL;
GList *list; GList *list;
gchar *buffer; gchar *buffer;
gboolean file_uris_are_utf8;
g_return_val_if_fail (selection != NULL, NULL); g_return_val_if_fail (selection != NULL, NULL);
@ -226,9 +224,6 @@ gimp_selection_data_get_uri_list (GtkSelectionData *selection)
if (! crap_list) if (! crap_list)
return NULL; return NULL;
file_uris_are_utf8 = (gimp_check_glib_version (2, 4, 0) == NULL &&
gimp_check_glib_version (2, 4, 4) != NULL);
/* do various checks because file drag sources send all kinds of /* do various checks because file drag sources send all kinds of
* arbitrary crap... * arbitrary crap...
*/ */
@ -288,26 +283,23 @@ gimp_selection_data_get_uri_list (GtkSelectionData *selection)
if (strstr (dnd_crap, "%")) if (strstr (dnd_crap, "%"))
{ {
gchar *local_filename;
unescaped_filename = gimp_unescape_uri_string (start, -1, unescaped_filename = gimp_unescape_uri_string (start, -1,
"/", FALSE); "/", FALSE);
if (! file_uris_are_utf8) /* check if we got a drop from an application that
* encodes file: URIs as UTF-8 (apps linked against
* GLib < 2.4.4)
*/
local_filename = g_filename_from_utf8 (unescaped_filename,
-1, NULL, NULL,
NULL);
if (local_filename)
{ {
/* if we run with a GLib that correctly encodes g_free (unescaped_filename);
* file: URIs, we still may get a drop from an unescaped_filename = local_filename;
* application that encodes file: URIs as UTF-8
*/
gchar *local_filename;
local_filename = g_filename_from_utf8 (unescaped_filename,
-1, NULL, NULL,
NULL);
if (local_filename)
{
g_free (unescaped_filename);
unescaped_filename = local_filename;
}
} }
} }
else else

View File

@ -147,11 +147,7 @@ gimp_ui_manager_class_init (GimpUIManagerClass *klass)
object_class->set_property = gimp_ui_manager_set_property; object_class->set_property = gimp_ui_manager_set_property;
object_class->get_property = gimp_ui_manager_get_property; object_class->get_property = gimp_ui_manager_get_property;
#ifdef __GNUC__ manager_class->connect_proxy = gimp_ui_manager_connect_proxy;
#warning FIXME: remove version check as soon as we depend on GTK+ 2.4.2
#endif
if (! gtk_check_version (2, 4, 2))
manager_class->connect_proxy = gimp_ui_manager_connect_proxy;
klass->update = gimp_ui_manager_real_update; klass->update = gimp_ui_manager_real_update;
@ -188,14 +184,6 @@ gimp_ui_manager_init (GimpUIManager *manager)
{ {
manager->name = NULL; manager->name = NULL;
manager->gimp = NULL; manager->gimp = NULL;
#ifdef __GNUC__
#warning FIXME: remove this hack as soon as we depend on GTK+ 2.4.2
#endif
if (gtk_check_version (2, 4, 2))
g_signal_connect (manager, "connect-proxy",
G_CALLBACK (gimp_ui_manager_connect_proxy),
NULL);
} }
static GObject * static GObject *

View File

@ -77,12 +77,6 @@ gimp_menu_position (GtkMenu *menu,
gtk_menu_set_screen (menu, screen); gtk_menu_set_screen (menu, screen);
#ifdef __GNUC__
#warning FIXME: remove this hack as soon as we depend on GTK+ 2.4.4
#endif
if (gtk_check_version (2, 4, 4))
gtk_menu_set_monitor (menu, monitor);
gtk_widget_size_request (widget, &requisition); gtk_widget_size_request (widget, &requisition);
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
@ -156,12 +150,6 @@ gimp_button_menu_position (GtkWidget *button,
gtk_menu_set_screen (menu, screen); gtk_menu_set_screen (menu, screen);
#ifdef __GNUC__
#warning FIXME: remove this hack as soon as we depend on GTK+ 2.4.4
#endif
if (gtk_check_version (2, 4, 4))
gtk_menu_set_monitor (menu, monitor);
*x += button->allocation.x; *x += button->allocation.x;
switch (position) switch (position)

View File

@ -43,8 +43,8 @@ m4_define([gimp_stable],
m4_define([gimp_full_name], [The GIMP]) m4_define([gimp_full_name], [The GIMP])
# required versions of other packages # required versions of other packages
m4_define([glib_required_version], [2.4.0]) m4_define([glib_required_version], [2.4.5])
m4_define([gtk_required_version], [2.4.1]) m4_define([gtk_required_version], [2.4.4])
m4_define([gdk_pixbuf_required_version], [gtk_required_version]) m4_define([gdk_pixbuf_required_version], [gtk_required_version])
m4_define([pangoft2_required_version], [1.4.0]) m4_define([pangoft2_required_version], [1.4.0])
m4_define([fontconfig_required_version], [2.2.0]) m4_define([fontconfig_required_version], [2.2.0])