2020-10-23 03:54:50 +13:00
|
|
|
package types
|
|
|
|
|
2021-01-22 08:44:09 +13:00
|
|
|
import (
|
2023-08-18 02:14:59 +12:00
|
|
|
"fmt"
|
2021-01-22 08:44:09 +13:00
|
|
|
"image"
|
|
|
|
)
|
|
|
|
|
2021-01-10 10:58:18 +13:00
|
|
|
type CursorImage struct {
|
|
|
|
Width uint16
|
|
|
|
Height uint16
|
|
|
|
Xhot uint16
|
|
|
|
Yhot uint16
|
|
|
|
Serial uint64
|
2021-02-26 02:03:57 +13:00
|
|
|
Image *image.RGBA
|
2021-01-10 10:58:18 +13:00
|
|
|
}
|
|
|
|
|
2020-11-02 04:09:48 +13:00
|
|
|
type ScreenSize struct {
|
2024-05-04 08:40:56 +12:00
|
|
|
Width int `json:"width"`
|
|
|
|
Height int `json:"height"`
|
|
|
|
Rate int16 `json:"rate"`
|
2020-11-02 04:09:48 +13:00
|
|
|
}
|
|
|
|
|
2023-08-18 02:14:59 +12:00
|
|
|
func (s ScreenSize) String() string {
|
|
|
|
return fmt.Sprintf("%dx%d@%d", s.Width, s.Height, s.Rate)
|
|
|
|
}
|
|
|
|
|
2021-01-13 10:54:13 +13:00
|
|
|
type KeyboardModifiers struct {
|
2023-09-12 02:34:57 +12:00
|
|
|
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-13 10:54:13 +13:00
|
|
|
}
|
|
|
|
|
2021-01-16 04:53:03 +13:00
|
|
|
type KeyboardMap struct {
|
2023-09-12 02:34:57 +12:00
|
|
|
Layout string `json:"layout"`
|
|
|
|
Variant string `json:"variant"`
|
2021-01-16 04:53:03 +13:00
|
|
|
}
|
|
|
|
|
2021-01-30 08:05:13 +13:00
|
|
|
type ClipboardText struct {
|
|
|
|
Text string
|
|
|
|
HTML string
|
|
|
|
}
|
|
|
|
|
2020-11-02 04:09:48 +13:00
|
|
|
type DesktopManager interface {
|
2020-10-23 03:54:50 +13:00
|
|
|
Start()
|
|
|
|
Shutdown() error
|
2020-11-08 05:22:25 +13:00
|
|
|
OnBeforeScreenSizeChange(listener func())
|
|
|
|
OnAfterScreenSizeChange(listener func())
|
2020-11-02 04:09:48 +13:00
|
|
|
|
|
|
|
// xorg
|
2020-10-23 03:54:50 +13:00
|
|
|
Move(x, y int)
|
2021-02-18 09:55:11 +13:00
|
|
|
GetCursorPosition() (int, int)
|
2023-09-12 02:34:57 +12:00
|
|
|
Scroll(deltaX, deltaY int, controlKey bool)
|
2021-02-24 09:25:55 +13:00
|
|
|
ButtonDown(code uint32) error
|
|
|
|
KeyDown(code uint32) error
|
|
|
|
ButtonUp(code uint32) error
|
|
|
|
KeyUp(code uint32) error
|
2022-07-23 10:22:26 +12:00
|
|
|
ButtonPress(code uint32) error
|
2022-01-30 13:22:07 +13:00
|
|
|
KeyPress(codes ...uint32) error
|
2020-10-23 03:54:50 +13:00
|
|
|
ResetKeys()
|
2023-02-15 09:18:47 +13:00
|
|
|
ScreenConfigurations() []ScreenSize
|
|
|
|
SetScreenSize(ScreenSize) (ScreenSize, error)
|
|
|
|
GetScreenSize() ScreenSize
|
2021-01-16 04:53:03 +13:00
|
|
|
SetKeyboardMap(KeyboardMap) error
|
|
|
|
GetKeyboardMap() (*KeyboardMap, error)
|
2021-01-13 10:54:13 +13:00
|
|
|
SetKeyboardModifiers(mod KeyboardModifiers)
|
|
|
|
GetKeyboardModifiers() KeyboardModifiers
|
2021-01-10 10:58:18 +13:00
|
|
|
GetCursorImage() *CursorImage
|
2021-01-22 08:44:09 +13:00
|
|
|
GetScreenshotImage() *image.RGBA
|
2020-11-02 04:09:48 +13:00
|
|
|
|
2021-01-11 03:58:17 +13:00
|
|
|
// xevent
|
|
|
|
OnCursorChanged(listener func(serial uint64))
|
2021-01-12 03:30:53 +13:00
|
|
|
OnClipboardUpdated(listener func())
|
2021-01-20 09:01:31 +13:00
|
|
|
OnFileChooserDialogOpened(listener func())
|
|
|
|
OnFileChooserDialogClosed(listener func())
|
2021-01-11 03:58:17 +13:00
|
|
|
OnEventError(listener func(error_code uint8, message string, request_code uint8, minor_code uint8))
|
|
|
|
|
2023-08-18 02:14:59 +12:00
|
|
|
// 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-02 04:09:48 +13:00
|
|
|
// clipboard
|
2021-02-15 02:40:17 +13:00
|
|
|
ClipboardGetText() (*ClipboardText, error)
|
2021-01-30 08:05:13 +13:00
|
|
|
ClipboardSetText(data ClipboardText) error
|
2021-01-29 10:51:55 +13:00
|
|
|
ClipboardGetBinary(mime string) ([]byte, error)
|
|
|
|
ClipboardSetBinary(mime string, data []byte) error
|
|
|
|
ClipboardGetTargets() ([]string, error)
|
2021-01-07 06:57:50 +13:00
|
|
|
|
|
|
|
// drop
|
2021-01-15 07:53:58 +13:00
|
|
|
DropFiles(x int, y int, files []string) bool
|
2023-11-24 22:44:24 +13:00
|
|
|
IsUploadDropEnabled() bool
|
2021-01-18 11:50:03 +13:00
|
|
|
|
|
|
|
// filechooser
|
|
|
|
HandleFileChooserDialog(uri string) error
|
2021-01-20 09:01:31 +13:00
|
|
|
CloseFileChooserDialog()
|
2023-11-24 22:39:09 +13:00
|
|
|
IsFileChooserDialogEnabled() bool
|
2021-01-20 09:01:31 +13:00
|
|
|
IsFileChooserDialogOpened() bool
|
2020-10-23 03:54:50 +13:00
|
|
|
}
|