diff options
-rw-r--r-- | src-qt5/core/libLumina/LuminaRandR-X11.cpp | 45 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaSingleApplication.cpp | 4 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.cpp | 4 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.h | 4 | ||||
-rw-r--r-- | src-qt5/core/libLumina/test/main.cpp | 4 | ||||
-rw-r--r-- | src-qt5/core/lumina-checkpass/main.c | 8 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp | 5 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Fireflies.h | 2 |
8 files changed, 58 insertions, 18 deletions
diff --git a/src-qt5/core/libLumina/LuminaRandR-X11.cpp b/src-qt5/core/libLumina/LuminaRandR-X11.cpp index edd90afa..ab3a49f0 100644 --- a/src-qt5/core/libLumina/LuminaRandR-X11.cpp +++ b/src-qt5/core/libLumina/LuminaRandR-X11.cpp @@ -130,11 +130,43 @@ inline xcb_randr_mode_t modeForResolution(QSize res, QList<xcb_randr_mode_t> mod return det_mode; } +inline void adjustScreenTotal(xcb_randr_crtc_t output, QRect geom, bool addingoutput){ + QRect total, mmTotal; + xcb_randr_get_screen_resources_reply_t *srreply = xcb_randr_get_screen_resources_reply(QX11Info::connection(), + xcb_randr_get_screen_resources_unchecked(QX11Info::connection(), QX11Info::appRootWindow()), NULL); + if(srreply!=0){ + for(int i=0; i<xcb_randr_get_screen_resources_crtcs_length(srreply); i++){ + xcb_randr_crtc_t crtc = xcb_randr_get_screen_resources_crtcs(srreply)[i]; + if(output == crtc){ + //Found the output we are (going) to treat differently + if(addingoutput){ + total = total.united(geom); + } + //ignore the output if we just removed it + }else{ + //Get the current geometry of this crtc (if available) and add it to the total + xcb_randr_get_crtc_info_reply_t *cinfo = xcb_randr_get_crtc_info_reply(QX11Info::connection(), + xcb_randr_get_crtc_info_unchecked(QX11Info::connection(), crtc, QX11Info::appTime()), + NULL); + if(cinfo!=0){ + total = total.united( QRect(cinfo->x, cinfo->y, cinfo->width, cinfo->height) ); + //QSize dpi( qRound((cinfo->width * 25.4)/cinfo->), qRound((p_obj.geometry.height() * 25.4)/p_obj.physicalSizeMM.height() ) ); + free(cinfo); //done with crtc_info + } + } + } + free(srreply); + } + QSize newRes = total.size(); + QSize newMM = mmTotal.size(); + xcb_randr_set_screen_size(QX11Info::connection(), QX11Info::appRootWindow(), newRes.width(), newRes.height(), newMM.width(), newMM.height()); +} + inline bool showOutput(QRect geom, p_objects *p_obj){ //if no geom provided, will add as the right-most screen at optimal resolution qDebug() << "Enable Monitor:" << geom; xcb_randr_mode_t mode = modeForResolution(geom.size(), p_obj->modes); - if(mode==XCB_NONE){ return false; } //invalid resolution for this monitor + if(mode==XCB_NONE){ qDebug() << "[ERROR] Invalid resolution supplied!"; return false; } //invalid resolution for this monitor //qDebug() << " - Found Mode:" << mode; if(p_obj->crtc == 0){ //Need to scan for an available crtc to use (turning on a monitor for the first time) @@ -158,6 +190,10 @@ inline bool showOutput(QRect geom, p_objects *p_obj){ } free(reply); } +if(p_obj->crtc == 0){ qDebug() << "[ERROR] No Available CRTC devices for display"; return false; } + //Now need to update the overall session size (if necessary) + adjustScreenTotal(p_obj->crtc, geom, true); //adding output at this geometry + //qDebug() << " - Using crtc:" << p_obj->crtc; //qDebug() << " - Using mode:" << mode; xcb_randr_output_t outList[1]{ p_obj->output }; @@ -166,8 +202,8 @@ inline bool showOutput(QRect geom, p_objects *p_obj){ XCB_CURRENT_TIME, XCB_CURRENT_TIME, geom.x(), geom.y(), mode, XCB_RANDR_ROTATION_ROTATE_0, 1, outList); //Now check the result of the configuration xcb_randr_set_crtc_config_reply_t *reply = xcb_randr_set_crtc_config_reply(QX11Info::connection(), cookie, NULL); - if(reply==0){ return false; } - bool ok = (reply->status == XCB_RANDR_SET_CONFIG_SUCCESS); + bool ok = false; + if(reply!=0){ ok = (reply->status == XCB_RANDR_SET_CONFIG_SUCCESS); } free(reply); return ok; } @@ -247,6 +283,9 @@ bool OutputDevice::disable(){ if(reply==0){ return false; } bool ok = (reply->status == XCB_RANDR_SET_CONFIG_SUCCESS); free(reply); + if(ok){ + adjustScreenTotal(p_obj.crtc, QRect(), false); //adding output at this geometry + } return ok; } return false; diff --git a/src-qt5/core/libLumina/LuminaSingleApplication.cpp b/src-qt5/core/libLumina/LuminaSingleApplication.cpp index e3816add..a97753c5 100644 --- a/src-qt5/core/libLumina/LuminaSingleApplication.cpp +++ b/src-qt5/core/libLumina/LuminaSingleApplication.cpp @@ -15,7 +15,7 @@ LSingleApplication::LSingleApplication(int &argc, char **argv, QString appname) : QApplication(argc, argv){ //Load the proper translation systems - this->setAttribute(Qt::AA_UseHighDpiPixmaps); + this->setAttribute(Qt::AA_UseHighDpiPixmaps); if(appname!="lumina-desktop"){ cTrans = LUtils::LoadTranslation(this, appname); }//save the translator for later //Initialize a couple convenience internal variables cfile = QDir::tempPath()+"/.LSingleApp-%1-%2-%3"; @@ -25,7 +25,7 @@ LSingleApplication::LSingleApplication(int &argc, char **argv, QString appname) cfile = cfile.arg( username, appname, QString::number(QX11Info::appScreen()) ); lockfile = new QLockFile(cfile+"-lock"); lockfile->setStaleLockTime(0); //long-lived processes - for(int i=1; i<argc; i++){ + for(int i=1; i<argc; i++){ QString path = QString::fromLocal8Bit(argv[i]); //do few quick conversions for relative paths and such as necessary // (Remember: this is only used for secondary processes, not the primary) diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 688a1d07..41c04ee1 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -10,7 +10,7 @@ #include <QVBoxLayout> #include <QVBoxLayout> -#define WIN_BORDER 3 +#define WIN_BORDER 3 // === PUBLIC === RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){ @@ -274,7 +274,7 @@ void RootSubWindow::mousePressEvent(QMouseEvent *ev){ activeState = getStateAtPoint(ev->pos(), true); //also have it set the offset variable } setMouseCursor(activeState, true); //this one is an override cursor - + } void RootSubWindow::mouseMoveEvent(QMouseEvent *ev){ diff --git a/src-qt5/core/libLumina/RootSubWindow.h b/src-qt5/core/libLumina/RootSubWindow.h index 8c5ef2b8..779f783b 100644 --- a/src-qt5/core/libLumina/RootSubWindow.h +++ b/src-qt5/core/libLumina/RootSubWindow.h @@ -30,7 +30,7 @@ public: WId id(); private: - //Window status + //Window status enum ModState{Normal, Move, ResizeTop, ResizeTopRight, ResizeRight, ResizeBottomRight, ResizeBottom, ResizeBottomLeft, ResizeLeft, ResizeTopLeft}; ModState activeState; ModState currentCursor; @@ -64,7 +64,7 @@ public slots: //Mouse Interactivity void startMoving(); void startResizing(); - + private slots: void propertiesChanged(QList<NativeWindow::Property>, QList<QVariant>); diff --git a/src-qt5/core/libLumina/test/main.cpp b/src-qt5/core/libLumina/test/main.cpp index 056f1d28..f78efbd1 100644 --- a/src-qt5/core/libLumina/test/main.cpp +++ b/src-qt5/core/libLumina/test/main.cpp @@ -5,8 +5,8 @@ int main(int argc, char** argv){ - QString toggle = "HDMI-2"; - QRect toggleGeom(1920,0, 1920,1080); + QString toggle = "DVI-I-1"; + QRect toggleGeom(7680,0, 1024,768); int toggleOK = -1; //-1: automatic, 0: enable monitor, 1: disable monitor QApplication A(argc, argv); diff --git a/src-qt5/core/lumina-checkpass/main.c b/src-qt5/core/lumina-checkpass/main.c index 2a8bba93..e12e7c78 100644 --- a/src-qt5/core/lumina-checkpass/main.c +++ b/src-qt5/core/lumina-checkpass/main.c @@ -31,16 +31,16 @@ int main(int argc, char** argv){ puts("Returns: 0 for a valid password, 1 for invalid"); return 1; } - //Validate current user (make sure current UID matches the logged-in user, + //Validate current user (make sure current UID matches the logged-in user, char* cUser = getlogin(); struct passwd *pwd = 0; pwd = getpwnam(cUser); if(pwd==0){ return 1; } //Login user could not be found in the database? (should never happen) if( getuid() != pwd->pw_uid ){ return 1; } //Current UID does not match currently logged-in user UID - //Create the non-interactive PAM structures + //Create the non-interactive PAM structures pam_handle_t *pamh; struct pam_conv pamc = { openpam_nullconv, NULL }; - //Place the user-supplied password into the structure + //Place the user-supplied password into the structure int ret = pam_start( "system", cUser, &pamc, &pamh); if(ret != PAM_SUCCESS){ return 1; } //could not init PAM //char* cPassword = argv[1]; @@ -52,4 +52,4 @@ int main(int argc, char** argv){ pam_end(pamh,ret); //return verification result return ((ret==PAM_SUCCESS) ? 0 : 1); -}
\ No newline at end of file +} diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp b/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp index 4cc6d68b..cdcf2434 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp @@ -10,13 +10,13 @@ #include <unistd.h> #define NUMTRIES 3 -#define WAITMINS 1 +//#define WAITMINS 1 #define DEBUG 1 LLockScreen::LLockScreen(QWidget *parent) : QWidget(parent), ui(new Ui::LLockScreen()){ ui->setupUi(this); waittime = new QTimer(this); - waittime->setInterval(WAITMINS*60000); //(too many attempts in short time) + //waittime->setInterval(WAITMINS*60000); //(too many attempts in short time) waittime->setSingleShot(true); refreshtime = new QTimer(this); //timer to update the wait time display refreshtime->setInterval(6000); //6 seconds (1/10 second) @@ -92,6 +92,7 @@ void LLockScreen::TryUnlock(){ if(triesleft>0){ this->setEnabled(true); }else{ + waittime->setInterval( (attempts/NUMTRIES)*60000); waittime->start(); refreshtime->start(); } diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Fireflies.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Fireflies.h index 4e5acc3c..f1ef5fa3 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Fireflies.h +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Fireflies.h @@ -83,7 +83,7 @@ public: this->stop(); //while(fireflies.length()>0){ fireflies.takeAt(0)->deleteLater(); } } - + void LoadAnimations(){ while(fireflies.length()>0){ fireflies.takeAt(0)->deleteLater(); } canvas->setStyleSheet("background: black;"); |