diff --git a/applets/kicker/package/contents/ui/ItemGridView.qml b/applets/kicker/package/contents/ui/ItemGridView.qml --- a/applets/kicker/package/contents/ui/ItemGridView.qml +++ b/applets/kicker/package/contents/ui/ItemGridView.qml @@ -359,12 +359,38 @@ hoverEnabled: true + function updatePositionProperties(x, y) { + // Prevent hover event synthesis in QQuickWindow interfering + // with keyboard navigation by ignoring repeated events with + // identical coordinates. As the work done here would be re- + // dundant in any case, these are safe to ignore. + if (lastX == x && lastY == y) { + return; + } + + lastX = x; + lastY = y; + + var cPos = mapToItem(gridView.contentItem, x, y); + var item = gridView.itemAt(cPos.x, cPos.y); + + if (!item) { + gridView.currentIndex = -1; + pressedItem = null; + } else { + gridView.currentIndex = item.itemIndex; + itemGrid.focus = (currentIndex != -1) + } + } + onPressed: { + mouse.accepted = true; + + updatePositionProperties(mouse.x, mouse.y); + pressX = mouse.x; pressY = mouse.y; - mouse.accepted = true; - if (mouse.button == Qt.RightButton) { if (gridView.currentItem) { if (gridView.currentItem.hasActionList) { @@ -400,27 +426,9 @@ } onPositionChanged: { - // Prevent hover event synthesis in QQuickWindow interfering - // with keyboard navigation by ignoring repeated events with - // identical coordinates. As the work done here would be re- - // dundant in any case, these are safe to ignore. - if (mouse.x == lastX && mouse.y == lastY) { - return; - } - - lastX = mouse.x; - lastY = mouse.y; - - var cPos = mapToItem(gridView.contentItem, mouse.x, mouse.y); - var item = gridView.itemAt(cPos.x, cPos.y); - - if (!item) { - gridView.currentIndex = -1; - pressedItem = null; - } else { - gridView.currentIndex = item.itemIndex; - itemGrid.focus = (currentIndex != -1) + updatePositionProperties(mouse.x, mouse.y); + if (gridView.currentIndex != -1) { if (dragEnabled && pressX != -1 && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y)) { if ("pluginName" in item.m) { dragHelper.startDrag(kicker, item.url, item.icon,