Increased edge margins

This commit is contained in:
Carson Black 2020-05-14 14:28:36 -04:00 committed by Xaver Hugl
parent f6005a28cd
commit 63b16cdf9d

View file

@ -47,6 +47,12 @@ namespace KWin {
// Mouse should not move more than this many pixels
static const int DISTANCE_RESET = 30;
// How large the touch target of the area recognizing touch gestures is
static const int TOUCH_TARGET = 3;
// How far the user needs to swipe before triggering an action.
static const int MINIMUM_DELTA = 44;
Edge::Edge(ScreenEdges *parent)
: QObject(parent)
, m_edges(parent)
@ -518,7 +524,7 @@ void Edge::setGeometry(const QRect &geometry)
if (isScreenEdge()) {
const AbstractOutput *output = kwinApp()->platform()->outputAt(m_geometry.center());
m_gesture->setStartGeometry(m_geometry);
m_gesture->setMinimumDelta(output->geometry().size() * 0.2);
m_gesture->setMinimumDelta(QSizeF(MINIMUM_DELTA, MINIMUM_DELTA) / output->scale());
}
}
@ -1070,27 +1076,27 @@ void ScreenEdges::createVerticalEdge(ElectricBorder border, const QRect &screen,
}
int y = screen.y();
int height = screen.height();
const int x = (border == ElectricLeft) ? screen.x() : screen.x() + screen.width() -1;
const int x = (border == ElectricLeft) ? screen.x() : screen.x() + screen.width() - TOUCH_TARGET;
if (isTopScreen(screen, fullArea)) {
// also top most screen
height -= m_cornerOffset;
y += m_cornerOffset;
// create top left/right edge
const ElectricBorder edge = (border == ElectricLeft) ? ElectricTopLeft : ElectricTopRight;
m_edges << createEdge(edge, x, screen.y(), 1, 1);
m_edges << createEdge(edge, x, screen.y(), TOUCH_TARGET, TOUCH_TARGET);
}
if (isBottomScreen(screen, fullArea)) {
// also bottom most screen
height -= m_cornerOffset;
// create bottom left/right edge
const ElectricBorder edge = (border == ElectricLeft) ? ElectricBottomLeft : ElectricBottomRight;
m_edges << createEdge(edge, x, screen.y() + screen.height() -1, 1, 1);
m_edges << createEdge(edge, x, screen.y() + screen.height() - TOUCH_TARGET, TOUCH_TARGET, TOUCH_TARGET);
}
if (height <= m_cornerOffset) {
// An overlap with another output is near complete. We ignore this border.
return;
}
m_edges << createEdge(border, x, y, 1, height);
m_edges << createEdge(border, x, y, TOUCH_TARGET, height);
}
void ScreenEdges::createHorizontalEdge(ElectricBorder border, const QRect &screen, const QRect &fullArea)
@ -1113,8 +1119,8 @@ void ScreenEdges::createHorizontalEdge(ElectricBorder border, const QRect &scree
// An overlap with another output is near complete. We ignore this border.
return;
}
const int y = (border == ElectricTop) ? screen.y() : screen.y() + screen.height() - 1;
m_edges << createEdge(border, x, y, width, 1);
const int y = (border == ElectricTop) ? screen.y() : screen.y() + screen.height() - TOUCH_TARGET;
m_edges << createEdge(border, x, y, width, TOUCH_TARGET);
}
Edge *ScreenEdges::createEdge(ElectricBorder border, int x, int y, int width, int height, bool createAction)