Compositor: another take on not resyncing all windows when only the focus changes.

This commit is contained in:
Lemmy
2025-12-13 20:21:18 -05:00
parent 4ff5b4e83f
commit 7d795256de
3 changed files with 28 additions and 5 deletions
+3
View File
@@ -381,6 +381,9 @@ Rectangle {
Connections {
target: CompositorService
function onActiveWindowChanged() {
updateCombinedModel();
}
function onWindowListChanged() {
updateCombinedModel();
}
+7 -1
View File
@@ -171,8 +171,14 @@ Item {
refreshWorkspaces();
}
function onWindowListChanged() {
if (showApplications || showLabelsOnlyWhenOccupied)
if (showApplications || showLabelsOnlyWhenOccupied) {
refreshWorkspaces();
}
}
function onActiveWindowChanged() {
if (showApplications || showLabelsOnlyWhenOccupied) {
refreshWorkspaces();
}
}
}
+18 -4
View File
@@ -168,9 +168,8 @@ Singleton {
});
backend.activeWindowChanged.connect(() => {
// Sync active window when it changes
// TODO: Avoid re-syncing all windows
syncWindows();
// Only sync focus state, not entire window list
syncFocusedWindow();
// Forward the signal
activeWindowChanged();
});
@@ -209,10 +208,25 @@ Singleton {
for (var i = 0; i < ws.length; i++) {
windows.append(ws[i]);
}
// Emit signal to notify listeners that workspace list has been updated
// Emit signal to notify listeners that window list has been updated
windowListChanged();
}
// Sync only the focused window state, not the entire window list
function syncFocusedWindow() {
const newIndex = backend.focusedWindowIndex;
// Update isFocused flags by syncing from backend
for (var i = 0; i < windows.count && i < backend.windows.length; i++) {
const backendFocused = backend.windows[i].isFocused;
if (windows.get(i).isFocused !== backendFocused) {
windows.setProperty(i, "isFocused", backendFocused);
}
}
focusedWindowIndex = newIndex;
}
// Update display scales from backend
function updateDisplayScales() {
if (!backend || !backend.queryDisplayScales) {