aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-06-29 13:00:34 -0400
committerKen Moore <moorekou@gmail.com>2016-06-29 13:00:34 -0400
commitb793fe62c44bf2ddfa54222f353b0a9e587af187 (patch)
treecc733d5debdb41420e57381e61079d87c25586fe /src-qt5/core
parentMerge branch 'master' of github.com:trueos/lumina (diff)
downloadlumina-b793fe62c44bf2ddfa54222f353b0a9e587af187.tar.gz
lumina-b793fe62c44bf2ddfa54222f353b0a9e587af187.tar.bz2
lumina-b793fe62c44bf2ddfa54222f353b0a9e587af187.zip
Fix up the resizeMenu's mouse event handling to ensure it keeps control of the mouse during resize events.
Diffstat (limited to 'src-qt5/core')
-rw-r--r--src-qt5/core/libLumina/LuminaUtils.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp
index 55bfdc5a..f7012d48 100644
--- a/src-qt5/core/libLumina/LuminaUtils.cpp
+++ b/src-qt5/core/libLumina/LuminaUtils.cpp
@@ -1008,30 +1008,35 @@ void ResizeMenu::mouseMoveEvent(QMouseEvent *ev){
// since the window will be moved again the next time it is shown
// The "-2" in the sizing below accounts for the menu margins
QPoint gpos = this->mapToGlobal(ev->pos());
+ bool handled = false;
switch(resizeSide){
case TOP:
if(gpos.y() >= geom.bottom()-1){ break; }
geom.setTop(gpos.y());
this->setGeometry(geom);
- if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2)); }
+ if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));}
+ handled = true;
break;
case BOTTOM:
if(gpos.y() <= geom.top()+1){ break; }
geom.setBottom( gpos.y());
this->setGeometry(geom);
- if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2)); }
+ if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));}
+ handled = true;
break;
case LEFT:
if(gpos.x() >= geom.right()-1){ break; }
geom.setLeft(gpos.x());
this->setGeometry(geom);
- if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2)); }
+ if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));}
+ handled = true;
break;
case RIGHT:
if(gpos.x() <= geom.left()+1){ break; }
geom.setRight(gpos.x());
this->setGeometry(geom);
- if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2)); }
+ if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));}
+ handled = true;
break;
default: //NONE
//qDebug() << " - Mouse At:" << ev->pos();
@@ -1042,7 +1047,7 @@ void ResizeMenu::mouseMoveEvent(QMouseEvent *ev){
else if(ev->pos().y() >= this->height()-1 && ev->pos().y() <= this->height()+1){ this->setCursor(Qt::SizeVerCursor); }
else{ this->setCursor(Qt::ArrowCursor); }
}
- QMenu::mouseMoveEvent(ev); //do normal processing as well
+ if(!handled){ QMenu::mouseMoveEvent(ev); } //do normal processing as well
}
void ResizeMenu::mousePressEvent(QMouseEvent *ev){
@@ -1054,11 +1059,12 @@ void ResizeMenu::mousePressEvent(QMouseEvent *ev){
else if(ev->pos().y()<=1 && ev->pos().y() >= -1){ resizeSide = TOP; used = true; }
else if(ev->pos().y() >= this->height()-1 && ev->pos().y() <= this->height()+1){ resizeSide = BOTTOM; used = true; }
}
- if(used){ ev->accept(); }
+ if(used){ ev->accept(); this->grabMouse(); }
else{ QMenu::mousePressEvent(ev); } //do normal processing
}
void ResizeMenu::mouseReleaseEvent(QMouseEvent *ev){
+ this->releaseMouse();
if(ev->button() == Qt::LeftButton && resizeSide!=NONE ){
//qDebug() << "Mouse Release Event:" << ev->pos() << resizeSide;
resizeSide = NONE;
bgstack15