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

@ -185,20 +185,20 @@ func CheckKeys(duration time.Duration) {
}
// set screen configuration, create new one if not exists
func ChangeScreenSize(width int, height int, rate int16) (int, int, int16, error) {
func ChangeScreenSize(s types.ScreenSize) (types.ScreenSize, error) {
mu.Lock()
defer mu.Unlock()
// round width to 8, because of Xorg
width = width - (width % 8)
s.Width = s.Width - (s.Width % 8)
// if rate is 0, set it to 60
if rate == 0 {
rate = 60
if s.Rate == 0 {
s.Rate = 60
}
// convert variables to C types
c_width, c_height, c_rate := C.int(width), C.int(height), C.short(rate)
c_width, c_height, c_rate := C.int(s.Width), C.int(s.Height), C.short(s.Rate)
// if screen configuration already exists, just set it
status := C.XSetScreenConfiguration(c_width, c_height, c_rate)
@ -214,15 +214,15 @@ func ChangeScreenSize(width int, height int, rate int16) (int, int, int16, error
// if screen configuration was not set successfully, return error
if status != C.RRSetConfigSuccess {
err = fmt.Errorf("unknown screen configuration %dx%d@%d", width, height, rate)
err = fmt.Errorf("unknown screen configuration %s", s.String())
}
// if specified rate is not supported a BadValue error is returned
if status == C.BadValue {
err = fmt.Errorf("unsupported screen rate %d", rate)
err = fmt.Errorf("unsupported screen rate %d", s.Rate)
}
return width, height, rate, err
return s, err
}
func GetScreenSize() types.ScreenSize {