Reset click count on mouse motion.
This commit is contained in:
parent
7de7414e88
commit
0dc9c8d019
2 changed files with 11 additions and 3 deletions
|
@ -868,7 +868,8 @@ textcommit(Text *t, int tofile)
|
|||
|
||||
static Text *clicktext;
|
||||
static uint clickmsec;
|
||||
static int clickcount;
|
||||
static int clickcount;
|
||||
static Point clickpt;
|
||||
static Text *selecttext;
|
||||
static uint selectq;
|
||||
|
||||
|
@ -927,9 +928,12 @@ textselect(Text *t)
|
|||
b = mouse->buttons;
|
||||
q0 = t->q0;
|
||||
q1 = t->q1;
|
||||
dx = abs(clickpt.x - w->mc.xy.x);
|
||||
dy = abs(clickpt.y - w->mc.xy.y);
|
||||
clickpt = w->mc.xy;
|
||||
selectq = t->org+frcharofpt(t, mouse->xy);
|
||||
clickcount++;
|
||||
if(mouse->msec-clickmsec >= 500 || selecttext != t || clickcount > 3)
|
||||
if(mouse->msec-clickmsec >= 500 || selecttext != t || clickcount > 3 || dx > 3 || dy > 3)
|
||||
clickcount = 0;
|
||||
if(clickcount >= 1 && selecttext==t && mouse->msec-clickmsec < 500){
|
||||
textstretchsel(t, selectq, &q0, &q1, clickcount);
|
||||
|
|
|
@ -962,6 +962,7 @@ wdelete(Window *w, uint q0, uint q1)
|
|||
|
||||
static Window *clickwin;
|
||||
static uint clickmsec;
|
||||
static Point clickpt;
|
||||
static uint clickcount;
|
||||
static Window *selectwin;
|
||||
static uint selectq;
|
||||
|
@ -1018,9 +1019,12 @@ wselect(Window *w)
|
|||
b = w->mc.buttons;
|
||||
q0 = w->q0;
|
||||
q1 = w->q1;
|
||||
dx = abs(clickpt.x - w->mc.xy.x);
|
||||
dy = abs(clickpt.y - w->mc.xy.y);
|
||||
clickpt = w->mc.xy;
|
||||
selectq = w->org+frcharofpt(w, w->mc.xy);
|
||||
clickcount++;
|
||||
if(w->mc.msec-clickmsec >= 500 || clickwin != w || clickcount > 3)
|
||||
if(w->mc.msec-clickmsec >= 500 || clickwin != w || clickcount > 3 || dx > 3 || dy > 3)
|
||||
clickcount = 0;
|
||||
if(clickwin == w && clickcount >= 1 && w->mc.msec-clickmsec < 500){
|
||||
mode = (clickcount > 2) ? 2 : clickcount;
|
||||
|
|
Loading…
Reference in a new issue