fix: get background color from GtkMenuBar#menubar (#14785)

* fix: get background color from GtkMenuBar#menubar

* expose libgtkui::GetBgColor
This commit is contained in:
Shelley Vohr 2018-09-25 13:57:06 -07:00 committed by GitHub
parent 18c2574350
commit c9bc3471e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View file

@ -5,6 +5,7 @@
#include "atom/browser/ui/views/menu_bar.h"
#include <memory>
#include <string>
#include "atom/browser/ui/views/menu_delegate.h"
#include "atom/browser/ui/views/submenu_button.h"
@ -12,6 +13,10 @@
#include "ui/views/background.h"
#include "ui/views/layout/box_layout.h"
#if defined(USE_X11)
#include "chrome/browser/ui/libgtkui/gtk_util.h"
#endif
#if defined(OS_WIN)
#include "ui/gfx/color_utils.h"
#endif
@ -123,13 +128,17 @@ void MenuBar::RefreshColorCache(const ui::NativeTheme* theme) {
if (!theme)
theme = ui::NativeTheme::GetInstanceForNativeUi();
if (theme) {
background_color_ =
theme->GetSystemColor(ui::NativeTheme::kColorId_MenuBackgroundColor);
#if defined(USE_X11)
const std::string menubar_selector = "GtkMenuBar#menubar";
background_color_ = libgtkui::GetBgColor(menubar_selector);
enabled_color_ = theme->GetSystemColor(
ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor);
disabled_color_ = theme->GetSystemColor(
ui::NativeTheme::kColorId_DisabledMenuItemForegroundColor);
#else
background_color_ =
theme->GetSystemColor(ui::NativeTheme::kColorId_MenuBackgroundColor);
#endif
}
#if defined(OS_WIN)