Merge pull request #10183 from andens/mouse_forward

Mouse forward functionality on Windows
This commit is contained in:
Cheng Zhao 2017-08-17 15:54:22 +09:00 committed by GitHub
commit f908678e8e
8 changed files with 156 additions and 7 deletions

View file

@ -334,6 +334,11 @@ NativeWindowViews::NativeWindowViews(
NativeWindowViews::~NativeWindowViews() {
window_->RemoveObserver(this);
#if defined(OS_WIN)
// Disable mouse forwarding to relinquish resources, should any be held.
SetForwardMouseMessages(false);
#endif
}
void NativeWindowViews::Close() {
@ -790,7 +795,7 @@ bool NativeWindowViews::HasShadow() {
!= wm::ShadowElevation::NONE;
}
void NativeWindowViews::SetIgnoreMouseEvents(bool ignore) {
void NativeWindowViews::SetIgnoreMouseEvents(bool ignore, bool forward) {
#if defined(OS_WIN)
LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE);
if (ignore)
@ -798,6 +803,13 @@ void NativeWindowViews::SetIgnoreMouseEvents(bool ignore) {
else
ex_style &= ~(WS_EX_TRANSPARENT | WS_EX_LAYERED);
::SetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE, ex_style);
// Forwarding is always disabled when not ignoring mouse messages.
if (!ignore) {
SetForwardMouseMessages(false);
} else {
SetForwardMouseMessages(forward);
}
#elif defined(USE_X11)
if (ignore) {
XRectangle r = {0, 0, 1, 1};