Merge pull request #1924 from tmarti2/fix-session-menu-grid-initial-press

Fix Grid SessionMenu right/down press when nothing is selected
This commit is contained in:
Lysec
2026-02-22 11:42:17 +01:00
committed by GitHub
+14 -7
View File
@@ -157,11 +157,16 @@ SmartPanel {
// Lifecycle handlers
onOpened: {
selectedIndex = -1;
ignoreMouseHover = true;
globalMouseInitialized = false;
mouseTrackingReady = false;
mouseTrackingDelayTimer.restart();
if (powerOptions.length > 0) {
selectedIndex = -1;
ignoreMouseHover = true;
globalMouseInitialized = false;
mouseTrackingReady = false;
mouseTrackingDelayTimer.restart();
} else {
Logger.w("SessionMenu", "Trying to open an empty session menu");
root.closeImmediately();
}
}
onClosed: {
@@ -322,13 +327,15 @@ SmartPanel {
newCol = newCol - 1 < 0 ? grid.itemsInRow(newRow) - 1 : newCol - 1;
break;
case "right":
newCol = newCol + 1 >= grid.itemsInRow(newRow) ? 0 : newCol + 1;
// We already moved to newCol to 0 if grid.currentCol was negative
newCol = grid.currentCol < 0 ? newRow : newCol + 1 >= grid.itemsInRow(newRow) ? 0 : newCol + 1;
break;
case "up":
newRow = newRow - 1 < 0 ? grid.rows - 1 : newRow - 1;
break;
case "down":
newRow = newRow + 1 >= grid.rows ? 0 : newRow + 1;
// We already moved to newRow to 0 if grid.currentRow was negative
newRow = grid.currentRow < 0 ? newRow : newRow + 1 >= grid.rows ? 0 : newRow + 1;
break;
}