Client: Move bradient buttons inside processMouseTop

To avoid them covering for the edges of the window

Change-Id: Id8a1362ec11bd25f54cb2c9fbcbd562af8f283d8
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Johan Klokkhammer Helsing 2018-06-16 22:57:53 +02:00 committed by Johan Helsing
parent 6dfa35b7a2
commit 0424118abd

View File

@ -351,16 +351,7 @@ bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, c
Q_UNUSED(global);
// Figure out what area mouse is in
if (closeButtonRect().contains(local)) {
if (clickButton(b, Close))
QWindowSystemInterface::handleCloseEvent(window());
} else if (maximizeButtonRect().contains(local)) {
if (clickButton(b, Maximize))
window()->setWindowStates(window()->windowStates() ^ Qt::WindowMaximized);
} else if (minimizeButtonRect().contains(local)) {
if (clickButton(b, Minimize))
window()->setWindowState(Qt::WindowMinimized);
} else if (local.y() <= margins().top()) {
if (local.y() <= margins().top()) {
processMouseTop(inputDevice,local,b,mods);
} else if (local.y() > window()->height() + margins().top()) {
processMouseBottom(inputDevice,local,b,mods);
@ -419,19 +410,31 @@ void QWaylandBradientDecoration::processMouseTop(QWaylandInputDevice *inputDevic
#endif
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_RIGHT,b);
} else {
//top reszie bit
//top resize bit
#if QT_CONFIG(cursor)
waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor);
#endif
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP,b);
}
} else if (local.x() <= margins().left()) {
processMouseLeft(inputDevice, local, b, mods);
} else if (local.x() > window()->width() + margins().left()) {
processMouseRight(inputDevice, local, b, mods);
} else if (closeButtonRect().contains(local)) {
if (clickButton(b, Close))
QWindowSystemInterface::handleCloseEvent(window());
} else if (maximizeButtonRect().contains(local)) {
if (clickButton(b, Maximize))
window()->setWindowStates(window()->windowStates() ^ Qt::WindowMaximized);
} else if (minimizeButtonRect().contains(local)) {
if (clickButton(b, Minimize))
window()->setWindowState(Qt::WindowMinimized);
} else {
#if QT_CONFIG(cursor)
waylandWindow()->restoreMouseCursor(inputDevice);
#endif
startMove(inputDevice,b);
}
}
void QWaylandBradientDecoration::processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods)