feat: allow window above full screen windows on mac (#14122)

* allow window above full screen windows on mac

* add visibility change params to higher level files

* adress feedback, fix bool issue, remove compilation hooks

* adjust readme

* switch to options object

* single argument for native window views
This commit is contained in:
Paulius 2018-08-31 17:06:02 -05:00 коммит произвёл Shelley Vohr
Родитель c3d51bc2fe
Коммит b89848d683
8 изменённых файлов: 27 добавлений и 9 удалений

Просмотреть файл

@ -706,8 +706,13 @@ void TopLevelWindow::SetOverlayIcon(const gfx::Image& overlay,
window_->SetOverlayIcon(overlay, description);
}
void TopLevelWindow::SetVisibleOnAllWorkspaces(bool visible) {
return window_->SetVisibleOnAllWorkspaces(visible);
void TopLevelWindow::SetVisibleOnAllWorkspaces(bool visible,
mate::Arguments* args) {
mate::Dictionary options;
bool visibleOnFullScreen = false;
args->GetNext(&options) &&
options.Get("visibleOnFullScreen", &visibleOnFullScreen);
return window_->SetVisibleOnAllWorkspaces(visible, visibleOnFullScreen);
}
bool TopLevelWindow::IsVisibleOnAllWorkspaces() {

Просмотреть файл

@ -167,7 +167,7 @@ class TopLevelWindow : public mate::TrackableObject<TopLevelWindow>,
void SetProgressBar(double progress, mate::Arguments* args);
void SetOverlayIcon(const gfx::Image& overlay,
const std::string& description);
void SetVisibleOnAllWorkspaces(bool visible);
void SetVisibleOnAllWorkspaces(bool visible, mate::Arguments* args);
bool IsVisibleOnAllWorkspaces();
void SetAutoHideCursor(bool auto_hide);
virtual void SetVibrancy(v8::Isolate* isolate, v8::Local<v8::Value> value);

Просмотреть файл

@ -167,7 +167,9 @@ class NativeWindow : public base::SupportsUserData,
const std::string& description) = 0;
// Workspace APIs.
virtual void SetVisibleOnAllWorkspaces(bool visible) = 0;
virtual void SetVisibleOnAllWorkspaces(bool visible,
bool visibleOnFullScreen = false) = 0;
virtual bool IsVisibleOnAllWorkspaces() = 0;
virtual void SetAutoHideCursor(bool auto_hide);

Просмотреть файл

@ -109,7 +109,8 @@ class NativeWindowMac : public NativeWindow {
void SetOverlayIcon(const gfx::Image& overlay,
const std::string& description) override;
void SetVisibleOnAllWorkspaces(bool visible) override;
void SetVisibleOnAllWorkspaces(bool visible,
bool visibleOnFullScreen) override;
bool IsVisibleOnAllWorkspaces() override;
void SetAutoHideCursor(bool auto_hide) override;

Просмотреть файл

@ -1132,8 +1132,11 @@ void NativeWindowMac::SetProgressBar(double progress,
void NativeWindowMac::SetOverlayIcon(const gfx::Image& overlay,
const std::string& description) {}
void NativeWindowMac::SetVisibleOnAllWorkspaces(bool visible) {
void NativeWindowMac::SetVisibleOnAllWorkspaces(bool visible,
bool visibleOnFullScreen) {
SetCollectionBehavior(visible, NSWindowCollectionBehaviorCanJoinAllSpaces);
SetCollectionBehavior(visibleOnFullScreen,
NSWindowCollectionBehaviorFullScreenAuxiliary);
}
bool NativeWindowMac::IsVisibleOnAllWorkspaces() {

Просмотреть файл

@ -1006,7 +1006,8 @@ bool NativeWindowViews::IsMenuBarVisible() {
return root_view_->IsMenuBarVisible();
}
void NativeWindowViews::SetVisibleOnAllWorkspaces(bool visible) {
void NativeWindowViews::SetVisibleOnAllWorkspaces(bool visible,
bool visibleOnFullScreen) {
widget()->SetVisibleOnAllWorkspaces(visible);
}

Просмотреть файл

@ -120,7 +120,10 @@ class NativeWindowViews : public NativeWindow,
bool IsMenuBarAutoHide() override;
void SetMenuBarVisibility(bool visible) override;
bool IsMenuBarVisible() override;
void SetVisibleOnAllWorkspaces(bool visible) override;
void SetVisibleOnAllWorkspaces(bool visible,
bool visibleOnFullScreen) override;
bool IsVisibleOnAllWorkspaces() override;
gfx::AcceleratedWidget GetAcceleratedWidget() const override;

Просмотреть файл

@ -1418,9 +1418,12 @@ can still bring up the menu bar by pressing the single `Alt` key.
Returns `Boolean` - Whether the menu bar is visible.
#### `win.setVisibleOnAllWorkspaces(visible)`
#### `win.setVisibleOnAllWorkspaces(visible[, options])`
* `visible` Boolean
* `options` Object (optional)
* `visibleOnFullScreen` Boolean (optional) _macOS_ - Sets whether
the window should be visible above fullscreen windows
Sets whether the window should be visible on all workspaces.