Files
John ChadwickandStefan Schlosser 924fa315dc hiro/qt: Unify Monitor implementation with ares
Some of the work I'd done was duplicating existing work. Let's unify to
get the best of both works.

This mostly comes from:
https://github.com/ares-emulator/ares/commit/ffe97222a1aabd325c301e07ba40042ea58ff081

Co-authored-by: Stefan Schlosser <[email protected]>
2025-09-02 18:09:42 +10:00

36 lines
819 B
C++

#if defined(Hiro_Monitor)
namespace hiro {
auto pMonitor::count() -> uint {
return QApplication::screens().count();
}
auto pMonitor::dpi(uint monitor) -> Position {
return {
QApplication::screens().at(monitor)->logicalDotsPerInchX(),
QApplication::screens().at(monitor)->logicalDotsPerInchY()
};
}
auto pMonitor::geometry(uint monitor) -> Geometry {
QRect rectangle = QApplication::screens()[monitor]->geometry();
return {rectangle.x(), rectangle.y(), rectangle.width(), rectangle.height()};
}
auto pMonitor::primary() -> uint {
return max(QApplication::screens().indexOf(QApplication::primaryScreen()), 0);
}
auto pMonitor::workspace(uint monitor) -> Geometry {
if(Monitor::count() == 1) {
return Desktop::workspace();
} else {
return Monitor::geometry(monitor);
}
}
}
#endif