mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-10-27 02:54:36 +00:00
core/screen: expose x and y positions
This commit is contained in:
2 files changed
+22
No files matched your search
@@ -42,6 +42,24 @@ QString QuickshellScreenInfo::name() const {
|
||||
return this->screen->name();
|
||||
}
|
||||
|
||||
qint32 QuickshellScreenInfo::x() const {
|
||||
if (this->screen == nullptr) {
|
||||
this->warnDangling();
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this->screen->geometry().x();
|
||||
}
|
||||
|
||||
qint32 QuickshellScreenInfo::y() const {
|
||||
if (this->screen == nullptr) {
|
||||
this->warnDangling();
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this->screen->geometry().y();
|
||||
}
|
||||
|
||||
qint32 QuickshellScreenInfo::width() const {
|
||||
if (this->screen == nullptr) {
|
||||
this->warnDangling();
|
||||
|
||||
@@ -32,6 +32,8 @@ class QuickshellScreenInfo: public QObject {
|
||||
///
|
||||
/// Usually something like `DP-1`, `HDMI-1`, `eDP-1`.
|
||||
Q_PROPERTY(QString name READ name CONSTANT);
|
||||
Q_PROPERTY(qint32 x READ x NOTIFY geometryChanged);
|
||||
Q_PROPERTY(qint32 y READ y NOTIFY geometryChanged);
|
||||
Q_PROPERTY(qint32 width READ width NOTIFY geometryChanged);
|
||||
Q_PROPERTY(qint32 height READ height NOTIFY geometryChanged);
|
||||
/// The number of physical pixels per millimeter.
|
||||
@@ -50,6 +52,8 @@ public:
|
||||
bool operator==(QuickshellScreenInfo& other) const;
|
||||
|
||||
[[nodiscard]] QString name() const;
|
||||
[[nodiscard]] qint32 x() const;
|
||||
[[nodiscard]] qint32 y() const;
|
||||
[[nodiscard]] qint32 width() const;
|
||||
[[nodiscard]] qint32 height() const;
|
||||
[[nodiscard]] qreal physicalPixelDensity() const;
|
||||
|
||||
Reference in new issue
Block a user