mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Compositor: another take on not resyncing all windows when only the focus changes.
This commit is contained in:
@@ -381,6 +381,9 @@ Rectangle {
|
||||
|
||||
Connections {
|
||||
target: CompositorService
|
||||
function onActiveWindowChanged() {
|
||||
updateCombinedModel();
|
||||
}
|
||||
function onWindowListChanged() {
|
||||
updateCombinedModel();
|
||||
}
|
||||
|
||||
@@ -171,8 +171,14 @@ Item {
|
||||
refreshWorkspaces();
|
||||
}
|
||||
function onWindowListChanged() {
|
||||
if (showApplications || showLabelsOnlyWhenOccupied)
|
||||
if (showApplications || showLabelsOnlyWhenOccupied) {
|
||||
refreshWorkspaces();
|
||||
}
|
||||
}
|
||||
function onActiveWindowChanged() {
|
||||
if (showApplications || showLabelsOnlyWhenOccupied) {
|
||||
refreshWorkspaces();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user