Xorg input driver (#53)

* add xf86 input driver.

* cleanup.

* rewrite to unix socket PoC.

* add input rebuild.

* lint & docs.

* add input driver struct.

* comments, lint, socket name from config.

* add touch events to webrtc.

* switch to uint32.

* misc update logging & linting,

* fix screen size

* set touchscreen as core pointer.

* add touch to ws control.

* SendCoreEvents.

* extract to own xinput folder.

* add debounce.

* switch pressure to uint8.

* check buffer size.

* send touch events with system init.
This commit is contained in:
Miroslav Šedivý
2023-08-17 16:14:59 +02:00
committed by GitHub
parent 4cb1b3e925
commit ea5517b270
35 changed files with 1507 additions and 82 deletions

View File

@ -1,6 +1,7 @@
package types
import (
"fmt"
"image"
)
@ -19,6 +20,10 @@ type ScreenSize struct {
Rate int16
}
func (s ScreenSize) String() string {
return fmt.Sprintf("%dx%d@%d", s.Width, s.Height, s.Rate)
}
type KeyboardModifiers struct {
NumLock *bool
CapsLock *bool
@ -68,6 +73,12 @@ type DesktopManager interface {
OnFileChooserDialogClosed(listener func())
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
// clipboard
ClipboardGetText() (*ClipboardText, error)
ClipboardSetText(data ClipboardText) error

View File

@ -43,6 +43,10 @@ const (
CONTROL_KEYPRESS = "control/keypress"
CONTROL_KEYDOWN = "control/keydown"
CONTROL_KEYUP = "control/keyup"
// touch
CONTROL_TOUCHBEGIN = "control/touchbegin"
CONTROL_TOUCHUPDATE = "control/touchupdate"
CONTROL_TOUCHEND = "control/touchend"
// actions
CONTROL_CUT = "control/cut"
CONTROL_COPY = "control/copy"

View File

@ -20,6 +20,7 @@ type SystemInit struct {
ScreenSize ScreenSize `json:"screen_size"`
Sessions map[string]SessionData `json:"sessions"`
Settings types.Settings `json:"settings"`
TouchEvents bool `json:"touch_events"`
ScreencastEnabled bool `json:"screencast_enabled"`
WebRTC SystemWebRTC `json:"webrtc"`
}
@ -129,6 +130,12 @@ type ControlKey struct {
Keysym uint32 `json:"keysym"`
}
type ControlTouch struct {
TouchId uint32 `json:"touch_id"`
*ControlPos
Pressure uint8 `json:"pressure"`
}
/////////////////////////////
// Screen
/////////////////////////////