fix: window content protection on older Windows versions (#47856)
This commit is contained in:
parent
c569d5e4ba
commit
01faaa30ea
3 changed files with 17 additions and 6 deletions
|
@ -1282,12 +1282,7 @@ void NativeWindowViews::SetOpacity(const double opacity) {
|
|||
#if BUILDFLAG(IS_WIN)
|
||||
const double boundedOpacity = std::clamp(opacity, 0.0, 1.0);
|
||||
HWND hwnd = GetAcceleratedWidget();
|
||||
if (!layered_) {
|
||||
LONG ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
|
||||
ex_style |= WS_EX_LAYERED;
|
||||
::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style);
|
||||
layered_ = true;
|
||||
}
|
||||
SetLayered();
|
||||
::SetLayeredWindowAttributes(hwnd, 0, boundedOpacity * 255, LWA_ALPHA);
|
||||
opacity_ = boundedOpacity;
|
||||
#else
|
||||
|
@ -1730,6 +1725,16 @@ void NativeWindowViews::UpdateThickFrame() {
|
|||
FlipWindowStyle(GetAcceleratedWidget(), resizable_, WS_THICKFRAME);
|
||||
}
|
||||
}
|
||||
|
||||
void NativeWindowViews::SetLayered() {
|
||||
HWND hwnd = GetAcceleratedWidget();
|
||||
if (!layered_) {
|
||||
LONG ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
|
||||
ex_style |= WS_EX_LAYERED;
|
||||
::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style);
|
||||
layered_ = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void NativeWindowViews::OnWidgetActivationChanged(views::Widget* changed_widget,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue