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:
parent
c3d51bc2fe
commit
b89848d683
8 changed files with 27 additions and 9 deletions
|
@ -706,8 +706,13 @@ void TopLevelWindow::SetOverlayIcon(const gfx::Image& overlay,
|
||||||
window_->SetOverlayIcon(overlay, description);
|
window_->SetOverlayIcon(overlay, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopLevelWindow::SetVisibleOnAllWorkspaces(bool visible) {
|
void TopLevelWindow::SetVisibleOnAllWorkspaces(bool visible,
|
||||||
return window_->SetVisibleOnAllWorkspaces(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() {
|
bool TopLevelWindow::IsVisibleOnAllWorkspaces() {
|
||||||
|
|
|
@ -167,7 +167,7 @@ class TopLevelWindow : public mate::TrackableObject<TopLevelWindow>,
|
||||||
void SetProgressBar(double progress, mate::Arguments* args);
|
void SetProgressBar(double progress, mate::Arguments* args);
|
||||||
void SetOverlayIcon(const gfx::Image& overlay,
|
void SetOverlayIcon(const gfx::Image& overlay,
|
||||||
const std::string& description);
|
const std::string& description);
|
||||||
void SetVisibleOnAllWorkspaces(bool visible);
|
void SetVisibleOnAllWorkspaces(bool visible, mate::Arguments* args);
|
||||||
bool IsVisibleOnAllWorkspaces();
|
bool IsVisibleOnAllWorkspaces();
|
||||||
void SetAutoHideCursor(bool auto_hide);
|
void SetAutoHideCursor(bool auto_hide);
|
||||||
virtual void SetVibrancy(v8::Isolate* isolate, v8::Local<v8::Value> value);
|
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;
|
const std::string& description) = 0;
|
||||||
|
|
||||||
// Workspace APIs.
|
// Workspace APIs.
|
||||||
virtual void SetVisibleOnAllWorkspaces(bool visible) = 0;
|
virtual void SetVisibleOnAllWorkspaces(bool visible,
|
||||||
|
bool visibleOnFullScreen = false) = 0;
|
||||||
|
|
||||||
virtual bool IsVisibleOnAllWorkspaces() = 0;
|
virtual bool IsVisibleOnAllWorkspaces() = 0;
|
||||||
|
|
||||||
virtual void SetAutoHideCursor(bool auto_hide);
|
virtual void SetAutoHideCursor(bool auto_hide);
|
||||||
|
|
|
@ -109,7 +109,8 @@ class NativeWindowMac : public NativeWindow {
|
||||||
void SetOverlayIcon(const gfx::Image& overlay,
|
void SetOverlayIcon(const gfx::Image& overlay,
|
||||||
const std::string& description) override;
|
const std::string& description) override;
|
||||||
|
|
||||||
void SetVisibleOnAllWorkspaces(bool visible) override;
|
void SetVisibleOnAllWorkspaces(bool visible,
|
||||||
|
bool visibleOnFullScreen) override;
|
||||||
bool IsVisibleOnAllWorkspaces() override;
|
bool IsVisibleOnAllWorkspaces() override;
|
||||||
|
|
||||||
void SetAutoHideCursor(bool auto_hide) override;
|
void SetAutoHideCursor(bool auto_hide) override;
|
||||||
|
|
|
@ -1132,8 +1132,11 @@ void NativeWindowMac::SetProgressBar(double progress,
|
||||||
void NativeWindowMac::SetOverlayIcon(const gfx::Image& overlay,
|
void NativeWindowMac::SetOverlayIcon(const gfx::Image& overlay,
|
||||||
const std::string& description) {}
|
const std::string& description) {}
|
||||||
|
|
||||||
void NativeWindowMac::SetVisibleOnAllWorkspaces(bool visible) {
|
void NativeWindowMac::SetVisibleOnAllWorkspaces(bool visible,
|
||||||
|
bool visibleOnFullScreen) {
|
||||||
SetCollectionBehavior(visible, NSWindowCollectionBehaviorCanJoinAllSpaces);
|
SetCollectionBehavior(visible, NSWindowCollectionBehaviorCanJoinAllSpaces);
|
||||||
|
SetCollectionBehavior(visibleOnFullScreen,
|
||||||
|
NSWindowCollectionBehaviorFullScreenAuxiliary);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NativeWindowMac::IsVisibleOnAllWorkspaces() {
|
bool NativeWindowMac::IsVisibleOnAllWorkspaces() {
|
||||||
|
|
|
@ -1006,7 +1006,8 @@ bool NativeWindowViews::IsMenuBarVisible() {
|
||||||
return root_view_->IsMenuBarVisible();
|
return root_view_->IsMenuBarVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowViews::SetVisibleOnAllWorkspaces(bool visible) {
|
void NativeWindowViews::SetVisibleOnAllWorkspaces(bool visible,
|
||||||
|
bool visibleOnFullScreen) {
|
||||||
widget()->SetVisibleOnAllWorkspaces(visible);
|
widget()->SetVisibleOnAllWorkspaces(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,10 @@ class NativeWindowViews : public NativeWindow,
|
||||||
bool IsMenuBarAutoHide() override;
|
bool IsMenuBarAutoHide() override;
|
||||||
void SetMenuBarVisibility(bool visible) override;
|
void SetMenuBarVisibility(bool visible) override;
|
||||||
bool IsMenuBarVisible() override;
|
bool IsMenuBarVisible() override;
|
||||||
void SetVisibleOnAllWorkspaces(bool visible) override;
|
|
||||||
|
void SetVisibleOnAllWorkspaces(bool visible,
|
||||||
|
bool visibleOnFullScreen) override;
|
||||||
|
|
||||||
bool IsVisibleOnAllWorkspaces() override;
|
bool IsVisibleOnAllWorkspaces() override;
|
||||||
|
|
||||||
gfx::AcceleratedWidget GetAcceleratedWidget() const 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.
|
Returns `Boolean` - Whether the menu bar is visible.
|
||||||
|
|
||||||
#### `win.setVisibleOnAllWorkspaces(visible)`
|
#### `win.setVisibleOnAllWorkspaces(visible[, options])`
|
||||||
|
|
||||||
* `visible` Boolean
|
* `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.
|
Sets whether the window should be visible on all workspaces.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue