Bug 877409 - Remove old GTK_CHECK_VERSION/gtk_check_version for versions of GTK already covered by the minimum GTK build requirement 2.10. r=karlt

This commit is contained in:
Timothy Arceri 2013-05-30 08:10:02 -04:00
Родитель 92aa9f3122
Коммит 32ec2d3fb8
5 изменённых файлов: 36 добавлений и 70 удалений

Просмотреть файл

@ -2610,73 +2610,52 @@ static void MOZ_gdk_display_close(GdkDisplay *display)
g_free(theme_name);
}
// gdk_display_close was broken prior to gtk+-2.10.0.
// (http://bugzilla.gnome.org/show_bug.cgi?id=85715)
// gdk_display_manager_set_default_display (gdk_display_manager_get(), NULL)
// was also broken.
if (gtk_check_version(2,10,0) != NULL) {
#ifdef MOZ_X11
// Version check failed - broken gdk_display_close.
//
// Let the gdk structures leak but at least close the Display,
// assuming that gdk will not use it again.
Display* dpy = GDK_DISPLAY_XDISPLAY(display);
if (!theme_is_qt)
XCloseDisplay(dpy);
#else
gdk_display_close(display);
#endif /* MOZ_X11 */
}
else {
#if CLEANUP_MEMORY
// Get a (new) Pango context that holds a reference to the fontmap that
// GTK has been using. gdk_pango_context_get() must be called while GTK
// has a default display.
PangoContext *pangoContext = gdk_pango_context_get();
// Get a (new) Pango context that holds a reference to the fontmap that
// GTK has been using. gdk_pango_context_get() must be called while GTK
// has a default display.
PangoContext *pangoContext = gdk_pango_context_get();
#endif
bool buggyCairoShutdown = cairo_version() < CAIRO_VERSION_ENCODE(1, 4, 0);
bool buggyCairoShutdown = cairo_version() < CAIRO_VERSION_ENCODE(1, 4, 0);
if (!buggyCairoShutdown) {
// We should shut down GDK before we shut down libraries it depends on
// like Pango and cairo. But if cairo shutdown is buggy, we should
// shut down cairo first otherwise it may crash because of dangling
// references to Display objects (see bug 469831).
if (!theme_is_qt)
gdk_display_close(display);
}
if (!buggyCairoShutdown) {
// We should shut down GDK before we shut down libraries it depends on
// like Pango and cairo. But if cairo shutdown is buggy, we should
// shut down cairo first otherwise it may crash because of dangling
// references to Display objects (see bug 469831).
if (!theme_is_qt)
gdk_display_close(display);
}
#if CLEANUP_MEMORY
// This doesn't take a reference.
PangoFontMap *fontmap = pango_context_get_font_map(pangoContext);
// Do some shutdown of the fontmap, which releases the fonts, clearing a
// bunch of circular references from the fontmap through the fonts back to
// itself. The shutdown that this does is much less than what's done by
// the fontmap's finalize, though.
if (PANGO_IS_FC_FONT_MAP(fontmap))
pango_fc_font_map_shutdown(PANGO_FC_FONT_MAP(fontmap));
g_object_unref(pangoContext);
// PangoCairo still holds a reference to the fontmap.
// Now that we have finished with GTK and Pango, we could unref fontmap,
// which would allow us to call FcFini, but removing what is really
// Pango's ref feels a bit evil. Pango-1.22 will have support for
// pango_cairo_font_map_set_default(NULL), which would release the
// reference on the old fontmap.
// This doesn't take a reference.
PangoFontMap *fontmap = pango_context_get_font_map(pangoContext);
// Do some shutdown of the fontmap, which releases the fonts, clearing a
// bunch of circular references from the fontmap through the fonts back to
// itself. The shutdown that this does is much less than what's done by
// the fontmap's finalize, though.
if (PANGO_IS_FC_FONT_MAP(fontmap))
pango_fc_font_map_shutdown(PANGO_FC_FONT_MAP(fontmap));
g_object_unref(pangoContext);
// PangoCairo still holds a reference to the fontmap.
// Now that we have finished with GTK and Pango, we could unref fontmap,
// which would allow us to call FcFini, but removing what is really
// Pango's ref feels a bit evil. Pango-1.22 will have support for
// pango_cairo_font_map_set_default(NULL), which would release the
// reference on the old fontmap.
#if GTK_CHECK_VERSION(2,8,0)
// cairo_debug_reset_static_data() is prototyped through cairo.h included
// by gtk.h.
// cairo_debug_reset_static_data() is prototyped through cairo.h included
// by gtk.h.
#ifdef cairo_debug_reset_static_data
#error "Looks like we're including Mozilla's cairo instead of system cairo"
#endif
cairo_debug_reset_static_data();
#endif // 2.8.0
cairo_debug_reset_static_data();
#endif // CLEANUP_MEMORY
if (buggyCairoShutdown) {
if (!theme_is_qt)
gdk_display_close(display);
}
if (buggyCairoShutdown) {
if (!theme_is_qt)
gdk_display_close(display);
}
}
#endif // MOZ_WIDGET_GTK2

Просмотреть файл

@ -470,15 +470,10 @@ nsNativeThemeGTK::GetGtkWidgetAndState(uint8_t aWidgetType, nsIFrame* aFrame,
break;
case eTreeSortDirection_Natural:
default:
/* GTK_ARROW_NONE is implemented since GTK 2.10
* This prevents the treecolums from getting smaller
/* This prevents the treecolums from getting smaller
* and wider when switching sort direction off and on
* */
#if GTK_CHECK_VERSION(2,10,0)
*aWidgetFlags = GTK_ARROW_NONE;
#else
return false; // Don't draw when we shouldn't
#endif // GTK_CHECK_VERSION(2,10,0)
break;
}
}

Просмотреть файл

@ -93,11 +93,7 @@ nsScreenGtk :: Init (GdkWindow *aRootWindow)
int format_returned;
int length_returned;
#if GTK_CHECK_VERSION(2,0,0)
GdkAtom cardinal_atom = gdk_x11_xatom_to_atom(XA_CARDINAL);
#else
GdkAtom cardinal_atom = (GdkAtom) XA_CARDINAL;
#endif
gdk_error_trap_push();

Просмотреть файл

@ -89,11 +89,7 @@ nsScreenManagerGtk :: EnsureInit()
if (mCachedScreenArray.Count() > 0)
return NS_OK;
#if GTK_CHECK_VERSION(2,2,0)
mRootWindow = gdk_get_default_root_window();
#else
mRootWindow = GDK_ROOT_PARENT();
#endif // GTK_CHECK_VERSION(2,2,0)
g_object_ref(mRootWindow);
// GDK_STRUCTURE_MASK ==> StructureNotifyMask, for ConfigureNotify

Просмотреть файл

@ -139,7 +139,7 @@ nsFilePickerConstructor(nsISupports *aOuter, REFNSIID aIID,
Preferences::GetBool("ui.allow_platform_file_picker", true);
nsCOMPtr<nsIFilePicker> picker;
if (allowPlatformPicker && gtk_check_version(2,6,3) == NULL) {
if (allowPlatformPicker) {
picker = new nsFilePicker;
} else {
picker = do_CreateInstance(kXULFilePickerCID);