Bug 1414212 - Enable titlebar rendering on Gtk+ >= 3.10, r?jhorak
MozReview-Commit-ID: JFmpa8JyHEl
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -1071,47 +1071,53 @@ nsLookAndFeel::EnsureInit()
nullptr);
GetSystemFontInfo(gtk_widget_get_style_context(entry),
&mFieldFontName, &mFieldFontStyle);
gtk_widget_destroy(window);
g_object_unref(labelWidget);
- // Require GTK 3.20 for client-side decoration support.
- mCSDAvailable = gtk_check_version(3, 20, 0) == nullptr;
+ // Require GTK 3.10 for GtkHeaderBar support.
+ mCSDAvailable = gtk_check_version(3, 10, 0) == nullptr;
if (mCSDAvailable) {
mCSDAvailable =
mozilla::Preferences::GetBool("widget.allow-client-side-decoration",
false);
}
// We need to initialize whole CSD config explicitly because it's queried
// as -moz-gtk* media features.
- mCSDCloseButton = false;
+ mCSDCloseButton = true;
mCSDMaximizeButton = false;
mCSDMinimizeButton = false;
if (mCSDAvailable) {
static auto sGtkHeaderBarGetDecorationLayoutPtr =
(const gchar* (*)(GtkWidget*))
dlsym(RTLD_DEFAULT, "gtk_header_bar_get_decoration_layout");
- GtkWidget* headerBar = GetWidget(MOZ_GTK_HEADER_BAR);
- const gchar* decorationLayout =
- sGtkHeaderBarGetDecorationLayoutPtr(headerBar);
- if (!decorationLayout) {
- g_object_get(settings, "gtk-decoration-layout", &decorationLayout,
- nullptr);
- }
+ if (sGtkHeaderBarGetDecorationLayoutPtr) {
+ GtkWidget* headerBar = GetWidget(MOZ_GTK_HEADER_BAR);
+ const gchar* decorationLayout =
+ sGtkHeaderBarGetDecorationLayoutPtr(headerBar);
+ if (!decorationLayout) {
+ g_object_get(settings, "gtk-decoration-layout",
+ &decorationLayout,
+ nullptr);
+ }
- if (decorationLayout) {
- mCSDCloseButton = (strstr(decorationLayout, "close") != nullptr);
- mCSDMaximizeButton = (strstr(decorationLayout, "maximize") != nullptr);
- mCSDMinimizeButton = (strstr(decorationLayout, "minimize") != nullptr);
+ if (decorationLayout) {
+ mCSDCloseButton =
+ (strstr(decorationLayout, "close") != nullptr);
+ mCSDMaximizeButton =
+ (strstr(decorationLayout, "maximize") != nullptr);
+ mCSDMinimizeButton =
+ (strstr(decorationLayout, "minimize") != nullptr);
+ }
}
}
}
// virtual
char16_t
nsLookAndFeel::GetPasswordCharacterImpl()
{