MCPcopy Index your code
hub / github.com/coder/coder / NewDesktopGeometry

Function NewDesktopGeometry

codersdk/workspacesdk/display.go:52–67  ·  view source on GitHub ↗

NewDesktopGeometry derives a declared model-facing geometry from the native desktop size.

(nativeWidth, nativeHeight int)

Source from the content-addressed store, hash-verified

50// NewDesktopGeometry derives a declared model-facing geometry from the native
51// desktop size.
52func NewDesktopGeometry(nativeWidth, nativeHeight int) DesktopGeometry {
53 nativeWidth = sanitizeDesktopDimension(nativeWidth)
54 nativeHeight = sanitizeDesktopDimension(nativeHeight)
55
56 declaredWidth, declaredHeight := computeDeclaredDesktopSize(
57 nativeWidth,
58 nativeHeight,
59 )
60
61 return DesktopGeometry{
62 NativeWidth: nativeWidth,
63 NativeHeight: nativeHeight,
64 DeclaredWidth: declaredWidth,
65 DeclaredHeight: declaredHeight,
66 }
67}
68
69// NewDesktopGeometryWithDeclared returns a geometry that preserves the native
70// desktop size while using the provided declared model-facing dimensions.

Callers 2

TestNewDesktopGeometryFunction · 0.92
DefaultDesktopGeometryFunction · 0.85

Calls 2

sanitizeDesktopDimensionFunction · 0.85

Tested by 1

TestNewDesktopGeometryFunction · 0.74