--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -24,59 +24,50 @@
#include "nsStyleConsts.h"
#include "gfxFontConstants.h"
#include "WidgetUtils.h"
#include <dlfcn.h>
#include "mozilla/gfx/2D.h"
-#if MOZ_WIDGET_GTK != 2
#include <cairo-gobject.h>
#include "WidgetStyleCache.h"
#include "prenv.h"
-#endif
using mozilla::LookAndFeel;
#define GDK_COLOR_TO_NS_RGB(c) \
((nscolor) NS_RGB(c.red>>8, c.green>>8, c.blue>>8))
#define GDK_RGBA_TO_NS_RGBA(c) \
((nscolor) NS_RGBA((int)((c).red*255), (int)((c).green*255), \
(int)((c).blue*255), (int)((c).alpha*255)))
#if !GTK_CHECK_VERSION(3,12,0)
#define GTK_STATE_FLAG_LINK (static_cast<GtkStateFlags>(1 << 9))
#endif
nsLookAndFeel::nsLookAndFeel()
: nsXPLookAndFeel(),
-#if (MOZ_WIDGET_GTK == 2)
- mStyle(nullptr),
-#endif
mDefaultFontCached(false), mButtonFontCached(false),
mFieldFontCached(false), mMenuFontCached(false),
mInitialized(false)
{
}
void
nsLookAndFeel::NativeInit()
{
EnsureInit();
}
nsLookAndFeel::~nsLookAndFeel()
{
-#if (MOZ_WIDGET_GTK == 2)
- g_object_unref(mStyle);
-#endif
}
-#if MOZ_WIDGET_GTK != 2
// Modifies color |*aDest| as if a pattern of color |aSource| was painted with
// CAIRO_OPERATOR_OVER to a surface with color |*aDest|.
static void
ApplyColorOver(const GdkRGBA& aSource, GdkRGBA* aDest) {
gdouble sourceCoef = aSource.alpha;
gdouble destCoef = aDest->alpha * (1.0 - sourceCoef);
gdouble resultAlpha = sourceCoef + destCoef;
if (resultAlpha != 0.0) { // don't divide by zero
@@ -223,52 +214,29 @@ GetBorderColors(GtkStyleContext* aContex
nscolor* aLightColor, nscolor* aDarkColor)
{
GdkRGBA lightColor, darkColor;
bool ret = GetBorderColors(aContext, &lightColor, &darkColor);
*aLightColor = GDK_RGBA_TO_NS_RGBA(lightColor);
*aDarkColor = GDK_RGBA_TO_NS_RGBA(darkColor);
return ret;
}
-#endif
nsresult
nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
{
EnsureInit();
-#if (MOZ_WIDGET_GTK == 3)
GdkRGBA gdk_color;
-#endif
nsresult res = NS_OK;
switch (aID) {
// These colors don't seem to be used for anything anymore in Mozilla
// (except here at least TextSelectBackground and TextSelectForeground)
// The CSS2 colors below are used.
-#if (MOZ_WIDGET_GTK == 2)
- case eColorID_WindowBackground:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_NORMAL]);
- break;
- case eColorID_WindowForeground:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_NORMAL]);
- break;
- case eColorID_WidgetBackground:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
- case eColorID_WidgetForeground:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_NORMAL]);
- break;
- case eColorID_WidgetSelectBackground:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_SELECTED]);
- break;
- case eColorID_WidgetSelectForeground:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_SELECTED]);
- break;
-#else
case eColorID_WindowBackground:
case eColorID_WidgetBackground:
case eColorID_TextBackground:
case eColorID_activecaption: // active window caption background
case eColorID_appworkspace: // MDI background color
case eColorID_background: // desktop background
case eColorID_window:
case eColorID_windowframe:
@@ -298,45 +266,22 @@ nsLookAndFeel::NativeGetColor(ColorID aI
case eColorID_TextSelectForeground:
case eColorID_IMESelectedRawTextForeground:
case eColorID_IMESelectedConvertedTextForeground:
case eColorID_highlighttext:
case eColorID__moz_cellhighlighttext:
case eColorID__moz_html_cellhighlighttext:
aColor = sTextSelectedText;
break;
-#endif
case eColorID_Widget3DHighlight:
aColor = NS_RGB(0xa0,0xa0,0xa0);
break;
case eColorID_Widget3DShadow:
aColor = NS_RGB(0x40,0x40,0x40);
break;
-#if (MOZ_WIDGET_GTK == 2)
- case eColorID_TextBackground:
- // not used?
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_NORMAL]);
- break;
- case eColorID_TextForeground:
- // not used?
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_NORMAL]);
- break;
- case eColorID_TextSelectBackground:
- case eColorID_IMESelectedRawTextBackground:
- case eColorID_IMESelectedConvertedTextBackground:
- // still used
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_SELECTED]);
- break;
- case eColorID_TextSelectForeground:
- case eColorID_IMESelectedRawTextForeground:
- case eColorID_IMESelectedConvertedTextForeground:
- // still used
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_SELECTED]);
- break;
-#endif
case eColorID_IMERawInputBackground:
case eColorID_IMEConvertedTextBackground:
aColor = NS_TRANSPARENT;
break;
case eColorID_IMERawInputForeground:
case eColorID_IMEConvertedTextForeground:
aColor = NS_SAME_AS_FOREGROUND_COLOR;
break;
@@ -347,63 +292,16 @@ nsLookAndFeel::NativeGetColor(ColorID aI
case eColorID_IMESelectedRawTextUnderline:
case eColorID_IMESelectedConvertedTextUnderline:
aColor = NS_TRANSPARENT;
break;
case eColorID_SpellCheckerUnderline:
aColor = NS_RGB(0xff, 0, 0);
break;
-#if (MOZ_WIDGET_GTK == 2)
- // css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
- case eColorID_activeborder:
- // active window border
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
- case eColorID_activecaption:
- // active window caption background
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
- case eColorID_appworkspace:
- // MDI background color
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
- case eColorID_background:
- // desktop background
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
- case eColorID_captiontext:
- // text in active window caption, size box, and scrollbar arrow box (!)
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_NORMAL]);
- break;
- case eColorID_graytext:
- // disabled text in windows, menus, etc.
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_INSENSITIVE]);
- break;
- case eColorID_highlight:
- // background of selected item
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_SELECTED]);
- break;
- case eColorID_highlighttext:
- // text of selected item
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_SELECTED]);
- break;
- case eColorID_inactiveborder:
- // inactive window border
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
- case eColorID_inactivecaption:
- // inactive window caption
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_INSENSITIVE]);
- break;
- case eColorID_inactivecaptiontext:
- // text in inactive window caption
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_INSENSITIVE]);
- break;
-#else
// css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
case eColorID_activeborder: {
// active window border
GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_WINDOW);
gtk_style_context_get_border_color(style,
GTK_STATE_FLAG_NORMAL, &gdk_color);
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
ReleaseStyleContext(style);
@@ -428,17 +326,16 @@ nsLookAndFeel::NativeGetColor(ColorID aI
GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_WINDOW);
gtk_style_context_get_background_color(style,
GTK_STATE_FLAG_INSENSITIVE,
&gdk_color);
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
ReleaseStyleContext(style);
break;
}
-#endif
case eColorID_infobackground:
// tooltip background color
aColor = sInfoBackground;
break;
case eColorID_infotext:
// tooltip text color
aColor = sInfoText;
break;
@@ -447,34 +344,26 @@ nsLookAndFeel::NativeGetColor(ColorID aI
aColor = sMenuBackground;
break;
case eColorID_menutext:
// menu text
aColor = sMenuText;
break;
case eColorID_scrollbar:
// scrollbar gray area
-#if (MOZ_WIDGET_GTK == 2)
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_ACTIVE]);
-#else
aColor = sMozScrollbar;
-#endif
break;
case eColorID_threedlightshadow:
// 3-D highlighted inner edge color
// always same as background in GTK code
case eColorID_threedface:
case eColorID_buttonface:
// 3-D face color
-#if (MOZ_WIDGET_GTK == 3)
aColor = sMozWindowBackground;
-#else
- aColor = sButtonBackground;
-#endif
break;
case eColorID_buttontext:
// text on push buttons
aColor = sButtonText;
break;
case eColorID_buttonhighlight:
@@ -486,66 +375,16 @@ nsLookAndFeel::NativeGetColor(ColorID aI
case eColorID_buttonshadow:
// 3-D shadow edge color
case eColorID_threedshadow:
// 3-D shadow inner edge color
aColor = sFrameInnerDarkBorder;
break;
-#if (MOZ_WIDGET_GTK == 2)
- case eColorID_threeddarkshadow:
- // 3-D shadow outer edge color
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->black);
- break;
-
- case eColorID_window:
- case eColorID_windowframe:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
-
- case eColorID_windowtext:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_NORMAL]);
- break;
-
- case eColorID__moz_eventreerow:
- case eColorID__moz_field:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_NORMAL]);
- break;
- case eColorID__moz_fieldtext:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_NORMAL]);
- break;
- case eColorID__moz_dialog:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
- case eColorID__moz_dialogtext:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_NORMAL]);
- break;
- case eColorID__moz_dragtargetzone:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_SELECTED]);
- break;
- case eColorID__moz_buttondefault:
- // default button border color
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->black);
- break;
- case eColorID__moz_buttonhoverface:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_PRELIGHT]);
- break;
- case eColorID__moz_buttonhovertext:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_PRELIGHT]);
- break;
- case eColorID__moz_cellhighlight:
- case eColorID__moz_html_cellhighlight:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_ACTIVE]);
- break;
- case eColorID__moz_cellhighlighttext:
- case eColorID__moz_html_cellhighlighttext:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_ACTIVE]);
- break;
-#else
case eColorID_threeddarkshadow:
// Hardcode to black
aColor = NS_RGB(0x00,0x00,0x00);
break;
case eColorID__moz_eventreerow:
case eColorID__moz_field:
aColor = sMozFieldBackground;
@@ -569,81 +408,50 @@ nsLookAndFeel::NativeGetColor(ColorID aI
&gdk_color);
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
ReleaseStyleContext(style);
break;
}
case eColorID__moz_buttonhovertext:
aColor = sButtonHoverText;
break;
-#endif
case eColorID__moz_menuhover:
aColor = sMenuHover;
break;
case eColorID__moz_menuhovertext:
aColor = sMenuHoverText;
break;
case eColorID__moz_oddtreerow:
aColor = sOddCellBackground;
break;
case eColorID__moz_nativehyperlinktext:
aColor = sNativeHyperLinkText;
break;
case eColorID__moz_comboboxtext:
aColor = sComboBoxText;
break;
-#if (MOZ_WIDGET_GTK == 2)
- case eColorID__moz_combobox:
- aColor = sComboBoxBackground;
- break;
-#endif
case eColorID__moz_menubartext:
aColor = sMenuBarText;
break;
case eColorID__moz_menubarhovertext:
aColor = sMenuBarHoverText;
break;
case eColorID__moz_gtk_info_bar_text:
-#if (MOZ_WIDGET_GTK == 3)
aColor = sInfoBarText;
-#else
- aColor = sInfoText;
-#endif
break;
default:
/* default color is BLACK */
aColor = 0;
res = NS_ERROR_FAILURE;
break;
}
return res;
}
-#if (MOZ_WIDGET_GTK == 2)
-static void darken_gdk_color(GdkColor *src, GdkColor *dest)
-{
- gdouble red;
- gdouble green;
- gdouble blue;
-
- red = (gdouble) src->red / 65535.0;
- green = (gdouble) src->green / 65535.0;
- blue = (gdouble) src->blue / 65535.0;
-
- red *= 0.93;
- green *= 0.93;
- blue *= 0.93;
-
- dest->red = red * 65535.0;
- dest->green = green * 65535.0;
- dest->blue = blue * 65535.0;
-}
-#endif
-
static int32_t CheckWidgetStyle(GtkWidget* aWidget, const char* aStyle, int32_t aResult) {
gboolean value = FALSE;
gtk_widget_style_get(aWidget, aStyle, &value, nullptr);
return value ? aResult : 0;
}
static int32_t ConvertGTKStepperStyleToMozillaScrollArrowStyle(GtkWidget* aWidget)
{
@@ -821,24 +629,18 @@ nsLookAndFeel::GetIntImpl(IntID aID, int
case eIntID_WindowsClassic:
case eIntID_WindowsDefaultTheme:
case eIntID_WindowsThemeIdentifier:
case eIntID_OperatingSystemVersionIdentifier:
aResult = 0;
res = NS_ERROR_NOT_IMPLEMENTED;
break;
case eIntID_TouchEnabled:
-#if MOZ_WIDGET_GTK == 3
aResult = mozilla::widget::WidgetUtils::IsTouchDeviceSupportPresent();
break;
-#else
- aResult = 0;
- res = NS_ERROR_NOT_IMPLEMENTED;
-#endif
- break;
case eIntID_MacGraphiteTheme:
aResult = 0;
res = NS_ERROR_NOT_IMPLEMENTED;
break;
case eIntID_AlertNotificationOrigin:
aResult = NS_ALERT_TOP;
break;
case eIntID_IMERawInputUnderlineStyle:
@@ -1082,80 +884,16 @@ nsLookAndFeel::EnsureInit()
if (mInitialized)
return;
mInitialized = true;
// gtk does non threadsafe refcounting
MOZ_ASSERT(NS_IsMainThread());
-#if (MOZ_WIDGET_GTK == 2)
- NS_ASSERTION(!mStyle, "already initialized");
- // GtkInvisibles come with a refcount that is not floating
- // (since their initialization code calls g_object_ref_sink) and
- // their destroy code releases that reference (which means they
- // have to be explicitly destroyed, since calling unref enough
- // to cause destruction would lead to *another* unref).
- // However, this combination means that it's actually still ok
- // to use the normal pattern, which is to g_object_ref_sink
- // after construction, and then destroy *and* unref when we're
- // done. (Though we could skip the g_object_ref_sink and the
- // corresponding g_object_unref, but that's particular to
- // GtkInvisibles and GtkWindows.)
- GtkWidget *widget = gtk_invisible_new();
- g_object_ref_sink(widget); // effectively g_object_ref (see above)
-
- gtk_widget_ensure_style(widget);
- mStyle = gtk_style_copy(gtk_widget_get_style(widget));
-
- gtk_widget_destroy(widget);
- g_object_unref(widget);
-
- // tooltip foreground and background
- GtkStyle *style = gtk_rc_get_style_by_paths(gtk_settings_get_default(),
- "gtk-tooltips", "GtkWindow",
- GTK_TYPE_WINDOW);
- if (style) {
- sInfoBackground = GDK_COLOR_TO_NS_RGB(style->bg[GTK_STATE_NORMAL]);
- sInfoText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_NORMAL]);
- }
-
- // menu foreground & menu background
- GtkWidget *accel_label = gtk_accel_label_new("M");
- GtkWidget *menuitem = gtk_menu_item_new();
- GtkWidget *menu = gtk_menu_new();
-
- g_object_ref_sink(menu);
-
- gtk_container_add(GTK_CONTAINER(menuitem), accel_label);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
-
- gtk_widget_set_style(accel_label, nullptr);
- gtk_widget_set_style(menu, nullptr);
- gtk_widget_realize(menu);
- gtk_widget_realize(accel_label);
-
- style = gtk_widget_get_style(accel_label);
- if (style) {
- sMenuText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_NORMAL]);
- }
-
- style = gtk_widget_get_style(menu);
- if (style) {
- sMenuBackground = GDK_COLOR_TO_NS_RGB(style->bg[GTK_STATE_NORMAL]);
- }
-
- style = gtk_widget_get_style(menuitem);
- if (style) {
- sMenuHover = GDK_COLOR_TO_NS_RGB(style->bg[GTK_STATE_PRELIGHT]);
- sMenuHoverText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_PRELIGHT]);
- }
-
- g_object_unref(menu);
-#else
GdkRGBA color;
GtkStyleContext *style;
// Gtk manages a screen's CSS in the settings object so we
// ask Gtk to create it explicitly. Otherwise we may end up
// with wrong color theme, see Bug 972382
GtkSettings *settings = gtk_settings_get_for_screen(gdk_screen_get_default());
@@ -1238,123 +976,39 @@ nsLookAndFeel::EnsureInit()
ReleaseStyleContext(style);
style = ClaimStyleContext(MOZ_GTK_MENUITEM);
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
sMenuHover = GDK_RGBA_TO_NS_RGBA(color);
gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
sMenuHoverText = GDK_RGBA_TO_NS_RGBA(color);
ReleaseStyleContext(style);
-#endif
// button styles
GtkWidget *parent = gtk_fixed_new();
GtkWidget *button = gtk_button_new();
GtkWidget *label = gtk_label_new("M");
-#if (MOZ_WIDGET_GTK == 2)
- GtkWidget *combobox = gtk_combo_box_new();
- GtkWidget *comboboxLabel = gtk_label_new("M");
- gtk_container_add(GTK_CONTAINER(combobox), comboboxLabel);
-#endif
GtkWidget *window = gtk_window_new(GTK_WINDOW_POPUP);
GtkWidget *treeView = gtk_tree_view_new();
GtkWidget *linkButton = gtk_link_button_new("http://example.com/");
GtkWidget *menuBar = gtk_menu_bar_new();
GtkWidget *menuBarItem = gtk_menu_item_new();
GtkWidget *entry = gtk_entry_new();
GtkWidget *textView = gtk_text_view_new();
gtk_container_add(GTK_CONTAINER(button), label);
gtk_container_add(GTK_CONTAINER(parent), button);
gtk_container_add(GTK_CONTAINER(parent), treeView);
gtk_container_add(GTK_CONTAINER(parent), linkButton);
-#if (MOZ_WIDGET_GTK == 2)
- gtk_container_add(GTK_CONTAINER(parent), combobox);
-#endif
gtk_container_add(GTK_CONTAINER(parent), menuBar);
gtk_menu_shell_append(GTK_MENU_SHELL(menuBar), menuBarItem);
gtk_container_add(GTK_CONTAINER(window), parent);
gtk_container_add(GTK_CONTAINER(parent), entry);
gtk_container_add(GTK_CONTAINER(parent), textView);
-#if (MOZ_WIDGET_GTK == 2)
- gtk_widget_set_style(button, nullptr);
- gtk_widget_set_style(label, nullptr);
- gtk_widget_set_style(treeView, nullptr);
- gtk_widget_set_style(linkButton, nullptr);
- gtk_widget_set_style(combobox, nullptr);
- gtk_widget_set_style(comboboxLabel, nullptr);
- gtk_widget_set_style(menuBar, nullptr);
- gtk_widget_set_style(entry, nullptr);
-
- gtk_widget_realize(button);
- gtk_widget_realize(label);
- gtk_widget_realize(treeView);
- gtk_widget_realize(linkButton);
- gtk_widget_realize(combobox);
- gtk_widget_realize(comboboxLabel);
- gtk_widget_realize(menuBar);
- gtk_widget_realize(entry);
-
- style = gtk_widget_get_style(label);
- if (style) {
- sButtonText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_NORMAL]);
- }
-
- style = gtk_widget_get_style(comboboxLabel);
- if (style) {
- sComboBoxText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_NORMAL]);
- }
- style = gtk_widget_get_style(combobox);
- if (style) {
- sComboBoxBackground = GDK_COLOR_TO_NS_RGB(style->bg[GTK_STATE_NORMAL]);
- }
-
- style = gtk_widget_get_style(menuBar);
- if (style) {
- sMenuBarText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_NORMAL]);
- sMenuBarHoverText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_SELECTED]);
- }
-
- // GTK's guide to fancy odd row background colors:
- // 1) Check if a theme explicitly defines an odd row color
- // 2) If not, check if it defines an even row color, and darken it
- // slightly by a hardcoded value (gtkstyle.c)
- // 3) If neither are defined, take the base background color and
- // darken that by a hardcoded value
- colorValuePtr = nullptr;
- gtk_widget_style_get(treeView,
- "odd-row-color", &colorValuePtr,
- nullptr);
-
- if (colorValuePtr) {
- colorValue = *colorValuePtr;
- } else {
- gtk_widget_style_get(treeView,
- "even-row-color", &colorValuePtr,
- nullptr);
- if (colorValuePtr)
- darken_gdk_color(colorValuePtr, &colorValue);
- else
- darken_gdk_color(&treeView->style->base[GTK_STATE_NORMAL], &colorValue);
- }
-
- sOddCellBackground = GDK_COLOR_TO_NS_RGB(colorValue);
- if (colorValuePtr)
- gdk_color_free(colorValuePtr);
-
- style = gtk_widget_get_style(button);
- if (style) {
- sButtonBackground = GDK_COLOR_TO_NS_RGB(style->bg[GTK_STATE_NORMAL]);
- sFrameOuterLightBorder =
- GDK_COLOR_TO_NS_RGB(style->light[GTK_STATE_NORMAL]);
- sFrameInnerDarkBorder =
- GDK_COLOR_TO_NS_RGB(style->dark[GTK_STATE_NORMAL]);
- }
-#else
// Text colors
GdkRGBA bgColor;
// If the text window background is translucent, then the background of
// the textview root node is visible.
style = ClaimStyleContext(MOZ_GTK_TEXT_VIEW);
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL,
&bgColor);
ReleaseStyleContext(style);
@@ -1441,42 +1095,38 @@ nsLookAndFeel::EnsureInit()
GtkWidget* infoBarContent = gtk_info_bar_get_content_area(GTK_INFO_BAR(infoBar));
GtkWidget* infoBarLabel = gtk_label_new(nullptr);
gtk_container_add(GTK_CONTAINER(parent), infoBar);
gtk_container_add(GTK_CONTAINER(infoBarContent), infoBarLabel);
style = gtk_widget_get_style_context(infoBarLabel);
gtk_style_context_add_class(style, GTK_STYLE_CLASS_INFO);
gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
sInfoBarText = GDK_RGBA_TO_NS_RGBA(color);
-#endif
// Some themes have a unified menu bar, and support window dragging on it
gboolean supports_menubar_drag = FALSE;
GParamSpec *param_spec =
gtk_widget_class_find_style_property(GTK_WIDGET_GET_CLASS(menuBar),
"window-dragging");
if (param_spec) {
if (g_type_is_a(G_PARAM_SPEC_VALUE_TYPE(param_spec), G_TYPE_BOOLEAN)) {
gtk_widget_style_get(menuBar,
"window-dragging", &supports_menubar_drag,
nullptr);
}
}
sMenuSupportsDrag = supports_menubar_drag;
-#if (MOZ_WIDGET_GTK == 3)
if (gtk_check_version(3, 12, 0) == nullptr) {
// TODO: It returns wrong color for themes which
// sets link color for GtkLabel only as we query
// GtkLinkButton style here.
style = gtk_widget_get_style_context(linkButton);
gtk_style_context_get_color(style, GTK_STATE_FLAG_LINK, &color);
sNativeHyperLinkText = GDK_RGBA_TO_NS_RGBA(color);
- } else
-#endif
- {
+ } else {
colorValuePtr = nullptr;
gtk_widget_style_get(linkButton, "link-color", &colorValuePtr, nullptr);
if (colorValuePtr) {
colorValue = *colorValuePtr; // we can't pass deref pointers to GDK_COLOR_TO_NS_RGB
sNativeHyperLinkText = GDK_COLOR_TO_NS_RGB(colorValue);
gdk_color_free(colorValuePtr);
} else {
sNativeHyperLinkText = NS_RGB(0x00,0x00,0xEE);
@@ -1510,20 +1160,15 @@ nsLookAndFeel::RefreshImpl()
nsXPLookAndFeel::RefreshImpl();
moz_gtk_refresh();
mDefaultFontCached = false;
mButtonFontCached = false;
mFieldFontCached = false;
mMenuFontCached = false;
-#if (MOZ_WIDGET_GTK == 2)
- g_object_unref(mStyle);
- mStyle = nullptr;
-#endif
-
mInitialized = false;
}
bool
nsLookAndFeel::GetEchoPasswordImpl() {
return false;
}