|
@@ -214,12 +214,7 @@ NativeWindowViews::NativeWindowViews(const mate::Dictionary& options,
|
|
|
// Set _GTK_THEME_VARIANT to dark if we have "dark-theme" option set.
|
|
|
bool use_dark_theme = false;
|
|
|
if (options.Get(options::kDarkTheme, &use_dark_theme) && use_dark_theme) {
|
|
|
- XDisplay* xdisplay = gfx::GetXDisplay();
|
|
|
- XChangeProperty(xdisplay, GetAcceleratedWidget(),
|
|
|
- XInternAtom(xdisplay, "_GTK_THEME_VARIANT", x11::False),
|
|
|
- XInternAtom(xdisplay, "UTF8_STRING", x11::False), 8,
|
|
|
- PropModeReplace,
|
|
|
- reinterpret_cast<const unsigned char*>("dark"), 4);
|
|
|
+ SetGTKDarkThemeEnabled(use_dark_theme);
|
|
|
}
|
|
|
|
|
|
// Before the window is mapped the SetWMSpecState can not work, so we have
|
|
@@ -330,6 +325,25 @@ NativeWindowViews::~NativeWindowViews() {
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+void NativeWindowViews::SetGTKDarkThemeEnabled(bool use_dark_theme) {
|
|
|
+#if defined(USE_X11)
|
|
|
+ XDisplay* xdisplay = gfx::GetXDisplay();
|
|
|
+ if (use_dark_theme) {
|
|
|
+ XChangeProperty(xdisplay, GetAcceleratedWidget(),
|
|
|
+ XInternAtom(xdisplay, "_GTK_THEME_VARIANT", x11::False),
|
|
|
+ XInternAtom(xdisplay, "UTF8_STRING", x11::False), 8,
|
|
|
+ PropModeReplace,
|
|
|
+ reinterpret_cast<const unsigned char*>("dark"), 4);
|
|
|
+ } else {
|
|
|
+ XChangeProperty(xdisplay, GetAcceleratedWidget(),
|
|
|
+ XInternAtom(xdisplay, "_GTK_THEME_VARIANT", x11::False),
|
|
|
+ XInternAtom(xdisplay, "UTF8_STRING", x11::False), 8,
|
|
|
+ PropModeReplace,
|
|
|
+ reinterpret_cast<const unsigned char*>("light"), 5);
|
|
|
+ }
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
void NativeWindowViews::SetContentView(views::View* view) {
|
|
|
if (content_view()) {
|
|
|
root_view_->RemoveChildView(content_view());
|