summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Schneider2013-12-02 17:41:26 +0100
committerManuel Schneider2013-12-02 17:41:26 +0100
commit3421c6135f3c54170c9b4bf08c516b38868610f4 (patch)
treea87356206d8b32c1652b266850353aef23c113e6
parentAdded config files (diff)
downloadbeamergui-3421c6135f3c54170c9b4bf08c516b38868610f4.tar.gz
beamergui-3421c6135f3c54170c9b4bf08c516b38868610f4.tar.xz
beamergui-3421c6135f3c54170c9b4bf08c516b38868610f4.zip
Bugfix with fallback resolution
-rw-r--r--src/beamer.conf5
-rw-r--r--src/widget.cpp25
2 files changed, 27 insertions, 3 deletions
diff --git a/src/beamer.conf b/src/beamer.conf
index e83f5a7..bc58af2 100644
--- a/src/beamer.conf
+++ b/src/beamer.conf
@@ -1,4 +1,7 @@
[SpecificSettings]
# IP specific configs
-132.230.4.100=1280x800
132.230.4.26=1280x800
+132.230.4.100=1280x800
+132.230.4.120=1280x800
+132.230.4.140=1280x800
+132.230.4.160=1280x800
diff --git a/src/widget.cpp b/src/widget.cpp
index 78afbd7..a1b4629 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -29,6 +29,7 @@ Widget::Widget(QWidget *parent) :
{
_ui->setupUi(this);
+
// Get initial data (to be freed)
_display = XOpenDisplay(NULL);
_screenResources = XRRGetScreenResourcesCurrent(_display, DefaultRootWindow(_display));
@@ -271,6 +272,8 @@ Widget::Widget(QWidget *parent) :
// Remove borders and stuff COMMENT FOR DEBUIGGIN
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
+ // setStyleSheet("background:transparent;");
+ setAttribute(Qt::WA_TranslucentBackground);
// Resize widget to its content
resize(sizeHint());
@@ -369,6 +372,7 @@ Widget::~Widget()
void Widget::handleButton()
{
// Backup the crtcinfos
+ qDebug() << "// Backup the crtcinfos";
CrtcMap backup;
for ( CrtcMap::iterator it = _crtcMap.begin();
it != _crtcMap.end(); ++it ) {
@@ -385,12 +389,14 @@ void Widget::handleButton()
}
// First get a useful representation
+ qDebug() << "// First get a useful representation";
unsigned int width, height;
QStringList modeAsStrings = _ui->comboBox->currentText().split("x", QString::SkipEmptyParts);
width = modeAsStrings.at(0).toInt();
height = modeAsStrings.at(1).toInt();
// Find a mode that matches the string
+ qDebug() << "// Find a mode that matches the string";
RRMode m1,m2;
for (int i = 0; i < _outputMap[_monitor]->nmode; ++i){
if ( width == _modeMap[_outputMap[_monitor]->modes[i]]->width
@@ -404,6 +410,7 @@ void Widget::handleButton()
}
// Set screensize
+ qDebug() << "// Set screensize";
XRRSetScreenSize(_display, DefaultRootWindow(_display),
width,
height,
@@ -411,6 +418,7 @@ void Widget::handleButton()
25.4 * height / 96); // standard dpi that X uses
// Apply the modes
+ qDebug() << "// Apply the modes";
XRRSetCrtcConfig(_display,
_screenResources,
_outputMap[_monitor]->crtc,
@@ -427,22 +435,27 @@ void Widget::handleButton()
&_beamer, 1);
// Center widget on screenbottom
+ qDebug() << "// Center widget on screenbottom";
this->move( width/2 - this->width()/2, height - this->height());
// Show a dialog asking if the res should be kept
- TimeOutDialog *t = new TimeOutDialog(5, this);/*
- t->setWindowModality(Qt::WindowModal);*/
+ qDebug() << "// Show a dialog asking if the res should be kept";
+ TimeOutDialog *t = new TimeOutDialog(15, this);
+ t->setWindowTitle(" ");
t->setLabelText("Do you want to keep this resolution?");
t->setCancelButtonText("Keep");
t->exec();
// Center the dialog
+ qDebug() << "// Center the dialog";
t->move( width/2 - this->width()/2, height/2 - this->height());
// If the dialog was not canceled revert the resolution
+ qDebug() << "// If the dialog was not canceled revert the resolution";
if ( ! t->wasCanceled()) {
// First disconnect all crts to avoid conflicts
+ qDebug() << "// First disconnect all crts to avoid conflicts";
for ( CrtcMap::iterator it = _crtcMap.begin();
it != _crtcMap.end(); ++it ) {
XRRSetCrtcConfig(_display,
@@ -456,6 +469,7 @@ void Widget::handleButton()
}
// Then calc backed up screensize
+ qDebug() << "// Then calc backed up screensize";
QSize ScreenSize(0,0);
for ( CrtcMap::iterator it = backup.begin();
it != backup.end(); ++it ) {
@@ -468,6 +482,7 @@ void Widget::handleButton()
}
// Set screensize
+ qDebug() << "// Set screensize";
XRRSetScreenSize(_display, DefaultRootWindow(_display),
ScreenSize.width(),
ScreenSize.height(),
@@ -475,6 +490,7 @@ void Widget::handleButton()
25.4 * ScreenSize.height() / 96); // standard dpi that X uses
// Then apply the backup
+ qDebug() << "Then apply the backup";
for ( CrtcMap::iterator it = backup.begin();
it != backup.end(); ++it ) {
XRRSetCrtcConfig(_display,
@@ -490,17 +506,22 @@ void Widget::handleButton()
}
// Again center dialog on screenbottom
+ qDebug() << "Again center dialog on screenbottom";
this->move( ScreenSize.width()/2 - this->width()/2,
ScreenSize.height() - this->height());
} // End of Revert section
// Delete the backup
+ qDebug() << "Delete the backup";
for ( CrtcMap::iterator it = backup.begin();
it != backup.end(); ++it ) {
delete[] it.value()->outputs;
delete it.value();
}
+
+ // Intenal settings changed. Update!
+ updateScreenResources();
}