Merge lp://staging/~chasedouglas/frame/v2 into lp://staging/frame
Status: | Merged |
---|---|
Merged at revision: | 45 |
Proposed branch: | lp://staging/~chasedouglas/frame/v2 |
Merge into: | lp://staging/frame |
Diff against target: |
6387 lines (+6005/-12) 46 files modified
.bzrignore (+4/-0) Makefile.am (+4/-1) configure.ac (+7/-1) doc/Doxyfile (+1749/-0) doc/Makefile.am (+42/-0) include/utouch/frame-mtdev.h (+14/-0) include/utouch/frame-xi2.h (+14/-0) include/utouch/frame.h (+624/-3) include/utouch/frame_x11.h (+136/-0) src/Makefile.am (+40/-6) src/libutouch-frame.ver (+47/-0) src/v2/axis.cpp (+54/-0) src/v2/axis.h (+55/-0) src/v2/device.cpp (+87/-0) src/v2/device.h (+56/-0) src/v2/event.cpp (+106/-0) src/v2/event.h (+55/-0) src/v2/frame.cpp (+258/-0) src/v2/frame.h (+68/-0) src/v2/handle.cpp (+87/-0) src/v2/handle.h (+59/-0) src/v2/property.h (+78/-0) src/v2/touch.cpp (+171/-0) src/v2/touch.h (+63/-0) src/v2/typedefs.h (+41/-0) src/v2/value.cpp (+201/-0) src/v2/value.h (+99/-0) src/v2/window.cpp (+47/-0) src/v2/window.h (+53/-0) src/v2/x11/device_x11.cpp (+222/-0) src/v2/x11/device_x11.h (+66/-0) src/v2/x11/frame_x11.cpp (+74/-0) src/v2/x11/handle_x11.cpp (+182/-0) src/v2/x11/handle_x11.h (+63/-0) src/v2/x11/window_x11.cpp (+198/-0) src/v2/x11/window_x11.h (+66/-0) tools/Makefile.am (+17/-0) tools/common-defs.h (+1/-1) tools/common/device.c (+188/-0) tools/common/device.h (+28/-0) tools/common/frame.c (+80/-0) tools/common/frame.h (+24/-0) tools/common/touch.c (+213/-0) tools/common/touch.h (+25/-0) tools/utouch-frame-test-x11.c (+221/-0) tools/utouch-frame-test-x11.txt (+18/-0) |
To merge this branch: | bzr merge lp://staging/~chasedouglas/frame/v2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stephen M. Webb (community) | Approve | ||
Chase Douglas (community) | Needs Resubmitting | ||
Jussi Pakkanen (community) | Approve | ||
Review via email: mp+81794@code.staging.launchpad.net |
This proposal supersedes a proposal from 2011-08-27.
Description of the change
This branch includes all the agreed upon changes.
Original description
=======
This adds a v2.x layer of the uTouch-Frame library. It co-exists with the v1.x layer for now, but the goal should be to remove the v1.x layer once we have moved to the client-side architecture. Differences and reasons for an upgrade:
* v1 has a push and pull api, there was a queue, but no way to signal that data was available.
- v2 has a queue and provides an eventfd signaling interface.
* v1 uses a ring buffer of public structures as its api. This creates ABI breakage every time the structure is extended.
- v2 uses opaque objects retrieved from a queue in an opaque object.
* v1 works on a per-device level. This means a new context must be created for every new device, adding extra overhead and management.
- v2 uses one context and provides events when devices are added/removed
* In order to be fast, v1 allocated all memory up front. The user is required to specify at context creation time how much buffering to use. If you specified too much you wasted memory; if you specified too little you might overrun your buffer. The amount is hard to determine, and the best choice is probably machine and load specific.
- v2 uses C++ under the covers, and objects that are frequently created and destroyed are allocated from pools of memory, either through the standard library in the case of std::vector and std::queue or through __gnu_cxx:
* v1 copies the all the touches from one frame to the next when a new frame is created.
- v2 uses std::shared_ptr and only copies the shared_ptr context from frame to frame when a touch is unchanged. Thus, a five touch frame where only one touch has changed copies and consumes the memory of only one touch instead of five.
* v1 calculates the velocity of each touch
- v2 drops this. I feel it should be done elsewhere
* v1 provides pointers to other objects in the ring buffer as though it were a linked list to allow for the user to see the state of a touch in a previous frame. However, there was no guarantee that the pointers were valid beyond the previous touch to the current frame.
- In v2 all objects have a defined lifetime. The lifetime of device-related objects (the device itself and its axis objects) is until a device removed event is put back to the library. The lifetime of a frame and its touches is until the event for the frame is put back to the library. In theory any number of events may be retrieved from the library at a time, but they must be put back in the order of retrieval or undefined results will occur.
* v1 has support for reading from mtdev.
- v2 drops this. It will not have any use once we move to the client side architecture.
* v1 is written in Henrik's coding style (which is fine :).
- v2 conforms to the Google C++ code style (which is what the DX team has agreed to).
If you want to test it, check it out, build it as usual, and run tools/utouch-
Every single comment I have made about accessor functions vs generic property getter/setter applies here too. In fact it applies even stronger. As an example, the Axis class has no use for a generic setter. None. Zilch. Zero. There are no new properties that can magically appear at runtime. They are all specified by the kernel interface, the type enum and they are all required arguments of the constructor. All it does is complexify the code and circumvent the type system making the entire thing more fragile.
And if opaque getters and setters are to be used, they better be used everywhere and always. For example, UFTouchClass has getters and setters for id and state but not others. Which is it gonna be?
UFHandleClass requires an Initialize call before it is usable. This is wrong. Either this needs to be done in the constructor or a static factory. It might be sensible not to use exceptions in this case since Frame is being used as a C library. I'm not quite sure what happens if an exception escapes the boundary.
There are multiple duplicate declarations of SharedUFDeviceC lass, SharedUFDeviceClass etc. There can be only one.
The PutEvent/GetEvent interface is a bit cryptic. Why is it called PutEvent if it just deletes the event. Should it not be ReleaseEvent? "Put" in a container object implies adding new stuff for further use. Actually, the entire interface seems a bit fishy to me. Could you give an example on how you envision it will be used and how it differs from the current API.
If this is going to be C++0x, then these sorts of structures:
for (unsigned int i = 0; i < prev_-> touches_ array_. size(); ++i) { touches_ array_[ i];
const SharedUFTouchClass& prev_touch = prev_->
should be replaced with auto iterators.
And so on and so on. I'm going to mark this as rejected simply to signal that there is a lot of work to be done.