effects/desktopgrid: Port to QStyleHints
Let's us avoid making the desktop grid effect depend on qtwidgets. CCBUG: 450359
This commit is contained in:
parent
d6b3b57ba1
commit
2ff9093604
1 changed files with 5 additions and 4 deletions
|
@ -17,12 +17,13 @@
|
||||||
#include "../presentwindows/presentwindows_proxy.h"
|
#include "../presentwindows/presentwindows_proxy.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QGuiApplication>
|
||||||
#include <KGlobalAccel>
|
#include <KGlobalAccel>
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <netwm_def.h>
|
#include <netwm_def.h>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
#include <QStyleHints>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QVector2D>
|
#include <QVector2D>
|
||||||
#include <QMatrix4x4>
|
#include <QMatrix4x4>
|
||||||
|
@ -129,7 +130,7 @@ DesktopGridEffect::DesktopGridEffect()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
windowMoveElevateTimer->setInterval(QApplication::startDragTime());
|
windowMoveElevateTimer->setInterval(QGuiApplication::styleHints()->startDragTime());
|
||||||
windowMoveElevateTimer->setSingleShot(true);
|
windowMoveElevateTimer->setSingleShot(true);
|
||||||
connect(windowMoveElevateTimer, &QTimer::timeout, this, [this]() {
|
connect(windowMoveElevateTimer, &QTimer::timeout, this, [this]() {
|
||||||
effects->setElevatedWindow(windowMove, true);
|
effects->setElevatedWindow(windowMove, true);
|
||||||
|
@ -503,7 +504,7 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e)
|
||||||
if (e->type() == QEvent::MouseMove) {
|
if (e->type() == QEvent::MouseMove) {
|
||||||
int d = posToDesktop(me->pos());
|
int d = posToDesktop(me->pos());
|
||||||
if (windowMove != nullptr &&
|
if (windowMove != nullptr &&
|
||||||
(me->pos() - dragStartPos).manhattanLength() > QApplication::startDragDistance()) {
|
(me->pos() - dragStartPos).manhattanLength() > QGuiApplication::styleHints()->startDragDistance()) {
|
||||||
// Handle window moving
|
// Handle window moving
|
||||||
if (windowMoveElevateTimer->isActive()) { // Window started moving, but is not elevated yet!
|
if (windowMoveElevateTimer->isActive()) { // Window started moving, but is not elevated yet!
|
||||||
windowMoveElevateTimer->stop();
|
windowMoveElevateTimer->stop();
|
||||||
|
@ -561,7 +562,7 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e)
|
||||||
effects->addRepaintFull();
|
effects->addRepaintFull();
|
||||||
}
|
}
|
||||||
} else if ((me->buttons() & Qt::LeftButton) && !wasDesktopMove &&
|
} else if ((me->buttons() & Qt::LeftButton) && !wasDesktopMove &&
|
||||||
(me->pos() - dragStartPos).manhattanLength() > QApplication::startDragDistance()) {
|
(me->pos() - dragStartPos).manhattanLength() > QGuiApplication::styleHints()->startDragDistance()) {
|
||||||
wasDesktopMove = true;
|
wasDesktopMove = true;
|
||||||
effects->defineCursor(Qt::ClosedHandCursor);
|
effects->defineCursor(Qt::ClosedHandCursor);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue