feat(protocol): negotiate display and native input
This commit is contained in:
@@ -125,10 +125,12 @@ func evaluate(kind, input string) string {
|
||||
}
|
||||
return "valid"
|
||||
case "tunnel":
|
||||
if (parts["offered"] == "1" || parts["offered"] == "0" || parts["offered"] == "-1") && parts["feature"] == "control.v1" {
|
||||
feature := parts["feature"]
|
||||
registered := feature == "control.v1" || feature == "display.request.v1" || feature == "input.absolute.v1" || feature == "input.scroll.v1"
|
||||
if (parts["offered"] == "1" || parts["offered"] == "0" || parts["offered"] == "-1") && registered {
|
||||
return "valid"
|
||||
}
|
||||
if parts["feature"] != "control.v1" {
|
||||
if !registered {
|
||||
return "invalid:unsupported_feature"
|
||||
}
|
||||
return "invalid:unsupported_version"
|
||||
@@ -226,6 +228,19 @@ func classifyGatewayInput(encoded string) string {
|
||||
}
|
||||
}
|
||||
}
|
||||
case 6:
|
||||
if len(body) != 8 {
|
||||
return "invalid:length"
|
||||
}
|
||||
x, y := uint16(body[0])<<8|uint16(body[1]), uint16(body[2])<<8|uint16(body[3])
|
||||
width, height := uint16(body[4])<<8|uint16(body[5]), uint16(body[6])<<8|uint16(body[7])
|
||||
if width == 0 || height == 0 || x >= width || y >= height {
|
||||
return "invalid:field"
|
||||
}
|
||||
case 7:
|
||||
if len(body) != 4 {
|
||||
return "invalid:length"
|
||||
}
|
||||
default:
|
||||
return "invalid:kind"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user