summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-02-27 11:37:00 +0100
committerSimon Rettberg2019-02-27 11:37:00 +0100
commit5bd9a746f3d3216a90ac46452a41060bb100dadf (patch)
treeefed84bf586cc57f3a13e0e9906004c8fcfb8320
parentFuck QtCreator (diff)
downloadbeamergui-5bd9a746f3d3216a90ac46452a41060bb100dadf.tar.gz
beamergui-5bd9a746f3d3216a90ac46452a41060bb100dadf.tar.xz
beamergui-5bd9a746f3d3216a90ac46452a41060bb100dadf.zip
Madness lies down this commit.
If no projector EDID and screen res is not in set of default resolutions, don't use a resolution for the beamer that is larger than what the screen supports.
-rw-r--r--src/xprivate.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/xprivate.cpp b/src/xprivate.cpp
index 3e7c3a2..62a4895 100644
--- a/src/xprivate.cpp
+++ b/src/xprivate.cpp
@@ -557,25 +557,25 @@ XRRModeInfo* XPrivate::getPreferredMode(const OutputInfo *oi, XRRModeInfo *fallb
} else {
// No preferred one, try some more or less clever fallback
qDebug() << "No preferred mode for" << oi->outputName;
- mode = None;
- if (fallback != nullptr) {
- mode = getOutputModeForResolution(oi->output, fallback->width, fallback->height);
- }
- if (mode == None) {
- mode = getOutputModeForResolution(oi->output, 1920, 1080);
- }
- if (mode == None) {
- mode = getOutputModeForResolution(oi->output, 1280, 720);
- }
- if (mode == None) {
- mode = getOutputModeForResolution(oi->output, 1280, 800);
- }
- if (mode == None) {
- mode = getOutputModeForResolution(oi->output, 1152, 864);
- }
- if (mode == None) {
- mode = oi->output->modes[0];
- }
+ mode = None;
+ int maxX = 1920;
+ int maxY = 1080;
+ if (fallback != nullptr) {
+ maxX = int(fallback->width);
+ maxY = int(fallback->height);
+ mode = getOutputModeForResolution(oi->output, fallback->width, fallback->height);
+ }
+ static const std::vector<QSize> wanted = {QSize(1920, 1080), QSize(1280, 800), QSize(1280, 720), QSize(1152, 864), QSize(1024, 768)};
+ for (const QSize s : wanted) {
+ if (mode != None)
+ break;
+ if (s.width() <= maxX && s.height() <= maxY) {
+ mode = getOutputModeForResolution(oi->output, s.width(), s.height());
+ }
+ }
+ if (mode == None) {
+ mode = oi->output->modes[0];
+ }
}
if (!_modeMap.contains(mode)) {
qDebug() << "Could not pick a preferred mode";