disp

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: GPL-3.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package disp implements the display control dynamic virtual channel (MS-RDPEDISP), which is how a client asks the server to change the desktop size while a session is running.

Without it a gateway cannot follow a browser window: the desktop size is fixed by the connect sequence, so a user who resizes the page has to reconnect, and reconnecting means authenticating again and losing whatever the session was doing.

Index

Constants

View Source
const (
	OrientationLandscape  = 0
	OrientationPortrait   = 90
	OrientationLandscapeF = 180
	OrientationPortraitF  = 270
)

Orientation values, in the form the field carries: a rotation from zero, together with the flip bits.

ChannelName is the static virtual channel of the same name. Both are advertised: the messages travel on the dynamic one, but a server that is not offered the static one does not create the dynamic one either.

ChannelOption is what the static channel is advertised with.

View Source
const DVCChannelName = "Microsoft::Windows::RDS::DisplayControl"

DVCChannelName is the dynamic virtual channel this package speaks on.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caps

type Caps struct {
	// MaxNumMonitors is the most monitors the server will lay out.
	MaxNumMonitors uint32
	// MaxMonitorAreaFactorA and B bound the total area the layout may cover.
	MaxMonitorAreaFactorA uint32
	MaxMonitorAreaFactorB uint32
}

Caps is what the server said it will accept, sent once when the channel opens.

type DisplayControlClient

type DisplayControlClient struct {
	*emission.Emitter
	// contains filtered or unexported fields
}

DisplayControlClient is the channel handler. It is registered with the dynamic virtual channel layer, which calls OnOpen, OnData and OnClose.

func NewDisplayControlClient

func NewDisplayControlClient() *DisplayControlClient

NewDisplayControlClient returns a client for the channel.

func (*DisplayControlClient) GetType added in v0.8.0

func (c *DisplayControlClient) GetType() (string, uint32)

GetType reports the static channel this handler answers for, which is how the channel layer knows to route to it.

func (*DisplayControlClient) LastSent

func (c *DisplayControlClient) LastSent() []byte

LastSent returns the last layout this client sent, which is what a test compares against. It is a copy.

func (*DisplayControlClient) OnCaps

func (c *DisplayControlClient) OnCaps(f func(Caps))

OnCaps registers f to be called with the server's limits once the channel opens.

func (*DisplayControlClient) OnClose

func (c *DisplayControlClient) OnClose()

OnClose implements drdynvc.DynChannel.

func (*DisplayControlClient) OnData

func (c *DisplayControlClient) OnData(data []byte)

OnData implements drdynvc.DynChannel. The only message the server sends on this channel is its capabilities, which arrive once.

func (*DisplayControlClient) OnOpen

func (c *DisplayControlClient) OnOpen(channelID uint32)

OnOpen implements drdynvc.DynChannel.

func (*DisplayControlClient) Process added in v0.8.0

func (c *DisplayControlClient) Process(s []byte)

Process consumes one payload from the static channel.

func (*DisplayControlClient) RequestResize

func (c *DisplayControlClient) RequestResize(width, height int) error

RequestResize asks the server to change the primary monitor to width by height. The whole layout has to be sent, not just the one monitor that changed, so a single monitor layout is built here.

The width is rounded down to an even number, which is what the server requires and what FreeRDP sends. Sizes outside the range the server accepts are refused rather than clamped, so that a caller is not told its request succeeded when the size was quietly changed.

func (*DisplayControlClient) Sender added in v0.8.0

Sender installs the static channel's writer.

Display Control can travel on either channel, and the messages are the same on both, so this handler speaks whichever one the server set up. Windows joins the static channel and never creates the dynamic one, so this is the path that actually works there.

func (*DisplayControlClient) SetSender

func (c *DisplayControlClient) SetSender(f func(channelID uint32, data []byte) error)

SetSender installs the callback that writes to the dynamic virtual channel. It is what the channel layer supplies; without it nothing can be sent.

type Monitor

type Monitor struct {
	// Flags is monitorPrimary for the primary monitor and zero otherwise.
	Flags uint32
	// Left and Top are the monitor's origin relative to the primary monitor's
	// upper left corner, which is always (0, 0).
	Left int32
	Top  int32
	// Width and Height are the desktop resolution of the monitor. The server
	// requires an even width.
	Width  uint32
	Height uint32
	// PhysicalWidth and PhysicalHeight are the size in millimetres, which is
	// what the server uses to work out the dots per inch.
	PhysicalWidth  uint32
	PhysicalHeight uint32
	// Orientation is one of the DISPLAY_CONTROL_ROTATION values.
	Orientation uint32
	// DesktopScaleFactor and DeviceScaleFactor are the scale percentages.
	DesktopScaleFactor uint32
	DeviceScaleFactor  uint32
}

Monitor is one entry of a display layout: where a monitor sits and how big it is, in pixels and in millimetres.

func ParseMonitorLayout

func ParseMonitorLayout(data []byte) ([]Monitor, error)

ParseMonitorLayout reads a layout PDU back. It exists so that the bytes this package produces can be checked against the structures they claim to be, and so that a server's layout could be read if one ever sent it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL