BurntSushi / xgb

The X Go Binding is a low-level API to communicate with the X server. It is modeled on XCB and supports many X extensions.
Other
488 stars 75 forks source link

xinput extension not supported #33

Open perillo opened 8 years ago

perillo commented 8 years ago

I need XInput support and since it is not available I updated the Makefile to process xinput.xml file. Unfortunately xgbgen panics:

xgbgen/xgbgen --proto-path /usr/share/xcb /usr/share/xcb/xinput.xml > xinput/xinput.go panic: it is illegal to call SrcName on a SwitchField field

goroutine 1 [running]: runtime.gopanic(0x581fa0, 0xc820453bf0) /usr/lib/go/src/runtime/panic.go:461 +0x3e6 fp=0xc820583638 sp=0xc8205835b8 main.(_SwitchField).SrcName(0xc820478800, 0x0, 0x0) /home/manlio/.local/lib/go/src/github.com/BurntSushi/xgb/xgbgen/field.go:297 +0x71 fp=0xc820583678 sp=0xc820583638 main.(_Request).ParamNameTypes(0xc820087e00, 0x0, 0x0) /home/manlio/.local/lib/go/src/github.com/BurntSushi/xgb/xgbgen/go_request_reply.go:238 +0x7da fp=0xc820583808 sp=0xc820583678 main.(_Request).Define(0xc820087e00, 0xc82000e640) /home/manlio/.local/lib/go/src/github.com/BurntSushi/xgb/xgbgen/go_request_reply.go:46 +0x168c fp=0xc820583b48 sp=0xc820583808 main.(_Context).Morph(0xc82000e640, 0xc8200a6000, 0x14f74, 0x15174) /home/manlio/.local/lib/go/src/github.com/BurntSushi/xgb/xgbgen/context.go:152 +0x18a1 fp=0xc820583dd0 sp=0xc820583b48 main.main() /home/manlio/.local/lib/go/src/github.com/BurntSushi/xgb/xgbgen/main.go:50 +0x35b fp=0xc820583f40 sp=0xc820583dd0 runtime.main() /usr/lib/go/src/runtime/proc.go:111 +0x2b0 fp=0xc820583f90 sp=0xc820583f40 runtime.goexit() /usr/lib/go/src/runtime/asm_amd64.s:1721 +0x1 fp=0xc820583f98 sp=0xc820583f90

Thanks.

BurntSushi commented 8 years ago

XInput is an extremely complicated extension. No code is generated for it because it is not supported. I don't have any plans to add it, but would accept a PR that does it.

perillo commented 8 years ago

On Mon, Jan 4, 2016 at 8:00 PM, Andrew Gallant notifications@github.com wrote:

XInput is an extremely complicated extension. No code is generated for it because it is not supported. I don't have any plans to add it, but would accept a PR that does it.

Looking at the code, the problem seems to be with union types (the switch xml element). Is handling support for union types that hard?

Thanks

BurntSushi commented 8 years ago

Is handling support for union types that hard?

I honestly can't remember the exact details. I wrote xgbgen almost 3 years ago.

perillo commented 8 years ago

On Mon, Jan 4, 2016 at 8:20 PM, Andrew Gallant notifications@github.com wrote:

Is handling support for union types that hard?

I honestly can't remember the exact details. I wrote xgbgen almost 3 years ago.

Ok. Unfortunately right now I don't have the time to help. For my project I will use the evdev linux kernel interface.

Thanks.

pjanx commented 6 years ago

It does successfully produce a file with xcb-proto 1.8 which, going by the diff, only supports an older version of the protocol (1.0 vs 2.3), i.e. some interfaces would be missing.

As a side-note, xgb as it is now seems to be generated from xcb-proto 1.11. This doesn't seem to be stated anywhere.

xcb-proto 1.12 successfully updates randr (lots of useful stuff, only suspicious changes to CrtcTransform requests), shm (meh), xfixes (suspicious), xprint (very suspicious), xselinux (meh), xv (meh).

That is, with little risk one could put together a 1.11 + 1.8 (xinput) + 1.12 (randr) Frankenstein combo with the existing xcbgen, given that it looks like #38 won't be merged.

Edit: 1.12 randr actually miscompiles because of SetMonitor, with the following fix:

-   size := xgb.Pad((8 + (24 + xgb.Pad((int(NOutput) * 4)))))
+   size := xgb.Pad((8 + (24 + xgb.Pad((int(Monitorinfo.NOutput) * 4)))))