summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widget.cpp41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/widget.cpp b/src/widget.cpp
index fd89af8..cc7fd97 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -22,7 +22,7 @@
#define INTERFACE "eth0"
#define GROUP_SPECIFIC "SpecificSettings"
-#define DEBUG
+//#define DEBUG
//_____________________________________________________________________________
@@ -296,7 +296,10 @@ Widget::Widget(QWidget *parent) :
// Fill widget with data
for ( QList<QPair<XRRModeInfo*, XRRModeInfo*> >::iterator i = commonModes.begin();
i != commonModes.end(); ++i ) {
- qDebug() << "Combo insert" << i->first->width << "x" << i->first->height ;
+ qDebug() << "Insert into QComboBox"
+ << i->first->width << "x" << i->first->height
+ << "\t\tBEAMER:" << QVariant((qulonglong)i->first->id).toULongLong()
+ << " \tMONITOR:" << QVariant((qulonglong)i->second->id).toULongLong();
_ui->comboBox->addItem(i->first->name,
QList<QVariant>()
<< QVariant((qulonglong)i->first->id)
@@ -348,10 +351,13 @@ void Widget::updateScreenResources()
_modeMap.clear();
// Create the modemap
+ qDebug() << "_MODES_";
for (int i = 0; i < _screenResources->nmode; ++i) {
_modeMap.insert(
_screenResources->modes[i].id,
&_screenResources->modes[i]);
+ qDebug() << _screenResources->modes[i].id << "\t"
+ << _screenResources->modes[i].width << "x" << _screenResources->modes[i].height;
}
// Clear the crtmap
@@ -411,10 +417,13 @@ void Widget::handleButton()
CrtcMap backup;
for ( CrtcMap::iterator it = _crtcMap.begin();
it != _crtcMap.end(); ++it ) {
+
+ qDebug() << " Key is " << it.key();
backup[it.key()] = new XRRCrtcInfo;
backup[it.key()]->x = it.value()->x;
backup[it.key()]->y = it.value()->y;
backup[it.key()]->mode = it.value()->mode;
+ qDebug() << " Moed is " << backup[it.key()]->mode;
backup[it.key()]->rotation = it.value()->rotation;
backup[it.key()]->noutput = it.value()->noutput;
backup[it.key()]->outputs = new RROutput[it.value()->noutput];
@@ -474,7 +483,7 @@ void Widget::handleButton()
if ( ! keepDialog->wasCanceled()) {
// First disconnect all crts to avoid conflicts
- qDebug() << "// First disconnect all crts to avoid conflicts";
+ qDebug() << "disconnect all crts to avoid conflicts";
for ( CrtcMap::iterator it = _crtcMap.begin();
it != _crtcMap.end(); ++it ) {
XRRSetCrtcConfig(_display,
@@ -488,24 +497,24 @@ void Widget::handleButton()
}
// Then calc backed up screensize
- qDebug() << "// 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 ) {
-
- qDebug() << "// Then calc backed up screensize";
-
- ScreenSize.setWidth(
- std::max((uint)ScreenSize.width(),
- it.value()->x+_modeMap[it.value()->mode]->width));
-
- ScreenSize.setHeight(
- std::max((uint)ScreenSize.height(),
- it.value()->y+_modeMap[it.value()->mode]->height));
+ // Dangerzone. Only access existing modes!
+ if ( it.value()->mode != None ) {
+ ScreenSize.setWidth(
+ std::max((uint)ScreenSize.width(),
+ it.value()->x+_modeMap.at(it.value()->mode)->width));
+ ScreenSize.setHeight(
+ std::max((uint)ScreenSize.height(),
+ it.value()->y+_modeMap.at(it.value()->mode)->height));
+ }
}
+ qDebug() << "screensize is" << ScreenSize;
// Set screensize
- qDebug() << "// Set screensize";
+ qDebug() << "Apply screensize";
XRRSetScreenSize(_display, DefaultRootWindow(_display),
ScreenSize.width(),
ScreenSize.height(),
@@ -516,6 +525,8 @@ void Widget::handleButton()
qDebug() << "Then apply the backup";
for ( CrtcMap::iterator it = backup.begin();
it != backup.end(); ++it ) {
+
+ qDebug() << "CRTC" << it.key() << "MODE" << it.value()->mode;
XRRSetCrtcConfig(_display,
_screenResources,
it.key(),