diff options
Diffstat (limited to 'popups/launcher/components/App.qml')
| -rw-r--r-- | popups/launcher/components/App.qml | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/popups/launcher/components/App.qml b/popups/launcher/components/App.qml index 0bb5fd9..a26d990 100644 --- a/popups/launcher/components/App.qml +++ b/popups/launcher/components/App.qml @@ -12,7 +12,6 @@ IComponent { property list<DesktopEntry> entries: active ? AppSearch.query(inputCleaned) : [] property int selectedIndex: -1 - property bool mouseTriggered: false name: "Applications" @@ -45,27 +44,23 @@ IComponent { up: function () { if (selectedIndex <= 0) return true; - mouseTriggered = false; selectedIndex--; } down: function () { if (selectedIndex + 1 > listView.count - 1) return true; - mouseTriggered = false; selectedIndex++; } home: function () { if (listView.count === 0) return true; - mouseTriggered = false; selectedIndex = -1; selectedIndex = 0; } end: function () { if (listView.count === 0) return true; - mouseTriggered = false; selectedIndex = listView.count; selectedIndex = listView.count - 1; } @@ -73,7 +68,6 @@ IComponent { pgup: function () { if (listView.count === 0) return true; - mouseTriggered = false; const pageSize = Math.floor(listView.height / (General.appIconSize + Launcher.innerMargin * 2)); if (selectedIndex - pageSize < 0) { selectedIndex = 0; @@ -85,7 +79,6 @@ IComponent { pgdn: function () { if (listView.count === 0) return true; - mouseTriggered = false; const pageSize = Math.floor(listView.height / (General.appIconSize + Launcher.innerMargin * 2)); if (selectedIndex + pageSize >= listView.count) { selectedIndex = listView.count - 1; @@ -99,6 +92,7 @@ IComponent { syncSelectionState(); return; } + selectedIndex = 0; listView.contentY = 0; syncSelectionState(); @@ -106,15 +100,18 @@ IComponent { onSelectedIndexChanged: { syncSelectionState(); - if (selectedIndex < 0 || selectedIndex >= listView.count || mouseTriggered) - return; Qt.callLater(() => { listView.positionViewAtIndex(selectedIndex, ListView.Contain); }); } syncSelectionState: function () { - Qt.callLater(() => state.selected = listView.itemAtIndex(selectedIndex)); + Qt.callLater(() => { + if (selectedIndex < 0 || selectedIndex >= listView.count) + return; + + state.selected = listView.itemAtIndex(selectedIndex); + }); } IInnerComponent { @@ -165,12 +162,8 @@ IComponent { anchors.fill: parent hoverEnabled: true onPositionChanged: { - root.mouseTriggered = true; root.selectedIndex = index; } - onExited: { - root.mouseTriggered = true; - } onPressed: { root._exec(); } |
