mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
displays: add adaptiveSyncSupported to wlroutput API
This commit is contained in:
@@ -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()
|
||||||
})
|
})
|
||||||
@@ -360,22 +361,23 @@ func (m *Manager) updateState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
output := Output{
|
output := Output{
|
||||||
Name: head.name,
|
Name: head.name,
|
||||||
Description: head.description,
|
Description: head.description,
|
||||||
Make: head.make,
|
Make: head.make,
|
||||||
Model: head.model,
|
Model: head.model,
|
||||||
SerialNumber: head.serialNumber,
|
SerialNumber: head.serialNumber,
|
||||||
PhysicalWidth: head.physicalWidth,
|
PhysicalWidth: head.physicalWidth,
|
||||||
PhysicalHeight: head.physicalHeight,
|
PhysicalHeight: head.physicalHeight,
|
||||||
Enabled: head.enabled,
|
Enabled: head.enabled,
|
||||||
X: head.x,
|
X: head.x,
|
||||||
Y: head.y,
|
Y: head.y,
|
||||||
Transform: head.transform,
|
Transform: head.transform,
|
||||||
Scale: head.scale,
|
Scale: head.scale,
|
||||||
CurrentMode: currentMode,
|
CurrentMode: currentMode,
|
||||||
Modes: modes,
|
Modes: modes,
|
||||||
AdaptiveSync: head.adaptiveSync,
|
AdaptiveSync: head.adaptiveSync,
|
||||||
ID: head.id,
|
AdaptiveSyncSupported: head.adaptiveSyncSupported,
|
||||||
|
ID: head.id,
|
||||||
}
|
}
|
||||||
outputs = append(outputs, output)
|
outputs = append(outputs, output)
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -17,22 +17,23 @@ type OutputMode struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Output struct {
|
type Output struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
Make string `json:"make"`
|
Make string `json:"make"`
|
||||||
Model string `json:"model"`
|
Model string `json:"model"`
|
||||||
SerialNumber string `json:"serialNumber"`
|
SerialNumber string `json:"serialNumber"`
|
||||||
PhysicalWidth int32 `json:"physicalWidth"`
|
PhysicalWidth int32 `json:"physicalWidth"`
|
||||||
PhysicalHeight int32 `json:"physicalHeight"`
|
PhysicalHeight int32 `json:"physicalHeight"`
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
X int32 `json:"x"`
|
X int32 `json:"x"`
|
||||||
Y int32 `json:"y"`
|
Y int32 `json:"y"`
|
||||||
Transform int32 `json:"transform"`
|
Transform int32 `json:"transform"`
|
||||||
Scale float64 `json:"scale"`
|
Scale float64 `json:"scale"`
|
||||||
CurrentMode *OutputMode `json:"currentMode"`
|
CurrentMode *OutputMode `json:"currentMode"`
|
||||||
Modes []OutputMode `json:"modes"`
|
Modes []OutputMode `json:"modes"`
|
||||||
AdaptiveSync uint32 `json:"adaptiveSync"`
|
AdaptiveSync uint32 `json:"adaptiveSync"`
|
||||||
ID uint32 `json:"id"`
|
AdaptiveSyncSupported bool `json:"adaptiveSyncSupported"`
|
||||||
|
ID uint32 `json:"id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type State struct {
|
type State struct {
|
||||||
@@ -72,25 +73,26 @@ type Manager struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type headState struct {
|
type headState struct {
|
||||||
id uint32
|
id uint32
|
||||||
handle *wlr_output_management.ZwlrOutputHeadV1
|
handle *wlr_output_management.ZwlrOutputHeadV1
|
||||||
name string
|
name string
|
||||||
description string
|
description string
|
||||||
make string
|
make string
|
||||||
model string
|
model string
|
||||||
serialNumber string
|
serialNumber string
|
||||||
physicalWidth int32
|
physicalWidth int32
|
||||||
physicalHeight int32
|
physicalHeight int32
|
||||||
enabled bool
|
enabled bool
|
||||||
x int32
|
x int32
|
||||||
y int32
|
y int32
|
||||||
transform int32
|
transform int32
|
||||||
scale float64
|
scale float64
|
||||||
currentModeID uint32
|
currentModeID uint32
|
||||||
modeIDs []uint32
|
modeIDs []uint32
|
||||||
adaptiveSync uint32
|
adaptiveSync uint32
|
||||||
finished bool
|
adaptiveSyncSupported bool
|
||||||
ready bool
|
finished bool
|
||||||
|
ready bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type modeState struct {
|
type modeState struct {
|
||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user