Skip to content

Commit

Permalink
fix: WCO window hover on window controls on Windows (#32716)
Browse files Browse the repository at this point in the history
* fix: WCO window hover on window controls

* Update shell/browser/ui/win/electron_desktop_window_tree_host_win.cc

Co-authored-by: Robo <hop2deep@gmail.com>

Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: Calvin <clavin@users.noreply.github.com>
Co-authored-by: Robo <hop2deep@gmail.com>
  • Loading branch information
4 people committed Feb 3, 2022
1 parent 9c2eed2 commit e95a593
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions shell/browser/ui/win/electron_desktop_window_tree_host_win.cc
Expand Up @@ -99,4 +99,21 @@ bool ElectronDesktopWindowTreeHostWin::GetClientAreaInsets(
return false;
}

bool ElectronDesktopWindowTreeHostWin::HandleMouseEvent(ui::MouseEvent* event) {
// Call the default implementation of this method to get the event to its
// proper handler.
bool handled = views::DesktopWindowTreeHostWin::HandleMouseEvent(event);

// On WCO-enabled windows, we need to mark non-client mouse moved events as
// handled so they don't incorrectly propogate back to the OS.
if (native_window_view_->IsWindowControlsOverlayEnabled() &&
event->type() == ui::ET_MOUSE_MOVED &&
(event->flags() & ui::EF_IS_NON_CLIENT) != 0) {
event->SetHandled();
handled = true;
}

return handled;
}

} // namespace electron
Expand Up @@ -30,6 +30,7 @@ class ElectronDesktopWindowTreeHostWin
bool GetDwmFrameInsetsInPixels(gfx::Insets* insets) const override;
bool GetClientAreaInsets(gfx::Insets* insets,
HMONITOR monitor) const override;
bool HandleMouseEvent(ui::MouseEvent* event) override;

private:
NativeWindowViews* native_window_view_; // weak ref
Expand Down

0 comments on commit e95a593

Please sign in to comment.