fix: recalibrate simpleFullscreen when display metrics change (#28150)

* fix: recalibrate simpleFullscreen when display metrics change

* Address review feedback

* fix: compilation issues

* Address feedback from review
This commit is contained in:
Shelley Vohr 2021-03-16 02:41:59 -07:00 committed by GitHub
parent b045d42b0e
commit fdc2e2bc57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 1 deletions

View file

@ -14,6 +14,7 @@
#include "base/mac/scoped_nsobject.h"
#include "shell/browser/native_window.h"
#include "ui/display/display_observer.h"
#include "ui/native_theme/native_theme_observer.h"
#include "ui/views/controls/native/native_view_host.h"
@ -27,7 +28,9 @@ namespace electron {
class RootViewMac;
class NativeWindowMac : public NativeWindow, public ui::NativeThemeObserver {
class NativeWindowMac : public NativeWindow,
public ui::NativeThemeObserver,
public display::DisplayObserver {
public:
NativeWindowMac(const gin_helper::Dictionary& options, NativeWindow* parent);
~NativeWindowMac() override;
@ -124,6 +127,7 @@ class NativeWindowMac : public NativeWindow, public ui::NativeThemeObserver {
void SetTrafficLightPosition(base::Optional<gfx::Point> position) override;
base::Optional<gfx::Point> GetTrafficLightPosition() const override;
void RedrawTrafficLights() override;
void UpdateFrame() override;
void SetTouchBar(
std::vector<gin_helper::PersistentDictionary> items) override;
void RefreshTouchBarItem(const std::string& item_id) override;
@ -188,6 +192,10 @@ class NativeWindowMac : public NativeWindow, public ui::NativeThemeObserver {
// ui::NativeThemeObserver:
void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override;
// display::DisplayObserver:
void OnDisplayMetricsChanged(const display::Display& display,
uint32_t changed_metrics) override;
private:
// Add custom layers to the content view.
void AddContentViewLayers();