1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-30 00:12: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) { handle.SetAdaptiveSyncHandler(func(e wlr_output_management.ZwlrOutputHeadV1AdaptiveSyncEvent) {
log.Debugf("WlrOutput: Head %d adaptive sync: %d", headID, e.State) log.Debugf("WlrOutput: Head %d adaptive sync: %d", headID, e.State)
head.adaptiveSync = e.State head.adaptiveSync = e.State
head.adaptiveSyncSupported = true
m.post(func() { m.post(func() {
m.updateState() m.updateState()
}) })
@@ -375,6 +376,7 @@ func (m *Manager) updateState() {
CurrentMode: currentMode, CurrentMode: currentMode,
Modes: modes, Modes: modes,
AdaptiveSync: head.adaptiveSync, AdaptiveSync: head.adaptiveSync,
AdaptiveSyncSupported: head.adaptiveSyncSupported,
ID: head.id, ID: head.id,
} }
outputs = append(outputs, output) outputs = append(outputs, output)

View File

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

View File

@@ -431,7 +431,7 @@ Singleton {
"serial": output.serialNumber || "", "serial": output.serialNumber || "",
"modes": normalizedModes, "modes": normalizedModes,
"current_mode": normalizedModes.findIndex(m => m.id === output.currentMode?.id), "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, "vrr_enabled": output.adaptiveSync === 1,
"logical": { "logical": {
"x": output.x ?? 0, "x": output.x ?? 0,