win: Set native window's background color
This commit is contained in:
parent
6182e4ce81
commit
4a6134f3f7
1 changed files with 13 additions and 4 deletions
|
@ -42,6 +42,7 @@
|
||||||
#elif defined(OS_WIN)
|
#elif defined(OS_WIN)
|
||||||
#include "atom/browser/ui/views/win_frame_view.h"
|
#include "atom/browser/ui/views/win_frame_view.h"
|
||||||
#include "atom/browser/ui/win/atom_desktop_window_tree_host_win.h"
|
#include "atom/browser/ui/win/atom_desktop_window_tree_host_win.h"
|
||||||
|
#include "skia/ext/skia_utils_win.h"
|
||||||
#include "ui/base/win/shell.h"
|
#include "ui/base/win/shell.h"
|
||||||
#include "ui/gfx/win/dpi.h"
|
#include "ui/gfx/win/dpi.h"
|
||||||
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
|
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
|
||||||
|
@ -230,14 +231,22 @@ NativeWindowViews::NativeWindowViews(
|
||||||
SetLayoutManager(new MenuLayout(this, kMenuBarHeight));
|
SetLayoutManager(new MenuLayout(this, kMenuBarHeight));
|
||||||
|
|
||||||
// web views' background color.
|
// web views' background color.
|
||||||
std::string background_color = "#fff";
|
SkColor background_color = SK_ColorWHITE;
|
||||||
options.Get(switches::kBackgroundColor, &background_color);
|
std::string color_name;
|
||||||
set_background(views::Background::CreateSolidBackground(
|
if (options.Get(switches::kBackgroundColor, &color_name))
|
||||||
ParseHexColor(background_color)));
|
background_color = ParseHexColor(color_name);
|
||||||
|
set_background(views::Background::CreateSolidBackground(background_color));
|
||||||
|
|
||||||
AddChildView(web_view_);
|
AddChildView(web_view_);
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
|
// Set the background color of native window.
|
||||||
|
HBRUSH brush = CreateSolidBrush(skia::SkColorToCOLORREF(background_color));
|
||||||
|
ULONG_PTR previous_brush = SetClassLongPtr(
|
||||||
|
GetAcceleratedWidget(), GCLP_HBRBACKGROUND, (LONG)brush);
|
||||||
|
if (previous_brush)
|
||||||
|
DeleteObject((HBRUSH)previous_brush);
|
||||||
|
|
||||||
// Save initial window state.
|
// Save initial window state.
|
||||||
if (fullscreen)
|
if (fullscreen)
|
||||||
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
|
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue