From ca4a30188c6f2e5e044ed06c607827b374ce8bc7 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 29 Apr 2016 14:12:02 -0400 Subject: Fix a geometry calculation for panel placements on X monitors which are not aligned with the y=0 axis for the top of the monitor. --- src-qt5/core/lumina-desktop/LPanel.cpp | 20 +++++++++----------- src-qt5/core/lumina-desktop/LSession.cpp | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'src-qt5/core/lumina-desktop') diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index 8486bf1c..7c0630f5 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -118,6 +118,7 @@ void LPanel::UpdatePanel(bool geomonly){ int xwid = LSession::handle()->screenGeom(screennum).width(); int xhi = LSession::handle()->screenGeom(screennum).height(); int xloc = LSession::handle()->screenGeom(screennum).x(); + int yloc = LSession::handle()->screenGeom(screennum).y(); double panelPercent = settings->value(PPREFIX+"lengthPercent",100).toInt(); if(panelPercent<1 || panelPercent>100){ panelPercent = 100; } panelPercent = panelPercent/100.0; @@ -132,13 +133,13 @@ void LPanel::UpdatePanel(bool geomonly){ //qDebug() << " - Panel Sizing:" << xloc << sz; this->setMinimumSize(sz); this->setMaximumSize(sz); - this->setGeometry(xloc,0,sz.width(), sz.height()); + this->setGeometry(xloc,yloc,sz.width(), sz.height()); //qDebug() << " - Reserve Panel Localation"; if(!hidden){ LSession::handle()->XCB->ReserveLocation(this->winId(), this->geometry(), "top"); } else{ - LSession::handle()->XCB->ReserveLocation(this->winId(), QRect(xloc, 0, this->width(), hidesize), "top"); - hidepoint = QPoint(xloc, hidesize-ht); - showpoint = QPoint(xloc, 0); + LSession::handle()->XCB->ReserveLocation(this->winId(), QRect(xloc, yloc, this->width(), hidesize), "top"); + hidepoint = QPoint(xloc, yloc+hidesize-ht); + showpoint = QPoint(xloc, yloc); this->move(hidepoint); //Could bleed over onto the screen above } }else if(loc=="bottom"){ //bottom of screen @@ -148,17 +149,16 @@ void LPanel::UpdatePanel(bool geomonly){ else{ xloc = xloc+((xwid-sz.width())/2) ; } //centered this->setMinimumSize(sz); this->setMaximumSize(sz); - this->setGeometry(xloc,xhi-ht,sz.width(), ht ); + this->setGeometry(xloc,yloc+xhi-ht,sz.width(), ht ); if(!hidden){ LSession::handle()->XCB->ReserveLocation(this->winId(), this->geometry(), "bottom"); } else{ - LSession::handle()->XCB->ReserveLocation(this->winId(), QRect(xloc, xhi-hidesize, this->width(), hidesize), "bottom"); - hidepoint = QPoint(xloc, xhi-hidesize); - showpoint = QPoint(xloc, xhi-ht); + LSession::handle()->XCB->ReserveLocation(this->winId(), QRect(xloc,yloc+ xhi-hidesize, this->width(), hidesize), "bottom"); + hidepoint = QPoint(xloc, yloc+xhi-hidesize); + showpoint = QPoint(xloc, yloc+xhi-ht); this->move(hidepoint); //Could bleed over onto the screen below } }else if(loc=="left"){ //left side of screen QSize sz = QSize(ht, xhi*panelPercent); - int yloc = 0; if(panelPinLoc=="left"){} //this is actually the top (left of center in length dimension) else if(panelPinLoc=="right"){ yloc = yloc+xhi-sz.height(); } else{ yloc = yloc+((xhi-sz.height())/2) ; } //centered @@ -174,7 +174,6 @@ void LPanel::UpdatePanel(bool geomonly){ } }else{ //right side of screen QSize sz = QSize(ht, xhi*panelPercent); - int yloc = 0; if(panelPinLoc=="left"){} //this is actually the top (left of center in length dimension) else if(panelPinLoc=="right"){ yloc = yloc+xhi-sz.height(); } else{ yloc = yloc+((xhi-sz.height())/2) ; } //centered @@ -344,4 +343,3 @@ void LPanel::leaveEvent(QEvent *event){ checkPanelFocus(); event->accept(); //just to quiet the compile warning } - diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index 2ab01d79..7050384f 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -635,7 +635,7 @@ QFileInfoList LSession::DesktopFiles(){ QRect LSession::screenGeom(int num){ if(num < 0 || num >= this->desktop()->screenCount() ){ return QRect(); } QRect geom = this->desktop()->screenGeometry(num); - QScreen* scrn = this->screens().at(num); + /*QScreen* scrn = this->screens().at(num); //if(DEBUG){ qDebug() << "Screen Geometry:" << num << geom << scrn->geometry() << scrn->virtualGeometry(); } if(geom.isNull() ){ if( !scrn->geometry().isNull() ){ geom = scrn->geometry(); } @@ -644,7 +644,7 @@ QRect LSession::screenGeom(int num){ //Qt is backfiring (Xinarama w/ Fluxbox?) - return the saved geometry //geom = savedScreens[num]; //} - } + }*/ return geom; } -- cgit