abom / linux-whiteboard

Automatically exported from code.google.com/p/linux-whiteboard
GNU General Public License v2.0
1 stars 0 forks source link

Latest snapshot - Right clicking supported #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It looks like I over-engineered the thing for so little in return. I
abandoned the customizable idea though a configuration file (although it's
still possible to just write ad-hoc code for every popular control scheme).

This snapshot allows right-clicking by holding the IR pen for 0.7s. Note
that I'm really frustrated by some strange threading behavior which worked
fine under a debugger, but behaved differently in normal cases. The exact
less-than-20 lines of code!.

Anyway, it worked, I'm gonna clean it up a bit and write new stuff like a
GUI, and fix the (normal) jerky behavior of the IR.

Original issue reported on code.google.com by vanhtu1...@gmail.com on 29 Jan 2008 at 6:10

Attachments:

GoogleCodeExporter commented 9 years ago
Updated.

Original comment by vanhtu1...@gmail.com on 29 Jan 2008 at 6:57

Attachments:

GoogleCodeExporter commented 9 years ago
I'm gonna review your patches on weekend. I do not have enough time during work 
days.

Thanks for your work and dedication.

Original comment by pere.ne...@gmail.com on 29 Jan 2008 at 9:05

GoogleCodeExporter commented 9 years ago
I've cleaned up all of the crufts from last attempts (even the hack with 100% 
CPU
usage that allows right-clicking) in favor of threading, which is the proper 
way to
do it, IMO.

MOUSE DOWN, MOUSE UP, MOUSE MOVE and MOUSE WAIT events are correctly detected 
using
my simple algorithms. They have been unit tested (now have been removed as well,
along with the events stuff).

Each time there is a MOUSE DOWN event, a new thread is spawned into existence to
check for how long user has been holding the IR pen down. If true, a right click
event is fired. If the 'mouse' moves a certain distance, the effect is canceled 
and
the thread is killed.

The same algorithm is used in calibration phase. But when putting inside a 
thread,
for some unknown reason. The loop never got executed more than once.

When running under a debugger (gdb, I used cgdb), that same code executed fine. 
Now
that I'd be gladly appreciated if anyone will point out my stupidity ;s .

I suspect that libcwiid somehow intervened with my thread code. I've written a 
same
function (without classes and the actual Wii though) in a new test program. It 
showed
no weird behavior.

My latest snapshot:

Original comment by vanhtu1...@gmail.com on 29 Jan 2008 at 10:00

Attachments:

GoogleCodeExporter commented 9 years ago
I rewrote the threading code with boost's threading library. The result was the 
same:
the loop never got executed twice, which is not really surprising considering 
that
boost is just a wrapper for pthread.

:( I'm gonna fix the jerky mouse motion first.

Original comment by vanhtu1...@gmail.com on 31 Jan 2008 at 8:20

GoogleCodeExporter commented 9 years ago
Problem solved :-) that was my fault.

Original comment by vanhtu1...@gmail.com on 31 Jan 2008 at 9:43

GoogleCodeExporter commented 9 years ago

Original comment by vanhtu1...@gmail.com on 31 Jan 2008 at 9:47