iRex Forum Forum Index iRex Forum

 
 FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

button and eraser (IE multi-button pointer) support

 
Post new topic   Reply to topic    iRex Forum Forum Index -> Stylus Calibration
View previous topic :: View next topic  
Author Message
jayk
Community Developer


Joined: 19 Nov 2006
Posts: 90

PostPosted: Sat Jun 02, 2007 10:32 pm    Post subject: button and eraser (IE multi-button pointer) support Reply with quote

Hi all,

I recently got a cross 'penabled' stylus - based on a suggestion by scotty1024 in another forum... and I like it... it fits in the hand a lot nicer than the default iLiad stylus... I still mostly use the built-in one so far, but it's nice to have an alternate.... I think I'd use it more if the button and eraser worked....

However, it has gotten me thinking... it really would be nice if we could get the additional button / eraser working on stylii that support it. I've been pondering this while I was travelling and it would require just a couple of small modifications to tslib and a maybe 10-line patch to kdrive.

Anybody have any interest in this aside from me? The way I see it, it would make many programs more easily ported to the iLiad interface, if you could essentially have a second and third 'mouse' button.... The built-in stylus would still work fine, but the additional buttons could be useful for more advanced apps...

Basically I'm thinking of adding a button flag to the ts sample structure, allowing us to not only register pressure, but indicate that it is the stylus tip / button / eraser that is triggered. One benefit to doing it this way is also that you could create a filter that could monitor the pressure/position and create a synthetic 'button-2' press on a press+hold, for example. Thus giving you instant second-button even on a non-buttoned stylus.

Matthijs - any interest from iRex on this type of functionality?

I will probably wind up playing with it anyway eventually - but if there is interest I might move it up on my priority list... since we already missed the 2.10 cutoff it might be a nice thing to add.

Thoughts?

JayK
Back to top
View user's profile Send private message
cdnebklvr



Joined: 12 Apr 2007
Posts: 38
Location: Atlantic Canada

PostPosted: Sun Jun 03, 2007 3:13 pm    Post subject: Reply with quote

Hi jayk.

I'd be interested in having this functionality. Plus it would give me a good excuse to buy another stylus Smile .
Back to top
View user's profile Send private message
jayk
Community Developer


Joined: 19 Nov 2006
Posts: 90

PostPosted: Sun Jun 03, 2007 5:51 pm    Post subject: Reply with quote

cdnebklvr wrote:
I'd be interested in having this functionality. Plus it would give me a good excuse to buy another stylus Smile .

Well, Dust off your wallet, because I was actively procrastinating what I should have been doing... and I coded it up last night. Very Happy

The stylus tip produces a button 1. Stylus eraser produces a button 2 and stylus button produces button 3.

I had a minor problem with what I thought was the pthreshold module - but it turned out that it was only triggered by the threshold module and was actually in the kdrive code.

We don't really need the threshold module on the iLiad - since we don't have the same kind of variations that you get on a real touchscreen... but I wanted to make sure it worked. It does now.. but I still need to tweak it a bit so that it passes button events (right now it ignores any event that doesn't have pressure - which is incorrect if we just have the side button pressed)

Anyway - I'll bundle up the code and post it later today.

JayK
Back to top
View user's profile Send private message
cdnebklvr



Joined: 12 Apr 2007
Posts: 38
Location: Atlantic Canada

PostPosted: Sun Jun 03, 2007 6:24 pm    Post subject: Reply with quote

Who said that procrastination is a bad thing Smile . I've got a black belt in procrastination myself. Welcome to the club.
Back to top
View user's profile Send private message
ribrdb



Joined: 20 Sep 2006
Posts: 22

PostPosted: Mon Jun 04, 2007 12:59 am    Post subject: Reply with quote

Is there a way to tell if the button is pressed and either the tip or eraser is down at the same time?
Back to top
View user's profile Send private message
jayk
Community Developer


Joined: 19 Nov 2006
Posts: 90

PostPosted: Mon Jun 04, 2007 1:49 am    Post subject: Reply with quote

ribrdb wrote:
Is there a way to tell if the button is pressed and either the tip or eraser is down at the same time?


Yes.

The buttons are independant and mapped to 'normal' mouse buttons - so:

Stylus Tip = Button 1
Stylus Eraser = Button 2
Stylus Button = Button 3

So if the stylus button is pushed and the tip has pressure, then both mouse button 1 and mouse button 3 register as pressed at the same time. Likewise if Eraser and stylus button are pressed.

The only exception is that you can't have both Button 1 and Button 2 (Tip and Eraser) at the same time... for the obvious reasons... (and because the wacom hardware detects them using pressure and the 'eraser' flag - which is on if it's the eraser and off if it's the tip)

Note also that the button does NOT require the tip to be in contact in order to register the button press. (in fact tip + button = 2 'mouse' buttons down) Might be a use for that threshold plugin afterall - set pressure less than 50 as 'no contact' ... Dunno... that I think will be a personal preference thing.

JayK
Back to top
View user's profile Send private message
jayk
Community Developer


Joined: 19 Nov 2006
Posts: 90

PostPosted: Mon Jun 04, 2007 4:23 am    Post subject: Multiple Button / Eraser support - Complete Reply with quote

Hey all!

I have finished the patches to tslib / kdrive to support the stylus button and eraser...

This actually adds general support to tslib to allow for multiple buttons. the patch to kdrive is just to process the additional buttons from tslib and turn them into 'mouse buttons' as appropriate.

For those who are curious, basically it leaves the Tip of the stylus as button 1. The Eraser is now button 2. The button on the stylus is button 3.

I also added a plugin for those who don't have a fancy stylus. It's called the 'taphold' plugin and it lets you put the tip down and hold for a short period (configurable, defaults to half-second), and it will turn the tap into your button 3 (or whatever button you configure). This effectively gives the bundled iLiad stylus the ability to right-click. Once triggered - all stylus events will remain as 'button 3' until the stylus is lifted from the screen (IE pressure goes to 0) at which point it resets. This allows you to 'draw' with button 3... or, for example, tap-hold and drag to the menu option you like.

All the code / patches are available here. The iLiad-Calibration-multi-button.tar.gz file contains the pre-built binaries - everything that was in the original calibration binary package + the multi-button enabled tslib+kdrive.

Finally - I put up a new start.sh - this one allows you to revert to the old Xfbdev by simply creating a file in the iLiad content root (aka /mnt/free) called notslib.txt I've been able to do this by plugging in the USB cable even when the X server was not running. So it should, effectively, give folks a way to back-out of the tslib / calibrated X server.

So - there it is. I think that pretty much wraps up the stylus project - I don't know what else there could be to do. I think the multi-button functionality + the taphold plugin opens up a whole new realm of apps to port... and makes some new features possible in the ones that are already built.

Unless anybody finds issues with these - I'm using them locally and they are fine so far.... I'm comfortable saying that stylus calibration is solid and if someone wants to build a binary package - Go for it.

JayK
Back to top
View user's profile Send private message
Matthijs
iRex Employee
iRex Employee


Joined: 18 Jul 2006
Posts: 948
Location: Eindhoven

PostPosted: Mon Jun 04, 2007 8:13 am    Post subject: Reply with quote

Very nice feature!
Back to top
View user's profile Send private message
scotty1024



Joined: 03 Aug 2006
Posts: 240
Location: Seattle, WA US

PostPosted: Mon Jun 04, 2007 4:13 pm    Post subject: Reply with quote

Way to go JayK, this is something iRex should have had from the very beginning!

Now to see if it works with their sprite drawing engine.
Back to top
View user's profile Send private message
scotty1024



Joined: 03 Aug 2006
Posts: 240
Location: Seattle, WA US

PostPosted: Thu Jun 07, 2007 8:37 pm    Post subject: Reply with quote

JayK have you tried this with the HWR panel yet?

I'm getting some bad results with what I'm guessing is the tap/hold feature.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    iRex Forum Forum Index -> Stylus Calibration All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


You can find our complete guidelines here.
Powered by phpBB © 2001, 2005 phpBB Group