From c5cd53f89b8a456166e8d22ddf74377626991a92 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 21 Jun 2017 08:52:52 -0400 Subject: Hotpatch to lumina-xconfig. If the screens do not exactly line up next to each other, just put them in the list anyway. Also list the origin point for each monitor in the details as well (just in case). --- src-qt5/core-utils/lumina-xconfig/MainUI.cpp | 47 +++++++++++++++++++--------- src-qt5/core-utils/lumina-xconfig/MainUI.h | 2 ++ 2 files changed, 34 insertions(+), 15 deletions(-) (limited to 'src-qt5') diff --git a/src-qt5/core-utils/lumina-xconfig/MainUI.cpp b/src-qt5/core-utils/lumina-xconfig/MainUI.cpp index 169302ca..6553bb37 100644 --- a/src-qt5/core-utils/lumina-xconfig/MainUI.cpp +++ b/src-qt5/core-utils/lumina-xconfig/MainUI.cpp @@ -32,7 +32,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ } MainUI::~MainUI(){ - + } void MainUI::loadIcons(){ @@ -55,10 +55,10 @@ QStringList MainUI::currentOpts(){ if(SCREENS[i].order <0){ continue; } //skip this screen - non-active opts << "--output" << SCREENS[i].ID << "--mode" << QString::number(SCREENS[i].geom.width())+"x"+QString::number(SCREENS[i].geom.height()); if(SCREENS[i].isprimary){ opts << "--primary"; } - if(SCREENS[i].order > 0){ + if(SCREENS[i].order > 0){ //Get the ID of the previous screen - QString id; - for(int j=0; jsetTextAlignment(Qt::AlignCenter); + it->setText( screen.ID+"\n\n ("+QString::number(screen.geom.x())+", "+QString::number(screen.geom.y())+")\n ("+QString::number(screen.geom.width())+"x"+QString::number(screen.geom.height())+") " ); + it->setWhatsThis(screen.ID); + ui->list_screens->addItem(it); +} + void MainUI::UpdateScreens(){ //First probe the server for current screens SCREENS = RRSettings::CurrentScreens(); @@ -86,10 +94,10 @@ void MainUI::UpdateScreens(){ for(int i=0; ix++" cscreen.geom.setRect( devres.section("+",-2,-2).toInt(), devres.section("+",-1,-1).toInt(), devres.section("x",0,0).toInt(), devres.section("+",0,0).section("x",1,1).toInt() ); - + }else if(info[i].contains(" connected")){ //Device that is connected, but not attached qDebug() << "Create new Screen entry:" << dev << "none"; @@ -136,22 +144,31 @@ void MainUI::UpdateScreens(){ while(found){ found = false; //make sure to break out if a screen is not found for(int i=0; isetTextAlignment(Qt::AlignCenter); - it->setText( SCREENS[i].ID+"\n ("+QString::number(SCREENS[i].geom.width())+"x"+QString::number(SCREENS[i].geom.height())+") " ); + it->setText( SCREENS[i].ID+"\n ("+QString::number(SCREENS[i].geom.x())+", "+QString::number(SCREENS[i].geom.y())+")\n("+QString::number(SCREENS[i].geom.width())+"x"+QString::number(SCREENS[i].geom.height())+") " ); it->setWhatsThis(SCREENS[i].ID); - ui->list_screens->addItem(it); - if(SCREENS[i].ID==csel){ ui->list_screens->setCurrentItem(it); } + ui->list_screens->addItem(it);*/ + //if(SCREENS[i].ID==csel){ ui->list_screens->setCurrentItem(it); } + }else if(SCREENS[i].geom.x() < xoffset || SCREENS[i].geom.x() > xoffset){ + //Screen not aligned with previous screen edge + qDebug() << "Found mis-aligned screen:" << i << SCREENS[i].ID; + found = true; //make sure to look for the next one + xoffset = xoffset+SCREENS[i].geom.width(); //next number to look for + SCREENS[i].order = cnum; //assign the current order to it + cnum++; //get ready for the next one + AddScreenToWidget(SCREENS[i]); } } } - + //Now update the available/current screens in the UI ui->combo_availscreens->clear(); ui->combo_cscreens->clear(); @@ -219,7 +236,7 @@ void MainUI::MoveScreenLeft(){ } //Now run the command QStringList opts = currentOpts(); - LUtils::runCmd("xrandr", opts); + LUtils::runCmd("xrandr", opts); //Now run the command //LUtils::runCmd("xrandr", QStringList() << "--output" << CID << "--left-of" << LID); QTimer::singleShot(500, this, SLOT(UpdateScreens()) ); diff --git a/src-qt5/core-utils/lumina-xconfig/MainUI.h b/src-qt5/core-utils/lumina-xconfig/MainUI.h index b8be8701..5a1a62cc 100644 --- a/src-qt5/core-utils/lumina-xconfig/MainUI.h +++ b/src-qt5/core-utils/lumina-xconfig/MainUI.h @@ -38,6 +38,8 @@ private: QStringList currentOpts(); + void AddScreenToWidget(ScreenInfo); + private slots: void UpdateScreens(); void ScreenSelected(); -- cgit