refactor: use views NonClientHitTest for draggable regions on mac (#35603)

* refactor: use views NonClientHitTest for draggable regions on mac

* iwyu

* add backport of 9bb5f0316

* chore: update patches

* remove some unneeded functions

* remove test for triggering when BW is focused

* chore: update patches

* simplify views/mac split now that the draggable logic is the same

* Apply suggestions from code review

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* Update shell/browser/native_window.h

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fix build

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
Jeremy Rose 2022-10-12 09:05:45 -07:00 committed by GitHub
parent 7ce94eb0b4
commit 8a926ffde4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 70 additions and 392 deletions

View file

@ -12,8 +12,6 @@
#include <string>
#include <vector>
#include "shell/common/api/api.mojom.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/views/widget/widget_observer.h"
#if defined(USE_OZONE)
@ -155,9 +153,6 @@ class NativeWindowViews : public NativeWindow,
gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const override;
gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const override;
void UpdateDraggableRegions(
const std::vector<mojom::DraggableRegionPtr>& regions);
void IncrementChildModals();
void DecrementChildModals();
@ -177,8 +172,6 @@ class NativeWindowViews : public NativeWindow,
void SetIcon(const gfx::ImageSkia& icon);
#endif
SkRegion* draggable_region() const { return draggable_region_.get(); }
#if BUILDFLAG(IS_WIN)
TaskbarHost& taskbar_host() { return taskbar_host_; }
#endif
@ -329,10 +322,6 @@ class NativeWindowViews : public NativeWindow,
// Handles unhandled keyboard messages coming back from the renderer process.
std::unique_ptr<views::UnhandledKeyboardEventHandler> keyboard_event_handler_;
// For custom drag, the whole window is non-draggable and the draggable region
// has to been explicitly provided.
std::unique_ptr<SkRegion> draggable_region_; // used in custom drag.
// Whether the window should be enabled based on user calls to SetEnabled()
bool is_enabled_ = true;
// How many modal children this window has;