fix: move window buttons in-place on macOS (#30322)

This commit is contained in:
Cheng Zhao 2021-08-04 09:31:12 +09:00 committed by GitHub
parent 1c29734c91
commit 97929eab5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 334 additions and 278 deletions

View file

@ -22,7 +22,7 @@
@class ElectronNSWindowDelegate;
@class ElectronPreviewItem;
@class ElectronTouchBar;
@class WindowButtonsView;
@class WindowButtonsProxy;
namespace electron {
@ -156,9 +156,6 @@ class NativeWindowMac : public NativeWindow,
void NotifyWindowWillEnterFullScreen();
void NotifyWindowWillLeaveFullScreen();
// Ensure the buttons view are always floated on the top.
void ReorderButtonsView();
// Cleanup observers when window is getting closed. Note that the destructor
// can be called much later after window gets closed, so we should not do
// cleanup in destructor.
@ -215,7 +212,6 @@ class NativeWindowMac : public NativeWindow,
void AddContentViewLayers();
void InternalSetWindowButtonVisibility(bool visible);
void InternalSetStandardButtonsVisibility(bool visible);
void InternalSetParentWindow(NativeWindow* parent, bool attach);
void SetForwardMouseMessages(bool forward);
@ -224,7 +220,6 @@ class NativeWindowMac : public NativeWindow,
base::scoped_nsobject<ElectronNSWindowDelegate> window_delegate_;
base::scoped_nsobject<ElectronPreviewItem> preview_item_;
base::scoped_nsobject<ElectronTouchBar> touch_bar_;
base::scoped_nsobject<WindowButtonsView> buttons_view_;
// Event monitor for scroll wheel event.
id wheel_event_monitor_;
@ -263,6 +258,9 @@ class NativeWindowMac : public NativeWindow,
// setWindowButtonVisibility().
absl::optional<bool> window_button_visibility_;
// Controls the position and visibility of window buttons.
base::scoped_nsobject<WindowButtonsProxy> buttons_proxy_;
// Maximizable window state; necessary for persistence through redraws.
bool maximizable_ = true;