diff options
author | Ken Moore <ken@ixsystems.com> | 2017-06-22 13:50:48 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-06-22 13:50:48 -0400 |
commit | 1ea2ff8cf7f9a012fafc4b910e940aa5627ccaa6 (patch) | |
tree | 5207612b56b0c0b28a26b858cd2ceac64bc750f1 /src-qt5/core/libLumina/test | |
parent | Merge branch 'master' of github.com:trueos/lumina (diff) | |
download | lumina-1ea2ff8cf7f9a012fafc4b910e940aa5627ccaa6.tar.gz lumina-1ea2ff8cf7f9a012fafc4b910e940aa5627ccaa6.tar.bz2 lumina-1ea2ff8cf7f9a012fafc4b910e940aa5627ccaa6.zip |
Get the LuminaRandR framework able to enable/resize/move a monitor as requested.
NOTE: The automatic resolution routine picks the larges one available for the monitor, but some monitors lie and don't actually support all the listed resolutions (probably because I am using an HDMI->VGA converter on my Laptop output right now).
Diffstat (limited to 'src-qt5/core/libLumina/test')
-rw-r--r-- | src-qt5/core/libLumina/test/main.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src-qt5/core/libLumina/test/main.cpp b/src-qt5/core/libLumina/test/main.cpp index 8f809b24..547a1846 100644 --- a/src-qt5/core/libLumina/test/main.cpp +++ b/src-qt5/core/libLumina/test/main.cpp @@ -5,9 +5,14 @@ int main(int argc, char** argv){ + QString toggle = "HDMI-2"; + QRect toggleGeom(1921,0, 1024,768); //put to the right of the default monitor + int toggleOK = -1; //-1: automatic, 0: enable monitor, 1: disable monitor + QApplication A(argc, argv); qDebug() << "Load Monitor Device Information"; OutputDeviceList devList; + qDebug() << "Detected Information:"; for(int i=0; i<devList.length(); i++){ qDebug() << "["+devList.at(i)->ID()+"]"; @@ -19,11 +24,19 @@ int main(int argc, char** argv){ qDebug() << " - Physical Size (mm):" << devList.at(i)->physicalSizeMM(); qDebug() << " - Current DPI:" << devList.at(i)->physicalDPI(); qDebug() << " - Available Resolutions:" << devList.at(i)->availableResolutions(); + if(devList.at(i)->ID() == toggle && toggleOK<0){ toggleOK = (devList.at(i)->isEnabled() ? 1 : 0); } } } - /*QString disable = "HDMI-2"; - qDebug() << "Try Disabling Monitor:" << disable; - devList.disableMonitor(disable);*/ + qDebug() << "\n================\n"; + if(toggleOK == 0){ + qDebug() << "Try Enabling Monitor:" << toggle << toggleGeom; + bool ok = devList.enableMonitor(toggle, toggleGeom); + qDebug() << " -- Success:" << ok; + }else if(toggleOK == 1){ + qDebug() << "Try Disabling Monitor:" << toggle; + bool ok = devList.disableMonitor(toggle); + qDebug() << " -- Success:" << ok; + } /*QString setprimary = "eDP-1"; if(devList.primaryMonitor() != setprimary){ |