View Single Post
Old 10-27-2014, 05:27 AM   #6
zxczxc
Addict
zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.
 
Posts: 229
Karma: 136002
Join Date: Apr 2013
Device: PW
a way to implement double click could be, only register the 'even' number of touch.
so, if it's the first touch, do nothing.
if the second touch, accept it.
start the loop again.

i guess you would want to make a timeout too, so the 2nd touch has to happen within .5 seconds from the 1st.

surely there must be a way to hook in to the touch screen and do that - for the people in the know who want to do this.
good luck

Quote:
Originally Posted by baf View Post
I came up with a solution for Kindle Touch once.
Maybe someone could adjust it to work with double click on PW.
i remember seeing this beore, nice idea, although i don't have a use for it personally.
it should be very possible for someone to put the ideas i wrote above, into your code, if that would be ok

-edit. i just realized, doing it so simply like i said, you could press anywhere initially, and have the 2nd press at a completely different part of the screen, and it would reigster.
it would be best to have some leeway, the 2nd click is only recognized if it is +-5px of the first.


i wrote some basic, unworking, out of context code. i started working with baf's program, although having never worked with X11, never complied anything for kindle, etc etc, i'm not in a position to test it out so it's not really worth my time to do anymore since i won't be able to see what is right and wrong.
if anyone else wants to carry on from what i did then:


Spoiler:

Code:
//////
bool IgnoreTouch = true; //will the touch be ignored or not
bool isSecondTouch = false; //is this the second touch? -- is this NOT the first touch in 0.5 seconds?

int doubleClickDuration = 500;
int previousX = 0; // xpos of first click
int previousY = 0; // ypos of first click
//////





clickTime = xev.xkey.time;
timeDiff = (long) xev.xkey.time - (long) clickTime;

//check if this could be a double click -  see if the time difference between this touch and the previous is 0.5 seconds or less
if(timeDiff <= doubleClickDuration){
	isSecondTouch = true;
} else {
	isSecondTouch = false;
}


if(isSecondTouch){
	//if 2nd touch is +- 1px away from 1st
 	if( (xev.xbutton.x >= previousX - 1)  && (xev.xbutton.x <= previousX + 1) ){

 		if( (xev.xbutton.y >= previousY - 1)  && (xev.xbutton.y <= previousY + 1) ){

 			IgnoreTouch = false;

 		}
	}
}

//if this is a first touch, save the position so that we can check against it in the second touch
//because the touches need to be in the same place
if(!isSecondTouch){
	previousX = xev.xbutton.x;
	previousY = xev.xbutton.y;
}

Last edited by zxczxc; 10-27-2014 at 10:02 AM.
zxczxc is offline   Reply With Quote