wayland/toplevel: expose visible outputs

This commit is contained in:
outfoxxed 2025-05-18 23:13:17 -07:00
parent 5193426cd7
commit 644254d9ec
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
2 changed files with 22 additions and 0 deletions

View file

@ -1,9 +1,11 @@
#include "qml.hpp"
#include <qlist.h>
#include <qobject.h>
#include <qtmetamacros.h>
#include "../../core/model.hpp"
#include "../../core/qmlglobal.hpp"
#include "../../core/qmlscreen.hpp"
#include "../../core/util.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::parentChanged, this, &Toplevel::parentChanged);
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::minimizedChanged, this, &Toplevel::minimizedChanged);
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(); }
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(); }
void Toplevel::setMaximized(bool maximized) { this->handle->setMaximized(maximized); }