Commit 94db5118 authored by Bernhard Link's avatar Bernhard Link

add new FRACTION16_16 type to better display fractions

parent c66eedaa
...@@ -856,6 +856,16 @@ static size_t print_parameters(struct connection *c,const unsigned char *buffer, ...@@ -856,6 +856,16 @@ static size_t print_parameters(struct connection *c,const unsigned char *buffer,
case ft_LISTofFIXED: case ft_LISTofFIXED:
lastofs = printLISTofFIXED(c,buffer,len,p,stored,ofs); lastofs = printLISTofFIXED(c,buffer,len,p,stored,ofs);
continue; continue;
case ft_FRACTION16_16:
if( ofs + 4 > len )
continue;
if( print_offsets )
fprintf(out,"[%d]",(int)ofs);
fputs(p->name,out);putc('=',out);
i16 = getCARD32(ofs);
u16 = getCARD32(ofs + 2);
fprintf(out,"%hd/%hu", i16, u16);
continue;
case ft_EVENT: case ft_EVENT:
if( len >= ofs + 32 ) if( len >= ofs + 32 )
print_event(c,buffer+ofs); print_event(c,buffer+ofs);
...@@ -1012,6 +1022,7 @@ static size_t print_parameters(struct connection *c,const unsigned char *buffer, ...@@ -1012,6 +1022,7 @@ static size_t print_parameters(struct connection *c,const unsigned char *buffer,
case ft_GET: case ft_GET:
case ft_SET: case ft_SET:
case ft_EVENT: case ft_EVENT:
case ft_FRACTION16_16:
case ft_FIXED: case ft_FIXED:
case ft_LISTofFIXED: case ft_LISTofFIXED:
assert(0); assert(0);
......
...@@ -97,6 +97,8 @@ struct parameter { ...@@ -97,6 +97,8 @@ struct parameter {
ft_FIXED, ft_FIXED,
/* a list of those */ /* a list of those */
ft_LISTofFIXED, ft_LISTofFIXED,
/* fraction with nominator and denominator 16 bit */
ft_FRACTION16_16,
/* set stored value to specific value */ /* set stored value to specific value */
ft_SET ft_SET
} type; } type;
......
...@@ -1684,19 +1684,17 @@ REQUEST Bell ...@@ -1684,19 +1684,17 @@ REQUEST Bell
END END
REQUEST ChangePointerControl REQUEST ChangePointerControl
4 acceleration-numerator INT16 4 acceleration FRACTION16_16
6 acceleration-denominator INT16 8 threshold INT16
8 threshold INT16 10 do-acceleration BOOL
10 do-acceleration BOOL 11 do-threshold BOOL
11 do-threshold BOOL
END END
REQUEST GetPointerControl ALIASES Empty REQUEST GetPointerControl ALIASES Empty
RESPONSE GetPointerControl RESPONSE GetPointerControl
8 acceleration-numerator CARD16 8 acceleration FRACTION16_16
10 acceleration-denominator CARD16 12 threshold CARD16
12 threshold CARD16
END END
REQUEST SetScreenSaver REQUEST SetScreenSaver
......
...@@ -89,6 +89,7 @@ static const struct base_type { ...@@ -89,6 +89,7 @@ static const struct base_type {
{ "FORMAT8", ft_FORMAT8, SETS_FORMAT, 1}, { "FORMAT8", ft_FORMAT8, SETS_FORMAT, 1},
{ "BE32", ft_BE32, ALLOWS_CONSTANTS, 4}, { "BE32", ft_BE32, ALLOWS_CONSTANTS, 4},
{ "FIXED", ft_FIXED, 0, 4}, { "FIXED", ft_FIXED, 0, 4},
{ "FRACTION16_16", ft_FRACTION16_16, 0, 4},
{ "LISTofFIXED", ft_LISTofFIXED, USES_STORE|SETS_NEXT, 0}, { "LISTofFIXED", ft_LISTofFIXED, USES_STORE|SETS_NEXT, 0},
{ "PUSH8", ft_PUSH8, PUSHES, 1}, { "PUSH8", ft_PUSH8, PUSHES, 1},
{ "PUSH16", ft_PUSH16, PUSHES, 2}, { "PUSH16", ft_PUSH16, PUSHES, 2},
......
...@@ -451,12 +451,6 @@ REQUEST SetDeviceFocus ...@@ -451,12 +451,6 @@ REQUEST SetDeviceFocus
13 device CARD8 13 device CARD8
END END
# TODO: make that a built-in! (it can also be used in core)
STRUCT FRACTION length 4
0 numerator UINT16
2 denominator UINT16
END
LIST FEEDBACKSTATE variable min-length 4 LIST FEEDBACKSTATE variable min-length 4
# XIproto.ps has strange values here, XI.h looks more reasonable: # XIproto.ps has strange values here, XI.h looks more reasonable:
0 "feedback class" ENUM8 feedback_class 0 "feedback class" ENUM8 feedback_class
...@@ -474,7 +468,7 @@ SET_COUNTER 32 ...@@ -474,7 +468,7 @@ SET_COUNTER 32
20 auto-repeats LISTofCARD8 20 auto-repeats LISTofCARD8
ELSEIF 0 CARD8 1 ELSEIF 0 CARD8 1
# PTR # PTR
6 acceleration FRACTION 6 acceleration FRACTION16_16
10 treshold UINT16 10 treshold UINT16
NEXT 12 NEXT 12
ELSEIF 0 CARD8 2 ELSEIF 0 CARD8 2
...@@ -530,7 +524,7 @@ IF 12 CARD8 0 ...@@ -530,7 +524,7 @@ IF 12 CARD8 0
ELSEIF 12 CARD8 1 ELSEIF 12 CARD8 1
# PTR # PTR
4 mask BITMASK32 dv_pointer 4 mask BITMASK32 dv_pointer
18 acceleration FRACTION 18 acceleration FRACTION16_16
22 treshold UINT16 22 treshold UINT16
ELSEIF 12 CARD8 2 ELSEIF 12 CARD8 2
# STRING # STRING
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment