forked from quickshell/quickshell
		
	wayland/toplevel: expose visible outputs
This commit is contained in:
		
							parent
							
								
									5193426cd7
								
							
						
					
					
						commit
						644254d9ec
					
				
					 2 changed files with 22 additions and 0 deletions
				
			
		| 
						 | 
					@ -1,9 +1,11 @@
 | 
				
			||||||
#include "qml.hpp"
 | 
					#include "qml.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <qlist.h>
 | 
				
			||||||
#include <qobject.h>
 | 
					#include <qobject.h>
 | 
				
			||||||
#include <qtmetamacros.h>
 | 
					#include <qtmetamacros.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "../../core/model.hpp"
 | 
					#include "../../core/model.hpp"
 | 
				
			||||||
 | 
					#include "../../core/qmlglobal.hpp"
 | 
				
			||||||
#include "../../core/qmlscreen.hpp"
 | 
					#include "../../core/qmlscreen.hpp"
 | 
				
			||||||
#include "../../core/util.hpp"
 | 
					#include "../../core/util.hpp"
 | 
				
			||||||
#include "../../window/proxywindow.hpp"
 | 
					#include "../../window/proxywindow.hpp"
 | 
				
			||||||
| 
						 | 
					@ -20,6 +22,8 @@ Toplevel::Toplevel(impl::ToplevelHandle* handle, QObject* parent): QObject(paren
 | 
				
			||||||
	QObject::connect(handle, &impl::ToplevelHandle::titleChanged, this, &Toplevel::titleChanged);
 | 
						QObject::connect(handle, &impl::ToplevelHandle::titleChanged, this, &Toplevel::titleChanged);
 | 
				
			||||||
	QObject::connect(handle, &impl::ToplevelHandle::parentChanged, this, &Toplevel::parentChanged);
 | 
						QObject::connect(handle, &impl::ToplevelHandle::parentChanged, this, &Toplevel::parentChanged);
 | 
				
			||||||
	QObject::connect(handle, &impl::ToplevelHandle::activatedChanged, this, &Toplevel::activatedChanged);
 | 
						QObject::connect(handle, &impl::ToplevelHandle::activatedChanged, this, &Toplevel::activatedChanged);
 | 
				
			||||||
 | 
						QObject::connect(handle, &impl::ToplevelHandle::visibleScreenAdded, this, &Toplevel::screensChanged);
 | 
				
			||||||
 | 
						QObject::connect(handle, &impl::ToplevelHandle::visibleScreenRemoved, this, &Toplevel::screensChanged);
 | 
				
			||||||
	QObject::connect(handle, &impl::ToplevelHandle::maximizedChanged, this, &Toplevel::maximizedChanged);
 | 
						QObject::connect(handle, &impl::ToplevelHandle::maximizedChanged, this, &Toplevel::maximizedChanged);
 | 
				
			||||||
	QObject::connect(handle, &impl::ToplevelHandle::minimizedChanged, this, &Toplevel::minimizedChanged);
 | 
						QObject::connect(handle, &impl::ToplevelHandle::minimizedChanged, this, &Toplevel::minimizedChanged);
 | 
				
			||||||
	QObject::connect(handle, &impl::ToplevelHandle::fullscreenChanged, this, &Toplevel::fullscreenChanged);
 | 
						QObject::connect(handle, &impl::ToplevelHandle::fullscreenChanged, this, &Toplevel::fullscreenChanged);
 | 
				
			||||||
| 
						 | 
					@ -43,6 +47,16 @@ Toplevel* Toplevel::parent() const {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool Toplevel::activated() const { return this->handle->activated(); }
 | 
					bool Toplevel::activated() const { return this->handle->activated(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QList<QuickshellScreenInfo*> Toplevel::screens() const {
 | 
				
			||||||
 | 
						QList<QuickshellScreenInfo*> screens;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (auto* screen: this->handle->visibleScreens()) {
 | 
				
			||||||
 | 
							screens.push_back(QuickshellTracked::instance()->screenInfo(screen));
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return screens;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool Toplevel::maximized() const { return this->handle->maximized(); }
 | 
					bool Toplevel::maximized() const { return this->handle->maximized(); }
 | 
				
			||||||
void Toplevel::setMaximized(bool maximized) { this->handle->setMaximized(maximized); }
 | 
					void Toplevel::setMaximized(bool maximized) { this->handle->setMaximized(maximized); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <qlist.h>
 | 
				
			||||||
#include <qobject.h>
 | 
					#include <qobject.h>
 | 
				
			||||||
#include <qqmlintegration.h>
 | 
					#include <qqmlintegration.h>
 | 
				
			||||||
#include <qtmetamacros.h>
 | 
					#include <qtmetamacros.h>
 | 
				
			||||||
| 
						 | 
					@ -30,6 +31,11 @@ class Toplevel: public QObject {
 | 
				
			||||||
	///
 | 
						///
 | 
				
			||||||
	/// Activation can be requested with the @@activate() function.
 | 
						/// Activation can be requested with the @@activate() function.
 | 
				
			||||||
	Q_PROPERTY(bool activated READ activated NOTIFY activatedChanged);
 | 
						Q_PROPERTY(bool activated READ activated NOTIFY activatedChanged);
 | 
				
			||||||
 | 
						/// Screens the toplevel is currently visible on.
 | 
				
			||||||
 | 
						/// Screens are listed in the order they have been added by the compositor.
 | 
				
			||||||
 | 
						///
 | 
				
			||||||
 | 
						/// > [!NOTE]	Some compositors only list a single screen, even if a window is visible on multiple.
 | 
				
			||||||
 | 
						Q_PROPERTY(QList<QuickshellScreenInfo*> screens READ screens NOTIFY screensChanged);
 | 
				
			||||||
	/// If the window is currently maximized.
 | 
						/// If the window is currently maximized.
 | 
				
			||||||
	///
 | 
						///
 | 
				
			||||||
	/// Maximization can be requested by setting this property, though it may
 | 
						/// Maximization can be requested by setting this property, though it may
 | 
				
			||||||
| 
						 | 
					@ -74,6 +80,7 @@ public:
 | 
				
			||||||
	[[nodiscard]] QString title() const;
 | 
						[[nodiscard]] QString title() const;
 | 
				
			||||||
	[[nodiscard]] Toplevel* parent() const;
 | 
						[[nodiscard]] Toplevel* parent() const;
 | 
				
			||||||
	[[nodiscard]] bool activated() const;
 | 
						[[nodiscard]] bool activated() const;
 | 
				
			||||||
 | 
						[[nodiscard]] QList<QuickshellScreenInfo*> screens() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[[nodiscard]] bool maximized() const;
 | 
						[[nodiscard]] bool maximized() const;
 | 
				
			||||||
	void setMaximized(bool maximized);
 | 
						void setMaximized(bool maximized);
 | 
				
			||||||
| 
						 | 
					@ -92,6 +99,7 @@ signals:
 | 
				
			||||||
	void titleChanged();
 | 
						void titleChanged();
 | 
				
			||||||
	void parentChanged();
 | 
						void parentChanged();
 | 
				
			||||||
	void activatedChanged();
 | 
						void activatedChanged();
 | 
				
			||||||
 | 
						void screensChanged();
 | 
				
			||||||
	void maximizedChanged();
 | 
						void maximizedChanged();
 | 
				
			||||||
	void minimizedChanged();
 | 
						void minimizedChanged();
 | 
				
			||||||
	void fullscreenChanged();
 | 
						void fullscreenChanged();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue