Custom sizes with XRandR (#25)

* xserver dummy with RandR.

* update.

* remove screen configurations from xorg.

* screen size cannot be nil anymore.

* use predefined screen configurations.

* use screen configurations.

* fix error.

* remove comment.
This commit is contained in:
Miroslav Šedivý
2023-02-14 21:18:47 +01:00
committed by GitHub
parent bfabee12e2
commit f8b128e1e9
14 changed files with 666 additions and 107 deletions

View File

@ -188,16 +188,13 @@ func (config *VideoConfig) GetPipeline(screen ScreenSize) (string, error) {
}[:], " "), nil
}
func (config *VideoConfig) GetBitrateFn(getScreen func() *ScreenSize) func() (int, error) {
func (config *VideoConfig) GetBitrateFn(getScreen func() ScreenSize) func() (int, error) {
return func() (int, error) {
if config.Bitrate > 0 {
return config.Bitrate, nil
}
screen := getScreen()
if screen == nil {
return 0, fmt.Errorf("screen is nil")
}
values := map[string]any{
"width": screen.Width,

View File

@ -19,12 +19,6 @@ type ScreenSize struct {
Rate int16
}
type ScreenConfiguration struct {
Width int
Height int
Rates map[int]int16
}
type KeyboardModifiers struct {
NumLock *bool
CapsLock *bool
@ -57,9 +51,9 @@ type DesktopManager interface {
ButtonPress(code uint32) error
KeyPress(codes ...uint32) error
ResetKeys()
ScreenConfigurations() map[int]ScreenConfiguration
SetScreenSize(ScreenSize) error
GetScreenSize() *ScreenSize
ScreenConfigurations() []ScreenSize
SetScreenSize(ScreenSize) (ScreenSize, error)
GetScreenSize() ScreenSize
SetKeyboardMap(KeyboardMap) error
GetKeyboardMap() (*KeyboardMap, error)
SetKeyboardModifiers(mod KeyboardModifiers)