From 5fe82df443a563f2c2010b256b9119d754580ee2 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 15 Feb 2017 15:30:26 -0500 Subject: Commit a bit more work on the RandR interface. Starting to drill down into the various options that are available. --- src-qt5/core/libLumina/LuminaRandR-X11.cpp | 66 +++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 15 deletions(-) (limited to 'src-qt5') diff --git a/src-qt5/core/libLumina/LuminaRandR-X11.cpp b/src-qt5/core/libLumina/LuminaRandR-X11.cpp index 64712fd0..85251b64 100644 --- a/src-qt5/core/libLumina/LuminaRandR-X11.cpp +++ b/src-qt5/core/libLumina/LuminaRandR-X11.cpp @@ -12,10 +12,35 @@ #include #include +static QString atomToName(xcb_atom_t atom){ + xcb_get_atom_name_reply_t *nreply = xcb_get_atom_name_reply(QX11Info::connection(), xcb_get_atom_name_unchecked(QX11Info::connection(), atom), NULL); + QString name = QString::fromLocal8Bit(xcb_get_atom_name_name(nreply), xcb_get_atom_name_name_length(nreply)); + free(nreply); + return name; +}; + +//More efficient method for converting lots of atoms to strings +static QStringList atomsToNames(xcb_atom_t *atoms, unsigned int num){ + //qDebug() << "atomsToNames:" << num; + QList< xcb_get_atom_name_cookie_t > cookies; + //qDebug() << " - Get cookies"; + for(unsigned int i=0; i outputs; //the actual output devices used by the monitor + }; //Global Listing of Devices @@ -33,9 +58,10 @@ QList OutputDevice::availableMonitors(){ while(iter.rem>0){ qDebug() << "Found Monitor:"; //qDebug() << " Index:" << iter.index << "Rem:" << iter.rem; - xcb_get_atom_name_reply_t *nreply = xcb_get_atom_name_reply(QX11Info::connection(), xcb_get_atom_name_unchecked(QX11Info::connection(), iter.data->name), NULL); + QString name = atomToName(iter.data->name); + /*xcb_get_atom_name_reply_t *nreply = xcb_get_atom_name_reply(QX11Info::connection(), xcb_get_atom_name_unchecked(QX11Info::connection(), iter.data->name), NULL); QString name = QString::fromLocal8Bit(xcb_get_atom_name_name(nreply), xcb_get_atom_name_name_length(nreply)); - free(nreply); + free(nreply);*/ qDebug() << " - Name:" << iter.data->name << name; qDebug() << " - Primary:" << (iter.data->primary == 1); @@ -102,8 +128,16 @@ OutputDeviceList::OutputDeviceList(){ qDebug() << "Probing Screen Resources:"; qDebug() << " - Number of Outputs:" << outputnum; qDebug() << " - Number of CRTC's:" << xcb_randr_get_screen_resources_crtcs_length(reply); - qDebug() << " - Number of Modes:" << xcb_randr_get_screen_resources_modes_length(reply); - qDebug() << " - Number of Names:" << xcb_randr_get_screen_resources_names_length(reply); + int mode_len =xcb_randr_get_screen_resources_modes_length(reply); + qDebug() << " - Modes:" << mode_len; + for(int m=0; m