mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-16 16:24:00 -04:00
displays: apply refresh rate changes without compositor config reload
related #3073
This commit is contained in:
@@ -376,19 +376,36 @@ Singleton {
|
||||
}
|
||||
|
||||
function applyWlrModeOverrides(modeOverrides, callback) {
|
||||
if (CompositorService.isHyprland) {
|
||||
HyprlandService.generateOutputsConfig(buildWlrOutputsData(modeOverrides), SessionData.hyprlandOutputSettings, callback);
|
||||
return;
|
||||
}
|
||||
|
||||
if (CompositorService.isMango) {
|
||||
MangoService.generateOutputsConfig(buildWlrOutputsData(modeOverrides), callback);
|
||||
if (CompositorService.isHyprland || CompositorService.isMango) {
|
||||
applyModeOverridesWithoutReload(modeOverrides, callback);
|
||||
return;
|
||||
}
|
||||
|
||||
WlrOutputService.applyConfiguration(buildWlrHeads(modeOverrides), callback);
|
||||
}
|
||||
|
||||
// apply live and persist without a compositor config reload — full reloads
|
||||
// are a suspected trigger for IME input lockups (#3073)
|
||||
function applyModeOverridesWithoutReload(modeOverrides, callback) {
|
||||
WlrOutputService.applyConfiguration(buildWlrHeads(modeOverrides), success => {
|
||||
if (!success) {
|
||||
persistOutputsConfig(modeOverrides, callback, false);
|
||||
return;
|
||||
}
|
||||
persistOutputsConfig(modeOverrides, null, true);
|
||||
if (callback)
|
||||
callback(true);
|
||||
});
|
||||
}
|
||||
|
||||
function persistOutputsConfig(modeOverrides, callback, skipReload) {
|
||||
if (CompositorService.isHyprland) {
|
||||
HyprlandService.generateOutputsConfig(buildWlrOutputsData(modeOverrides), SessionData.hyprlandOutputSettings, callback, skipReload);
|
||||
return;
|
||||
}
|
||||
MangoService.generateOutputsConfig(buildWlrOutputsData(modeOverrides), callback, skipReload);
|
||||
}
|
||||
|
||||
function buildWlrOutputsData(modeOverrides) {
|
||||
const outputs = WlrOutputService.outputs || [];
|
||||
const data = ({});
|
||||
|
||||
@@ -168,7 +168,7 @@ Singleton {
|
||||
return Number(value);
|
||||
}
|
||||
|
||||
function generateOutputsConfig(outputsData, hyprlandSettings, callback) {
|
||||
function generateOutputsConfig(outputsData, hyprlandSettings, callback, skipReload) {
|
||||
if (!canWriteLuaConfig("outputs")) {
|
||||
if (callback)
|
||||
callback(false);
|
||||
@@ -254,7 +254,7 @@ Singleton {
|
||||
return;
|
||||
}
|
||||
log.info("Generated outputs config at", outputsPath);
|
||||
if (CompositorService.isHyprland)
|
||||
if (CompositorService.isHyprland && !skipReload)
|
||||
reloadConfig();
|
||||
if (callback)
|
||||
callback(true);
|
||||
|
||||
@@ -563,7 +563,7 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
function generateOutputsConfig(outputsData, callback) {
|
||||
function generateOutputsConfig(outputsData, callback, skipReload) {
|
||||
if (!outputsData || Object.keys(outputsData).length === 0) {
|
||||
if (callback)
|
||||
callback(false);
|
||||
@@ -618,7 +618,7 @@ Singleton {
|
||||
return;
|
||||
}
|
||||
log.info("Generated outputs config at", outputsPath);
|
||||
if (CompositorService.isMango)
|
||||
if (CompositorService.isMango && !skipReload)
|
||||
reloadConfig(false);
|
||||
if (callback)
|
||||
callback(true);
|
||||
|
||||
Reference in New Issue
Block a user