neko/pkg/types/desktop.go

105 lines
2.5 KiB
Go
Raw Normal View History

package types
2021-01-21 20:44:09 +01:00
import (
"fmt"
2021-01-21 20:44:09 +01:00
"image"
)
2021-01-09 22:58:18 +01:00
type CursorImage struct {
Width uint16
Height uint16
Xhot uint16
Yhot uint16
Serial uint64
Image *image.RGBA
2021-01-09 22:58:18 +01:00
}
2020-11-01 16:09:48 +01:00
type ScreenSize struct {
2020-11-25 22:35:54 +01:00
Width int
Height int
Rate int16
2020-11-01 16:09:48 +01:00
}
func (s ScreenSize) String() string {
return fmt.Sprintf("%dx%d@%d", s.Width, s.Height, s.Rate)
}
2021-01-12 22:54:13 +01:00
type KeyboardModifiers struct {
Shift *bool `json:"shift"`
CapsLock *bool `json:"capslock"`
Control *bool `json:"control"`
Alt *bool `json:"alt"`
NumLock *bool `json:"numlock"`
Meta *bool `json:"meta"`
Super *bool `json:"super"`
AltGr *bool `json:"altgr"`
2021-01-12 22:54:13 +01:00
}
2021-01-15 16:53:03 +01:00
type KeyboardMap struct {
Layout string `json:"layout"`
Variant string `json:"variant"`
2021-01-15 16:53:03 +01:00
}
type ClipboardText struct {
Text string
HTML string
}
2020-11-01 16:09:48 +01:00
type DesktopManager interface {
Start()
Shutdown() error
OnBeforeScreenSizeChange(listener func())
OnAfterScreenSizeChange(listener func())
2020-11-01 16:09:48 +01:00
// xorg
Move(x, y int)
2021-02-17 21:55:11 +01:00
GetCursorPosition() (int, int)
Scroll(deltaX, deltaY int, controlKey bool)
2021-02-23 21:25:55 +01:00
ButtonDown(code uint32) error
KeyDown(code uint32) error
ButtonUp(code uint32) error
KeyUp(code uint32) error
ButtonPress(code uint32) error
2022-01-30 01:22:07 +01:00
KeyPress(codes ...uint32) error
ResetKeys()
ScreenConfigurations() []ScreenSize
SetScreenSize(ScreenSize) (ScreenSize, error)
GetScreenSize() ScreenSize
2021-01-15 16:53:03 +01:00
SetKeyboardMap(KeyboardMap) error
GetKeyboardMap() (*KeyboardMap, error)
2021-01-12 22:54:13 +01:00
SetKeyboardModifiers(mod KeyboardModifiers)
GetKeyboardModifiers() KeyboardModifiers
2021-01-09 22:58:18 +01:00
GetCursorImage() *CursorImage
2021-01-21 20:44:09 +01:00
GetScreenshotImage() *image.RGBA
2020-11-01 16:09:48 +01:00
2021-01-10 15:58:17 +01:00
// xevent
OnCursorChanged(listener func(serial uint64))
2021-01-11 15:30:53 +01:00
OnClipboardUpdated(listener func())
OnFileChooserDialogOpened(listener func())
OnFileChooserDialogClosed(listener func())
2021-01-10 15:58:17 +01:00
OnEventError(listener func(error_code uint8, message string, request_code uint8, minor_code uint8))
// input driver
HasTouchSupport() bool
TouchBegin(touchId uint32, x, y int, pressure uint8) error
TouchUpdate(touchId uint32, x, y int, pressure uint8) error
TouchEnd(touchId uint32, x, y int, pressure uint8) error
2020-11-01 16:09:48 +01:00
// clipboard
2021-02-14 14:40:17 +01:00
ClipboardGetText() (*ClipboardText, error)
ClipboardSetText(data ClipboardText) error
ClipboardGetBinary(mime string) ([]byte, error)
ClipboardSetBinary(mime string, data []byte) error
ClipboardGetTargets() ([]string, error)
2021-01-06 18:57:50 +01:00
// drop
2021-01-14 19:53:58 +01:00
DropFiles(x int, y int, files []string) bool
2023-11-24 10:44:24 +01:00
IsUploadDropEnabled() bool
2021-01-17 23:50:03 +01:00
// filechooser
HandleFileChooserDialog(uri string) error
CloseFileChooserDialog()
IsFileChooserDialogEnabled() bool
IsFileChooserDialogOpened() bool
}