|
@@ -814,6 +814,24 @@ bool NativeWindowViews::HasShadow() {
|
|
|
!= wm::ShadowElevation::NONE;
|
|
|
}
|
|
|
|
|
|
+void NativeWindowViews::SetOpacity(const double opacity) {
|
|
|
+#if defined(OS_WIN)
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ ::SetLayeredWindowAttributes(hwnd, 0, opacity * 255, LWA_ALPHA);
|
|
|
+#endif
|
|
|
+ opacity_ = opacity;
|
|
|
+}
|
|
|
+
|
|
|
+double NativeWindowViews::GetOpacity() {
|
|
|
+ return opacity_;
|
|
|
+}
|
|
|
+
|
|
|
void NativeWindowViews::SetIgnoreMouseEvents(bool ignore, bool forward) {
|
|
|
#if defined(OS_WIN)
|
|
|
LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE);
|
|
@@ -821,6 +839,8 @@ void NativeWindowViews::SetIgnoreMouseEvents(bool ignore, bool forward) {
|
|
|
ex_style |= (WS_EX_TRANSPARENT | WS_EX_LAYERED);
|
|
|
else
|
|
|
ex_style &= ~(WS_EX_TRANSPARENT | WS_EX_LAYERED);
|
|
|
+ if (layered_)
|
|
|
+ ex_style |= WS_EX_LAYERED;
|
|
|
::SetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE, ex_style);
|
|
|
|
|
|
// Forwarding is always disabled when not ignoring mouse messages.
|