/srv/irclogs.ubuntu.com/2012/08/31/#ubuntu-touch.txt

=== dandrader is now known as dandrader|afk
=== dandrader|afk is now known as dandrader
=== dandrader is now known as dandrader|afk
brendandcnd, hey - i heard you might have some utility which allows me to experiment with MT touchscreen stuff without needing a touchscreen?15:40
cndbrendand: hmm?15:40
brendandcnd, something to record and play back touch events?15:40
cndyeah, evemu15:41
cndhttp://launchpad.net/evemu15:41
cndyou can use it to record input device events and play them back later15:41
=== dandrader|afk is now known as dandrader
dandradercnd, damn. I accidentally pushed directly to lp:frame when trying to update the merge request branch17:12
cnddandrader: just back it out17:13
dandraderyep17:13
cndno worries17:13
cndjust try to be quick about it :)17:13
dandradercnd,  done. and the merge request is now updated, by the way :)17:15
cndcool, I'll take a look right now17:16
dandraderawesome17:16
cnddandrader: it's pretty good, though what happens if a backend borrows a touch but then doesn't give it back?17:28
cndwe're left in a bit of an errant state17:28
dandradercnd, yes. bad backend!17:28
cndwhy can't we simply clone the touch, leaving it in the frame as it is17:28
cndand then overwriting the frame's reference if the touch is given to it17:28
cndthis would always ensure invariance of the frame state17:29
dandraderbecause that's inefficient17:29
cndhow?17:29
dandraderby unnecessarily cloning a touch17:29
cndactually, doesn't borrow_touch_by_id return the same touch, but wrapped in a new UFBackendTouch object?17:31
cndif you change its values, doesn't it change the values of the touch for previous frames?17:31
dandradercnd,  so you propose UFBackendTouch to hold a UFTouch instead of a UFSharedTouch ?17:31
dandradercnd, it depends17:32
dandradercnd, if the UFTouch has only one reference. it's just updated17:32
dandradercnd, if it has more than one reference, it's first cloned and then its clone is updated17:32
cndok, I remember that logic now17:33
cndlet me think a minute17:33
cndit sounds like that's the main reason you have for the borrow semantics17:33
cndthat way the backend is the only one with a reference to the touch17:34
cndthus it evaluates as unique17:34
dandradercnd, right17:34
cndif we change the rules slightly, I think it could still work and leave frame invariant17:34
cndsay when you update the touch values, it checks if there are only two references17:34
cndone for the only usage in its frame, and one for the backend reference17:35
dandraderhmm.... sounds dangerous... making assumptions...17:36
cndwe can assert if the use_count is only 1, since that should never happen17:36
cndand we are only using this check for the backend API17:36
cndi.e. the built-in X11 backend shouldn't be interfered with17:37
cndthe only way I can see there being bad behavior is if:17:38
cndthe backend gets a reference to the touch17:38
cndthe ref count is now 217:38
cndthe backend deletes the touch, perhaps by giving it back to the frame17:39
cndthe ref count is now 117:39
cndbut then the backend reuses the touch, since it may still have a valid pointer value17:39
cndbut that's obviously very wrong :)17:39
cndand besides, you delete the touch record altogether in frame_backend_frame_give_touch17:40
cndso it shouldn't really be possible with explicit pointer shenanigans :)17:40
cnds/with/without/17:40
dandradernot giving back a borrowed touch is also very wrong17:40
dandraderso let me recap17:41
cndof course, but it's merely a memory leak17:41
dandraderyou want to s/borrow_touch/get_touch17:41
cndrather than something that could potentially cause bad behavior on the frontend client side17:41
dandradercnd, ^?17:42
dandraderand keep the give_touch?17:42
cndyeah, I want to be sure that I can't take a reference to the touch, hold on to it, and hence screw up the client who will be all confused when it can't find the touch in the frame17:43
dandraderthe client won't be confused17:43
cndlet's say there's a touch with ID of 517:43
dandraderbecause you're editing a frame for a event that hasn't even been created yet17:43
dandradernot alone sent to the client17:43
dandraders/not/let17:43
cndoh, but what if you do send the event on before you gave the touch back?17:44
cndbecause of a bug17:44
cndsome of my thoughts here are due to similar bugs I've made myself in things like the X input modules17:44
cndif there's a possibility that a touch may be "lost" in the state somewhere, it gets really hard to figure out what's going on, and it often leads to crashes17:45
cndhowever, a touch getting "stuck", but leaving the rest of the state intact, usually just leads to some gestures stopping from working17:45
dandradercould you draft the API that you're proposing and pastebing it?17:47
dandraderIt's not very clear to me17:47
dandraderhow do you get a touch from a frame. and how do you get rid of that touch later on17:48
dandradertouh backend, that is17:48
dandraderand how you give a touch to a frame17:48
cndthe api is basically exactly what you've got18:03
cndjust that you don't "borrow" a touch by swapping references out18:03
cndyou simply give the backend a reference to the touch18:04
cndthen, when you change properties, you check if the use_count of the shared_ptr > 2, in which case you need to do a hard copy18:04
cndI think that's all that needs to change18:07
cndI guess in give_touch, you just need to add the touch to the frame, overwriting any touch that already is there for the same touch id18:07
dandraderI think that would just serve to hide bogus situations18:09
dandraderhmm18:10
cndthat's the point, really18:13
cndmaking it less bad if you make a mistake in your backend code18:13
=== dandrader is now known as dandrader|afk
=== dandrader|afk is now known as dandrader
dandradercnd, what I don't like about your implementation is that it adds dependencies between seemingly independent implementations. Now the UFTouchBackend lazy-copy scheme will be twisted because it knows that if refcount==2 it's because one of the refs is being held by UFFrame while the touch is being borrowed etc so please ignore it and consider as if the refcount was just one instead18:40
cndyeah, I agree that part is a bit messy18:41
cndIf you feel strongly about it, I'm ok with your approach18:41
dandraderhmm, so it looks like we are coming to an agreement.  Then could you please please finalize your review? :)18:48
cndyeah18:58
cnddandrader: I reviewed it18:59
dandradercnd,  thanks!19:00
cndnp :)19:01

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!