1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-31 00:42:50 -05:00

displays: add adaptiveSyncSupported to wlroutput API

This commit is contained in:
bbedward
2025-12-17 20:36:54 -05:00
parent 2e4d56728b
commit f2b9dc8988
3 changed files with 57 additions and 53 deletions

View File

@@ -241,6 +241,7 @@ func (m *Manager) handleHead(e wlr_output_management.ZwlrOutputManagerV1HeadEven
handle.SetAdaptiveSyncHandler(func(e wlr_output_management.ZwlrOutputHeadV1AdaptiveSyncEvent) {
log.Debugf("WlrOutput: Head %d adaptive sync: %d", headID, e.State)
head.adaptiveSync = e.State
head.adaptiveSyncSupported = true
m.post(func() {
m.updateState()
})
@@ -375,6 +376,7 @@ func (m *Manager) updateState() {
CurrentMode: currentMode,
Modes: modes,
AdaptiveSync: head.adaptiveSync,
AdaptiveSyncSupported: head.adaptiveSyncSupported,
ID: head.id,
}
outputs = append(outputs, output)

View File

@@ -32,6 +32,7 @@ type Output struct {
CurrentMode *OutputMode `json:"currentMode"`
Modes []OutputMode `json:"modes"`
AdaptiveSync uint32 `json:"adaptiveSync"`
AdaptiveSyncSupported bool `json:"adaptiveSyncSupported"`
ID uint32 `json:"id"`
}
@@ -89,6 +90,7 @@ type headState struct {
currentModeID uint32
modeIDs []uint32
adaptiveSync uint32
adaptiveSyncSupported bool
finished bool
ready bool
}
@@ -169,7 +171,7 @@ func stateChanged(old, new *State) bool {
if oldOut.Transform != newOut.Transform || oldOut.Scale != newOut.Scale {
return true
}
if oldOut.AdaptiveSync != newOut.AdaptiveSync {
if oldOut.AdaptiveSync != newOut.AdaptiveSync || oldOut.AdaptiveSyncSupported != newOut.AdaptiveSyncSupported {
return true
}
if (oldOut.CurrentMode == nil) != (newOut.CurrentMode == nil) {

View File

@@ -431,7 +431,7 @@ Singleton {
"serial": output.serialNumber || "",
"modes": normalizedModes,
"current_mode": normalizedModes.findIndex(m => m.id === output.currentMode?.id),
"vrr_supported": output.adaptiveSync !== undefined,
"vrr_supported": output.adaptiveSyncSupported ?? false,
"vrr_enabled": output.adaptiveSync === 1,
"logical": {
"x": output.x ?? 0,