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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue