Fix bounds checking for "dropbox" and "moving disque" if the origin of the work-area is different from (0,0).
This commit is contained in:
parent
207a43788e
commit
537dca9a30
@ -29,8 +29,8 @@
|
|||||||
#define VER_LAMEXP_MINOR_HI 0
|
#define VER_LAMEXP_MINOR_HI 0
|
||||||
#define VER_LAMEXP_MINOR_LO 2
|
#define VER_LAMEXP_MINOR_LO 2
|
||||||
#define VER_LAMEXP_TYPE Alpha
|
#define VER_LAMEXP_TYPE Alpha
|
||||||
#define VER_LAMEXP_PATCH 7
|
#define VER_LAMEXP_PATCH 8
|
||||||
#define VER_LAMEXP_BUILD 469
|
#define VER_LAMEXP_BUILD 470
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Tools versions
|
// Tools versions
|
||||||
|
@ -187,12 +187,12 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta
|
|||||||
fourthButton->setMinimumWidth(90);
|
fourthButton->setMinimumWidth(90);
|
||||||
|
|
||||||
QPixmap disque(":/images/Disque.png");
|
QPixmap disque(":/images/Disque.png");
|
||||||
m_screenGeometry = QApplication::desktop()->availableGeometry();
|
QRect screenGeometry = QApplication::desktop()->availableGeometry();
|
||||||
m_disque = new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
m_disque = new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
||||||
m_disque->installEventFilter(this);
|
m_disque->installEventFilter(this);
|
||||||
m_disque->setStyleSheet("background:transparent;");
|
m_disque->setStyleSheet("background:transparent;");
|
||||||
m_disque->setAttribute(Qt::WA_TranslucentBackground);
|
m_disque->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
m_disque->setGeometry(qrand() % (m_screenGeometry.width() - disque.width()), qrand() % (m_screenGeometry.height() - disque.height()), disque.width(), disque.height());
|
m_disque->setGeometry(qrand() % (screenGeometry.width() - disque.width()), qrand() % (screenGeometry.height() - disque.height()), disque.width(), disque.height());
|
||||||
m_disque->setPixmap(disque);
|
m_disque->setPixmap(disque);
|
||||||
m_disque->setWindowOpacity(0.01);
|
m_disque->setWindowOpacity(0.01);
|
||||||
m_disque->show();
|
m_disque->show();
|
||||||
@ -493,7 +493,7 @@ void AboutDialog::moveDisque(void)
|
|||||||
{
|
{
|
||||||
if(m_disqueDelay != _I64_MAX)
|
if(m_disqueDelay != _I64_MAX)
|
||||||
{
|
{
|
||||||
double delay = static_cast<double>(perfCount.QuadPart) - static_cast<double>(m_disqueDelay);
|
const double delay = static_cast<double>(perfCount.QuadPart) - static_cast<double>(m_disqueDelay);
|
||||||
delta = max(1, min(128, static_cast<int>(ceil(delay / static_cast<double>(perfFrequ.QuadPart) / 0.00512))));
|
delta = max(1, min(128, static_cast<int>(ceil(delay / static_cast<double>(perfFrequ.QuadPart) / 0.00512))));
|
||||||
}
|
}
|
||||||
m_disqueDelay = perfCount.QuadPart;
|
m_disqueDelay = perfCount.QuadPart;
|
||||||
@ -501,32 +501,38 @@ void AboutDialog::moveDisque(void)
|
|||||||
|
|
||||||
if(m_disque)
|
if(m_disque)
|
||||||
{
|
{
|
||||||
|
QRect screenGeometry = QApplication::desktop()->availableGeometry();
|
||||||
|
const int minX = screenGeometry.left();
|
||||||
|
const int maxX = screenGeometry.width() - m_disque->width() + screenGeometry.left();
|
||||||
|
const int minY = screenGeometry.top();
|
||||||
|
const int maxY = screenGeometry.height() - m_disque->height() + screenGeometry.top();
|
||||||
|
|
||||||
QPoint pos = m_disque->pos();
|
QPoint pos = m_disque->pos();
|
||||||
pos.setX(m_disqueFlags[0] ? pos.x() + delta : pos.x() - delta);
|
pos.setX(m_disqueFlags[0] ? pos.x() + delta : pos.x() - delta);
|
||||||
pos.setY(m_disqueFlags[1] ? pos.y() + delta : pos.y() - delta);
|
pos.setY(m_disqueFlags[1] ? pos.y() + delta : pos.y() - delta);
|
||||||
|
|
||||||
if(pos.x() <= 0)
|
if(pos.x() <= minX)
|
||||||
{
|
{
|
||||||
m_disqueFlags[0] = true;
|
m_disqueFlags[0] = true;
|
||||||
pos.setX(0);
|
pos.setX(minX);
|
||||||
m_rotateNext = true;
|
m_rotateNext = true;
|
||||||
}
|
}
|
||||||
else if(pos.x() >= m_screenGeometry.width() - m_disque->width())
|
else if(pos.x() >= maxX)
|
||||||
{
|
{
|
||||||
m_disqueFlags[0] = false;
|
m_disqueFlags[0] = false;
|
||||||
pos.setX(m_screenGeometry.width() - m_disque->width());
|
pos.setX(maxX);
|
||||||
m_rotateNext = true;
|
m_rotateNext = true;
|
||||||
}
|
}
|
||||||
if(pos.y() <= 0)
|
if(pos.y() <= minY)
|
||||||
{
|
{
|
||||||
m_disqueFlags[1] = true;
|
m_disqueFlags[1] = true;
|
||||||
pos.setY(0);
|
pos.setY(minY);
|
||||||
m_rotateNext = true;
|
m_rotateNext = true;
|
||||||
}
|
}
|
||||||
else if(pos.y() >= m_screenGeometry.height()- m_disque->height())
|
else if(pos.y() >= maxY)
|
||||||
{
|
{
|
||||||
m_disqueFlags[1] = false;
|
m_disqueFlags[1] = false;
|
||||||
pos.setY(m_screenGeometry.height() - m_disque->height());
|
pos.setY(maxY);
|
||||||
m_rotateNext = true;
|
m_rotateNext = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,6 @@ private:
|
|||||||
QLabel *m_disque;
|
QLabel *m_disque;
|
||||||
QTimer * m_disqueTimer;
|
QTimer * m_disqueTimer;
|
||||||
bool m_disqueFlags[2];
|
bool m_disqueFlags[2];
|
||||||
QRect m_screenGeometry;
|
|
||||||
QPixmap *m_cartoon[4];
|
QPixmap *m_cartoon[4];
|
||||||
bool m_rotateNext;
|
bool m_rotateNext;
|
||||||
__int64 m_disqueDelay;
|
__int64 m_disqueDelay;
|
||||||
|
@ -116,8 +116,8 @@ void DropBox::showEvent(QShowEvent *event)
|
|||||||
if(m_firstShow)
|
if(m_firstShow)
|
||||||
{
|
{
|
||||||
m_firstShow = false;
|
m_firstShow = false;
|
||||||
int max_x = screenGeometry.width() - frameGeometry().width();
|
int max_x = screenGeometry.width() - frameGeometry().width() + screenGeometry.left();
|
||||||
int max_y = screenGeometry.height() - frameGeometry().height();
|
int max_y = screenGeometry.height() - frameGeometry().height() + screenGeometry.top();
|
||||||
move(max_x, max_y);
|
move(max_x, max_y);
|
||||||
QTimer::singleShot(333, this, SLOT(showToolTip()));
|
QTimer::singleShot(333, this, SLOT(showToolTip()));
|
||||||
}
|
}
|
||||||
@ -180,14 +180,13 @@ void DropBox::mouseMoveEvent(QMouseEvent *event)
|
|||||||
static const int magnetic = 22;
|
static const int magnetic = 22;
|
||||||
QRect screenGeometry = QApplication::desktop()->availableGeometry();
|
QRect screenGeometry = QApplication::desktop()->availableGeometry();
|
||||||
|
|
||||||
int delta_x = m_mouseReferencePoint.x() - event->globalX();
|
const int delta_x = m_mouseReferencePoint.x() - event->globalX();
|
||||||
int delta_y = m_mouseReferencePoint.y() - event->globalY();
|
const int delta_y = m_mouseReferencePoint.y() - event->globalY();
|
||||||
|
const int max_x = screenGeometry.width() - frameGeometry().width() + screenGeometry.left();
|
||||||
int max_x = screenGeometry.width() - frameGeometry().width();
|
const int max_y = screenGeometry.height() - frameGeometry().height() + screenGeometry.top();
|
||||||
int max_y = screenGeometry.height() - frameGeometry().height();
|
|
||||||
|
|
||||||
int new_x = min(max_x, max(0, m_windowReferencePoint.x() - delta_x));
|
int new_x = min(max_x, max(screenGeometry.left(), m_windowReferencePoint.x() - delta_x));
|
||||||
int new_y = min(max_y, max(0, m_windowReferencePoint.y() - delta_y));
|
int new_y = min(max_y, max(screenGeometry.top(), m_windowReferencePoint.y() - delta_y));
|
||||||
|
|
||||||
if(new_x < magnetic)
|
if(new_x < magnetic)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user