Archived
2
0

xorg refactor.

This commit is contained in:
Miroslav Šedivý
2022-09-13 21:40:40 +02:00
parent 478984e944
commit 4c1c96b163
15 changed files with 467 additions and 252 deletions

View File

@ -10,5 +10,5 @@ type CaptureManager interface {
StartStream()
StopStream()
Streaming() bool
ChangeResolution(width int, height int, rate int) error
ChangeResolution(width int, height int, rate int16) error
}

View File

@ -1,5 +1,16 @@
package types
import "image"
type CursorImage struct {
Width uint16
Height uint16
Xhot uint16
Yhot uint16
Serial uint64
Image *image.RGBA
}
type ScreenSize struct {
Width int `json:"width"`
Height int `json:"height"`
@ -12,22 +23,42 @@ type ScreenConfiguration struct {
Rates map[int]int16 `json:"rates"`
}
type KeyboardModifiers struct {
NumLock *bool
CapsLock *bool
}
type KeyboardMap struct {
Layout string
Variant string
}
type DesktopManager interface {
Start()
Shutdown() error
// clipboard
ReadClipboard() string
WriteClipboard(data string)
// xorg
Move(x, y int)
GetCursorPosition() (int, int)
Scroll(x, y int)
ButtonDown(code int) error
KeyDown(code uint64) error
ButtonUp(code int) error
KeyUp(code uint64) error
ButtonDown(code uint32) error
KeyDown(code uint32) error
ButtonUp(code uint32) error
KeyUp(code uint32) error
ButtonPress(code uint32) error
KeyPress(codes ...uint32) error
ResetKeys()
ScreenConfigurations() map[int]ScreenConfiguration
SetScreenSize(ScreenSize) error
GetScreenSize() *ScreenSize
SetKeyboardLayout(layout string)
SetKeyboardModifiers(NumLock int, CapsLock int, ScrollLock int)
SetKeyboardMap(KeyboardMap) error
GetKeyboardMap() (*KeyboardMap, error)
SetKeyboardModifiers(mod KeyboardModifiers)
GetKeyboardModifiers() KeyboardModifiers
GetCursorImage() *CursorImage
GetScreenshotImage() *image.RGBA
}

View File

@ -70,7 +70,7 @@ type Keyboard struct {
Layout *string `json:"layout,omitempty"`
CapsLock *bool `json:"capsLock,omitempty"`
NumLock *bool `json:"numLock,omitempty"`
ScrollLock *bool `json:"scrollLock,omitempty"`
ScrollLock *bool `json:"scrollLock,omitempty"` // TODO: ScrollLock is deprecated.
}
type Control struct {
@ -128,7 +128,7 @@ type ScreenResolution struct {
ID string `json:"id,omitempty"`
Width int `json:"width"`
Height int `json:"height"`
Rate int `json:"rate"`
Rate int16 `json:"rate"`
}
type ScreenConfigurations struct {