[PATCH 1/3] user32/tests: Added client-side raw input function tests (try 5)
vincas.miliunas at gmail.com
Mon Jun 20 14:59:27 CDT 2011
Patch refactoring, based on the feedback:
> Please don't do this. Just explicitly use 0xdeadbeef everywhere.
> If call succeeded you don't need to check last error.
> Don't use malloc/free in Wine. Use HeapAlloc / HeapFree.
> If something fails it's nice to know the error code - you need to
> For that you need to more GetLastError outside of ok() function call. See
> other tests as example.
> Static variables automatically set to 0 at the start. You don't need
> it explicitly.
Explicit is better then implicit, but OK.
> Mouse and keyboard fields should be a union to save space.
Saves 8 bytes, adds source code noise, but OK.
> Please use "sizeof(array)/sizeof(array)" construct instead.
> In server please use standard C types ("unsigned int" in this case).
> This doesn't sound right. What this handle can be used for?
These handles are used to identify the raw input devices in order to
read their metadata using the GetRawInputDeviceInfo function. I am not
aware of any other way that would make sense for an app to use them.
> In server please use mem_alloc() instead.
> I don't see handing of case where device is not found. Should you return
> error instead?
I've added a new test and windows allows to successfully unsubscribe
from a device, that one is not subscribed to, thus it should not return
> You can use this instead:
> LIST_FOR_EACH_ENTRY( registration, ¤t->process->raw_registered,
> struct raw_registration, entry )
> Looks like you need a circular buffer (an array of fixed size with
> tail pointers) instead of a list here.
I think it adds unnecessary complexity. It's a sparse buffer used by all
of the registered devices by the process, the entries can be freed at
any point in the buffer. A list gets the job done with less source code
and noise. Also, slight computational overhead of a list is hardly
relevant; but OK, this revision uses it.
Thanks for feedback!
dlls/user32/tests/input.c | 498
1 files changed, 498 insertions(+), 0 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 23389 bytes
Desc: not available
More information about the wine-patches