summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2020-08-28 16:58:31 +0200
committerSimon Rettberg2020-08-28 16:58:31 +0200
commit3d6705b8b9adf92b1a4fa29b81134b872ec340cf (patch)
treef4e4ebe5c81fa6769e230027a3ef0bc28db93de9
parentFix center mode (again) (diff)
downloadbeamergui-3d6705b8b9adf92b1a4fa29b81134b872ec340cf.tar.gz
beamergui-3d6705b8b9adf92b1a4fa29b81134b872ec340cf.tar.xz
beamergui-3d6705b8b9adf92b1a4fa29b81134b872ec340cf.zip
Read screen resolution directly from randr, Qt uses cached values
-rw-r--r--src/main.cpp4
-rw-r--r--src/xx.cpp3
-rw-r--r--src/xx.h1
3 files changed, 6 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index d94895a..d2def2c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -192,8 +192,8 @@ static int findConfig(QVector<QRect> &list)
static void dumpScreens()
{
QVector<QRect> list;
- for (auto *scr : QGuiApplication::screens()) {
- list.append(scr->geometry());
+ for (auto scr : ScreenSetup::inst()->getScreenPositions()) {
+ list.append(QRect(scr.location, scr.currentResolution));
}
findConfig(list);
qSort(list.begin(), list.end(), [](const QRect &one, const QRect &other) -> bool {
diff --git a/src/xx.cpp b/src/xx.cpp
index aa2f2e0..5b6a56a 100644
--- a/src/xx.cpp
+++ b/src/xx.cpp
@@ -151,6 +151,9 @@ ScreenInfo ScreenSetup::initScreenInfo(const OutputInfo *oi) const
if (oi->mode != nullptr) {
si.currentResolution = QSize(QSize(int(oi->mode->width), int(oi->mode->height)));
}
+ if (oi->crtc != nullptr) {
+ si.location = QPoint(oi->crtc->x, oi->crtc->y);
+ }
for (int i = 0; i < oi->output->nmode; ++i) {
if (a->_modeMap.contains(oi->output->modes[i])) {
auto m = a->_modeMap.value(oi->output->modes[i]);
diff --git a/src/xx.h b/src/xx.h
index cf5a37a..ea1177a 100644
--- a/src/xx.h
+++ b/src/xx.h
@@ -24,6 +24,7 @@ enum class ScreenMode
struct ScreenInfo
{
+ QPoint location;
int position;
QString name;
QString output;